aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-12-12 19:09:22 -0500
committerOlof Johansson <olof@lixom.net>2012-12-12 19:10:00 -0500
commit4a76411ea3f1da9032e031f8fff8894b97d141b2 (patch)
tree59976175d70b6e08aacd4abf7090919d3b78fc29 /arch/arm
parent5c1af2a7011bf719807de360cb64c2f610269a38 (diff)
parentfb6842a7bc44bf719bfe85d5819a153d7c215510 (diff)
ARM: arm-soc: Merge branch 'next/clk' into next/pm
Merge together a couple of the smaller pm/clock branches into one. Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm')
-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.c508
-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.h8
-rw-r--r--arch/arm/mach-omap1/devices.c36
-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.c3
-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/debug-macro.S2
-rw-r--r--arch/arm/mach-omap1/include/mach/hardware.h6
-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/serial.h53
-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/include/mach/uncompress.h121
-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/reset.c41
-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/Kconfig5
-rw-r--r--arch/arm/mach-omap2/Makefile126
-rw-r--r--arch/arm/mach-omap2/am33xx.h1
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c8
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c6
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c3
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c4
-rw-r--r--arch/arm/mach-omap2/board-apollon.c6
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c26
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c8
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c13
-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-generic.c10
-rw-r--r--arch/arm/mach-omap2/board-h4.c8
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c13
-rw-r--r--arch/arm/mach-omap2/board-ldp.c11
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c18
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c5
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c13
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c8
-rw-r--r--arch/arm/mach-omap2/board-overo.c13
-rw-r--r--arch/arm/mach-omap2/board-rm680.c13
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c7
-rw-r--r--arch/arm/mach-omap2/board-rx51.c10
-rw-r--r--arch/arm/mach-omap2/board-ti8168evm.c7
-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.c3
-rw-r--r--arch/arm/mach-omap2/board-zoom.c12
-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/cclock2420_data.c1950
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c2065
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c961
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c3595
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c1987
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c92
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpll.c12
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c48
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c15
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c9
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c84
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c12
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c196
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c30
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c32
-rw-r--r--arch/arm/mach-omap2/clock.c470
-rw-r--r--arch/arm/mach-omap2/clock.h452
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c1990
-rw-r--r--arch/arm/mach-omap2/clock2430.c12
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c2089
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c19
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h48
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c1112
-rw-r--r--arch/arm/mach-omap2/clock34xx.c55
-rw-r--r--arch/arm/mach-omap2/clock3517.c28
-rw-r--r--arch/arm/mach-omap2/clock36xx.c24
-rw-r--r--arch/arm/mach-omap2/clock36xx.h2
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c8
-rw-r--r--arch/arm/mach-omap2/clock3xxx.h6
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c3617
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c3402
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c22
-rw-r--r--arch/arm/mach-omap2/clockdomain.c92
-rw-r--r--arch/arm/mach-omap2/clockdomain.h5
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c339
-rw-r--r--arch/arm/mach-omap2/clockdomain33xx.c74
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c151
-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/cm-regbits-24xx.h7
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h31
-rw-r--r--arch/arm/mach-omap2/cm.h30
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c381
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h70
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h126
-rw-r--r--arch/arm/mach-omap2/cm33xx.c58
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c (renamed from arch/arm/mach-omap2/cm2xxx_3xxx.c)371
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h91
-rw-r--r--arch/arm/mach-omap2/cm_common.c139
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c142
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h2
-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.c187
-rw-r--r--arch/arm/mach-omap2/common.h143
-rw-r--r--arch/arm/mach-omap2/control.c18
-rw-r--r--arch/arm/mach-omap2/control.h2
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c1
-rw-r--r--arch/arm/mach-omap2/devices.c34
-rw-r--r--arch/arm/mach-omap2/display.c47
-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.c185
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c23
-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.c8
-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.c57
-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/id.c7
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-omap2/include/mach/uncompress.h175
-rw-r--r--arch/arm/mach-omap2/io.c109
-rw-r--r--arch/arm/mach-omap2/mcbsp.c9
-rw-r--r--arch/arm/mach-omap2/mmc.h23
-rw-r--r--arch/arm/mach-omap2/msdi.c11
-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/omap2-restart.c65
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c36
-rw-r--r--arch/arm/mach-omap2/omap4-common.c26
-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.c126
-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.c13
-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.c11
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c22
-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_phy_internal.c4
-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.c16
-rw-r--r--arch/arm/mach-omap2/pm34xx.c15
-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.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain.h2
-rw-r--r--arch/arm/mach-omap2/powerdomain2xxx_3xxx.c242
-rw-r--r--arch/arm/mach-omap2/powerdomain33xx.c229
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c285
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h22
-rw-r--r--arch/arm/mach-omap2/prcm.c188
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c17
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h9
-rw-r--r--arch/arm/mach-omap2/prm-regbits-24xx.h8
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h13
-rw-r--r--arch/arm/mach-omap2/prm.h77
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c139
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h134
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c332
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h285
-rw-r--r--arch/arm/mach-omap2/prm33xx.c204
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c417
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h162
-rw-r--r--arch/arm/mach-omap2/prm44xx.c356
-rw-r--r--arch/arm/mach-omap2/prm44xx.h2
-rw-r--r--arch/arm/mach-omap2/prm_common.c118
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h2
-rw-r--r--arch/arm/mach-omap2/scrm44xx.h2
-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.c31
-rw-r--r--arch/arm/mach-omap2/sdrc.h148
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c6
-rw-r--r--arch/arm/mach-omap2/serial.c13
-rw-r--r--arch/arm/mach-omap2/serial.h (renamed from arch/arm/plat-omap/include/plat/serial.h)20
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S6
-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/sram242x.S4
-rw-r--r--arch/arm/mach-omap2/sram243x.S4
-rw-r--r--arch/arm/mach-omap2/sram34xx.S2
-rw-r--r--arch/arm/mach-omap2/ti81xx.h9
-rw-r--r--arch/arm/mach-omap2/timer.c6
-rw-r--r--arch/arm/mach-omap2/twl-common.c3
-rw-r--r--arch/arm/mach-omap2/usb-host.c6
-rw-r--r--arch/arm/mach-omap2/usb-musb.c8
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c3
-rw-r--r--arch/arm/mach-omap2/usb.h82
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/wd_timer.c40
-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/menelaus.h49
-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/prcm.h37
-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/uncompress.h204
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h179
-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
291 files changed, 18818 insertions, 20111 deletions
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index e255164ff087..a8fce3ccc707 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -625,7 +625,6 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
625 .atag_offset = 0x100, 625 .atag_offset = 0x100,
626 .map_io = ams_delta_map_io, 626 .map_io = ams_delta_map_io,
627 .init_early = omap1_init_early, 627 .init_early = omap1_init_early,
628 .reserve = omap_reserve,
629 .init_irq = omap1_init_irq, 628 .init_irq = omap1_init_irq,
630 .init_machine = ams_delta_init, 629 .init_machine = ams_delta_init,
631 .init_late = ams_delta_init_late, 630 .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..931f3f6d396b 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,11 @@
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23 24
24#include <plat/cpu.h>
25#include <plat/usb.h>
26#include <plat/clock.h>
27#include <plat/sram.h>
28#include <plat/clkdev_omap.h>
29
30#include <mach/hardware.h> 25#include <mach/hardware.h>
31 26
27#include "../plat-omap/sram.h"
28
29#include "soc.h"
32#include "iomap.h" 30#include "iomap.h"
33#include "clock.h" 31#include "clock.h"
34#include "opp.h" 32#include "opp.h"
@@ -36,6 +34,10 @@
36__u32 arm_idlect1_mask; 34__u32 arm_idlect1_mask;
37struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; 35struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
38 36
37static LIST_HEAD(clocks);
38static DEFINE_MUTEX(clocks_mutex);
39static DEFINE_SPINLOCK(clockfw_lock);
40
39/* 41/*
40 * Omap1 specific clock functions 42 * Omap1 specific clock functions
41 */ 43 */
@@ -607,3 +609,497 @@ void omap1_clk_disable_unused(struct clk *clk)
607} 609}
608 610
609#endif 611#endif
612
613
614int clk_enable(struct clk *clk)
615{
616 unsigned long flags;
617 int ret;
618
619 if (clk == NULL || IS_ERR(clk))
620 return -EINVAL;
621
622 spin_lock_irqsave(&clockfw_lock, flags);
623 ret = omap1_clk_enable(clk);
624 spin_unlock_irqrestore(&clockfw_lock, flags);
625
626 return ret;
627}
628EXPORT_SYMBOL(clk_enable);
629
630void clk_disable(struct clk *clk)
631{
632 unsigned long flags;
633
634 if (clk == NULL || IS_ERR(clk))
635 return;
636
637 spin_lock_irqsave(&clockfw_lock, flags);
638 if (clk->usecount == 0) {
639 pr_err("Trying disable clock %s with 0 usecount\n",
640 clk->name);
641 WARN_ON(1);
642 goto out;
643 }
644
645 omap1_clk_disable(clk);
646
647out:
648 spin_unlock_irqrestore(&clockfw_lock, flags);
649}
650EXPORT_SYMBOL(clk_disable);
651
652unsigned long clk_get_rate(struct clk *clk)
653{
654 unsigned long flags;
655 unsigned long ret;
656
657 if (clk == NULL || IS_ERR(clk))
658 return 0;
659
660 spin_lock_irqsave(&clockfw_lock, flags);
661 ret = clk->rate;
662 spin_unlock_irqrestore(&clockfw_lock, flags);
663
664 return ret;
665}
666EXPORT_SYMBOL(clk_get_rate);
667
668/*
669 * Optional clock functions defined in include/linux/clk.h
670 */
671
672long clk_round_rate(struct clk *clk, unsigned long rate)
673{
674 unsigned long flags;
675 long ret;
676
677 if (clk == NULL || IS_ERR(clk))
678 return 0;
679
680 spin_lock_irqsave(&clockfw_lock, flags);
681 ret = omap1_clk_round_rate(clk, rate);
682 spin_unlock_irqrestore(&clockfw_lock, flags);
683
684 return ret;
685}
686EXPORT_SYMBOL(clk_round_rate);
687
688int clk_set_rate(struct clk *clk, unsigned long rate)
689{
690 unsigned long flags;
691 int ret = -EINVAL;
692
693 if (clk == NULL || IS_ERR(clk))
694 return ret;
695
696 spin_lock_irqsave(&clockfw_lock, flags);
697 ret = omap1_clk_set_rate(clk, rate);
698 if (ret == 0)
699 propagate_rate(clk);
700 spin_unlock_irqrestore(&clockfw_lock, flags);
701
702 return ret;
703}
704EXPORT_SYMBOL(clk_set_rate);
705
706int clk_set_parent(struct clk *clk, struct clk *parent)
707{
708 WARN_ONCE(1, "clk_set_parent() not implemented for OMAP1\n");
709
710 return -EINVAL;
711}
712EXPORT_SYMBOL(clk_set_parent);
713
714struct clk *clk_get_parent(struct clk *clk)
715{
716 return clk->parent;
717}
718EXPORT_SYMBOL(clk_get_parent);
719
720/*
721 * OMAP specific clock functions shared between omap1 and omap2
722 */
723
724int __initdata mpurate;
725
726/*
727 * By default we use the rate set by the bootloader.
728 * You can override this with mpurate= cmdline option.
729 */
730static int __init omap_clk_setup(char *str)
731{
732 get_option(&str, &mpurate);
733
734 if (!mpurate)
735 return 1;
736
737 if (mpurate < 1000)
738 mpurate *= 1000000;
739
740 return 1;
741}
742__setup("mpurate=", omap_clk_setup);
743
744/* Used for clocks that always have same value as the parent clock */
745unsigned long followparent_recalc(struct clk *clk)
746{
747 return clk->parent->rate;
748}
749
750/*
751 * Used for clocks that have the same value as the parent clock,
752 * divided by some factor
753 */
754unsigned long omap_fixed_divisor_recalc(struct clk *clk)
755{
756 WARN_ON(!clk->fixed_div);
757
758 return clk->parent->rate / clk->fixed_div;
759}
760
761void clk_reparent(struct clk *child, struct clk *parent)
762{
763 list_del_init(&child->sibling);
764 if (parent)
765 list_add(&child->sibling, &parent->children);
766 child->parent = parent;
767
768 /* now do the debugfs renaming to reattach the child
769 to the proper parent */
770}
771
772/* Propagate rate to children */
773void propagate_rate(struct clk *tclk)
774{
775 struct clk *clkp;
776
777 list_for_each_entry(clkp, &tclk->children, sibling) {
778 if (clkp->recalc)
779 clkp->rate = clkp->recalc(clkp);
780 propagate_rate(clkp);
781 }
782}
783
784static LIST_HEAD(root_clks);
785
786/**
787 * recalculate_root_clocks - recalculate and propagate all root clocks
788 *
789 * Recalculates all root clocks (clocks with no parent), which if the
790 * clock's .recalc is set correctly, should also propagate their rates.
791 * Called at init.
792 */
793void recalculate_root_clocks(void)
794{
795 struct clk *clkp;
796
797 list_for_each_entry(clkp, &root_clks, sibling) {
798 if (clkp->recalc)
799 clkp->rate = clkp->recalc(clkp);
800 propagate_rate(clkp);
801 }
802}
803
804/**
805 * clk_preinit - initialize any fields in the struct clk before clk init
806 * @clk: struct clk * to initialize
807 *
808 * Initialize any struct clk fields needed before normal clk initialization
809 * can run. No return value.
810 */
811void clk_preinit(struct clk *clk)
812{
813 INIT_LIST_HEAD(&clk->children);
814}
815
816int clk_register(struct clk *clk)
817{
818 if (clk == NULL || IS_ERR(clk))
819 return -EINVAL;
820
821 /*
822 * trap out already registered clocks
823 */
824 if (clk->node.next || clk->node.prev)
825 return 0;
826
827 mutex_lock(&clocks_mutex);
828 if (clk->parent)
829 list_add(&clk->sibling, &clk->parent->children);
830 else
831 list_add(&clk->sibling, &root_clks);
832
833 list_add(&clk->node, &clocks);
834 if (clk->init)
835 clk->init(clk);
836 mutex_unlock(&clocks_mutex);
837
838 return 0;
839}
840EXPORT_SYMBOL(clk_register);
841
842void clk_unregister(struct clk *clk)
843{
844 if (clk == NULL || IS_ERR(clk))
845 return;
846
847 mutex_lock(&clocks_mutex);
848 list_del(&clk->sibling);
849 list_del(&clk->node);
850 mutex_unlock(&clocks_mutex);
851}
852EXPORT_SYMBOL(clk_unregister);
853
854void clk_enable_init_clocks(void)
855{
856 struct clk *clkp;
857
858 list_for_each_entry(clkp, &clocks, node)
859 if (clkp->flags & ENABLE_ON_INIT)
860 clk_enable(clkp);
861}
862
863/**
864 * omap_clk_get_by_name - locate OMAP struct clk by its name
865 * @name: name of the struct clk to locate
866 *
867 * Locate an OMAP struct clk by its name. Assumes that struct clk
868 * names are unique. Returns NULL if not found or a pointer to the
869 * struct clk if found.
870 */
871struct clk *omap_clk_get_by_name(const char *name)
872{
873 struct clk *c;
874 struct clk *ret = NULL;
875
876 mutex_lock(&clocks_mutex);
877
878 list_for_each_entry(c, &clocks, node) {
879 if (!strcmp(c->name, name)) {
880 ret = c;
881 break;
882 }
883 }
884
885 mutex_unlock(&clocks_mutex);
886
887 return ret;
888}
889
890int omap_clk_enable_autoidle_all(void)
891{
892 struct clk *c;
893 unsigned long flags;
894
895 spin_lock_irqsave(&clockfw_lock, flags);
896
897 list_for_each_entry(c, &clocks, node)
898 if (c->ops->allow_idle)
899 c->ops->allow_idle(c);
900
901 spin_unlock_irqrestore(&clockfw_lock, flags);
902
903 return 0;
904}
905
906int omap_clk_disable_autoidle_all(void)
907{
908 struct clk *c;
909 unsigned long flags;
910
911 spin_lock_irqsave(&clockfw_lock, flags);
912
913 list_for_each_entry(c, &clocks, node)
914 if (c->ops->deny_idle)
915 c->ops->deny_idle(c);
916
917 spin_unlock_irqrestore(&clockfw_lock, flags);
918
919 return 0;
920}
921
922/*
923 * Low level helpers
924 */
925static int clkll_enable_null(struct clk *clk)
926{
927 return 0;
928}
929
930static void clkll_disable_null(struct clk *clk)
931{
932}
933
934const struct clkops clkops_null = {
935 .enable = clkll_enable_null,
936 .disable = clkll_disable_null,
937};
938
939/*
940 * Dummy clock
941 *
942 * Used for clock aliases that are needed on some OMAPs, but not others
943 */
944struct clk dummy_ck = {
945 .name = "dummy",
946 .ops = &clkops_null,
947};
948
949/*
950 *
951 */
952
953#ifdef CONFIG_OMAP_RESET_CLOCKS
954/*
955 * Disable any unused clocks left on by the bootloader
956 */
957static int __init clk_disable_unused(void)
958{
959 struct clk *ck;
960 unsigned long flags;
961
962 pr_info("clock: disabling unused clocks to save power\n");
963
964 spin_lock_irqsave(&clockfw_lock, flags);
965 list_for_each_entry(ck, &clocks, node) {
966 if (ck->ops == &clkops_null)
967 continue;
968
969 if (ck->usecount > 0 || !ck->enable_reg)
970 continue;
971
972 omap1_clk_disable_unused(ck);
973 }
974 spin_unlock_irqrestore(&clockfw_lock, flags);
975
976 return 0;
977}
978late_initcall(clk_disable_unused);
979late_initcall(omap_clk_enable_autoidle_all);
980#endif
981
982#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
983/*
984 * debugfs support to trace clock tree hierarchy and attributes
985 */
986
987#include <linux/debugfs.h>
988#include <linux/seq_file.h>
989
990static struct dentry *clk_debugfs_root;
991
992static int clk_dbg_show_summary(struct seq_file *s, void *unused)
993{
994 struct clk *c;
995 struct clk *pa;
996
997 mutex_lock(&clocks_mutex);
998 seq_printf(s, "%-30s %-30s %-10s %s\n",
999 "clock-name", "parent-name", "rate", "use-count");
1000
1001 list_for_each_entry(c, &clocks, node) {
1002 pa = c->parent;
1003 seq_printf(s, "%-30s %-30s %-10lu %d\n",
1004 c->name, pa ? pa->name : "none", c->rate,
1005 c->usecount);
1006 }
1007 mutex_unlock(&clocks_mutex);
1008
1009 return 0;
1010}
1011
1012static int clk_dbg_open(struct inode *inode, struct file *file)
1013{
1014 return single_open(file, clk_dbg_show_summary, inode->i_private);
1015}
1016
1017static const struct file_operations debug_clock_fops = {
1018 .open = clk_dbg_open,
1019 .read = seq_read,
1020 .llseek = seq_lseek,
1021 .release = single_release,
1022};
1023
1024static int clk_debugfs_register_one(struct clk *c)
1025{
1026 int err;
1027 struct dentry *d;
1028 struct clk *pa = c->parent;
1029
1030 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
1031 if (!d)
1032 return -ENOMEM;
1033 c->dent = d;
1034
1035 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
1036 if (!d) {
1037 err = -ENOMEM;
1038 goto err_out;
1039 }
1040 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
1041 if (!d) {
1042 err = -ENOMEM;
1043 goto err_out;
1044 }
1045 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
1046 if (!d) {
1047 err = -ENOMEM;
1048 goto err_out;
1049 }
1050 return 0;
1051
1052err_out:
1053 debugfs_remove_recursive(c->dent);
1054 return err;
1055}
1056
1057static int clk_debugfs_register(struct clk *c)
1058{
1059 int err;
1060 struct clk *pa = c->parent;
1061
1062 if (pa && !pa->dent) {
1063 err = clk_debugfs_register(pa);
1064 if (err)
1065 return err;
1066 }
1067
1068 if (!c->dent) {
1069 err = clk_debugfs_register_one(c);
1070 if (err)
1071 return err;
1072 }
1073 return 0;
1074}
1075
1076static int __init clk_debugfs_init(void)
1077{
1078 struct clk *c;
1079 struct dentry *d;
1080 int err;
1081
1082 d = debugfs_create_dir("clock", NULL);
1083 if (!d)
1084 return -ENOMEM;
1085 clk_debugfs_root = d;
1086
1087 list_for_each_entry(c, &clocks, node) {
1088 err = clk_debugfs_register(c);
1089 if (err)
1090 goto err_out;
1091 }
1092
1093 d = debugfs_create_file("summary", S_IRUGO,
1094 d, NULL, &debug_clock_fops);
1095 if (!d)
1096 return -ENOMEM;
1097
1098 return 0;
1099err_out:
1100 debugfs_remove_recursive(clk_debugfs_root);
1101 return err;
1102}
1103late_initcall(clk_debugfs_init);
1104
1105#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..ecd0bb664dad 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)
@@ -90,4 +94,6 @@ extern int ocpi_enable(void);
90static inline int ocpi_enable(void) { return 0; } 94static inline int ocpi_enable(void) { return 0; }
91#endif 95#endif
92 96
97extern u32 omap1_get_reset_sources(void);
98
93#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 99#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index d3fec92c54cb..745031870ce4 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -17,19 +17,23 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19 19
20#include <linux/platform_data/omap-wd-timer.h>
21
20#include <asm/mach/map.h> 22#include <asm/mach/map.h>
21 23
22#include <plat/tc.h> 24#include <mach/tc.h>
23#include <mach/mux.h> 25#include <mach/mux.h>
24#include <plat/dma.h>
25#include <plat/mmc.h>
26 26
27#include <mach/omap7xx.h> 27#include <mach/omap7xx.h>
28#include <mach/camera.h> 28#include <mach/camera.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30 30
31#include "../plat-omap/sram.h"
32
31#include "common.h" 33#include "common.h"
32#include "clock.h" 34#include "clock.h"
35#include "dma.h"
36#include "mmc.h"
33 37
34#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) 38#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
35 39
@@ -175,6 +179,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
175 res[3].name = "tx"; 179 res[3].name = "tx";
176 res[3].flags = IORESOURCE_DMA; 180 res[3].flags = IORESOURCE_DMA;
177 181
182 if (cpu_is_omap7xx())
183 data->slots[0].features = MMC_OMAP7XX;
184 if (cpu_is_omap15xx())
185 data->slots[0].features = MMC_OMAP15XX;
186 if (cpu_is_omap16xx())
187 data->slots[0].features = MMC_OMAP16XX;
188
178 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); 189 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
179 if (ret == 0) 190 if (ret == 0)
180 ret = platform_device_add_data(pdev, data, sizeof(*data)); 191 ret = platform_device_add_data(pdev, data, sizeof(*data));
@@ -439,18 +450,31 @@ static struct resource wdt_resources[] = {
439}; 450};
440 451
441static struct platform_device omap_wdt_device = { 452static struct platform_device omap_wdt_device = {
442 .name = "omap_wdt", 453 .name = "omap_wdt",
443 .id = -1, 454 .id = -1,
444 .num_resources = ARRAY_SIZE(wdt_resources), 455 .num_resources = ARRAY_SIZE(wdt_resources),
445 .resource = wdt_resources, 456 .resource = wdt_resources,
446}; 457};
447 458
448static int __init omap_init_wdt(void) 459static int __init omap_init_wdt(void)
449{ 460{
461 struct omap_wd_timer_platform_data pdata;
462 int ret;
463
450 if (!cpu_is_omap16xx()) 464 if (!cpu_is_omap16xx())
451 return -ENODEV; 465 return -ENODEV;
452 466
453 return platform_device_register(&omap_wdt_device); 467 pdata.read_reset_sources = omap1_get_reset_sources;
468
469 ret = platform_device_register(&omap_wdt_device);
470 if (!ret) {
471 ret = platform_device_add_data(&omap_wdt_device, &pdata,
472 sizeof(pdata));
473 if (ret)
474 platform_device_del(&omap_wdt_device);
475 }
476
477 return ret;
454} 478}
455subsys_initcall(omap_init_wdt); 479subsys_initcall(omap_init_wdt);
456#endif 480#endif
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..d940fac9a9ed 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -27,11 +27,12 @@
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
34#include "iomap.h" 34#include "iomap.h"
35#include "common.h"
35 36
36static void fpga_mask_irq(struct irq_data *d) 37static void fpga_mask_irq(struct irq_data *d)
37{ 38{
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/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 2b36a281dc84..5c1a26c9f490 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
13 13
14#include <linux/serial_reg.h> 14#include <linux/serial_reg.h>
15 15
16#include <plat/serial.h> 16#include "serial.h"
17 17
18 .pushsection .data 18 .pushsection .data
19omap_uart_phys: .word 0x0 19omap_uart_phys: .word 0x0
diff --git a/arch/arm/mach-omap1/include/mach/hardware.h b/arch/arm/mach-omap1/include/mach/hardware.h
index 84248d250adb..dc3237bd72d2 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
@@ -72,7 +72,7 @@ static inline u32 omap_cs3_phys(void)
72 72
73#endif /* ifndef __ASSEMBLER__ */ 73#endif /* ifndef __ASSEMBLER__ */
74 74
75#include <plat/serial.h> 75#include <mach/serial.h>
76 76
77/* 77/*
78 * --------------------------------------------------------------------------- 78 * ---------------------------------------------------------------------------
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/mach-omap1/include/mach/serial.h b/arch/arm/mach-omap1/include/mach/serial.h
new file mode 100644
index 000000000000..2ce6a2db470b
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/serial.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2009 Texas Instruments
3 * Added OMAP4 support- Santosh Shilimkar <santosh.shilimkar@ti.com>
4 *
5 * This program is distributed in the hope that it will be useful,
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 * GNU General Public License for more details.
9 */
10
11#ifndef __ASM_ARCH_SERIAL_H
12#define __ASM_ARCH_SERIAL_H
13
14#include <linux/init.h>
15
16/*
17 * Memory entry used for the DEBUG_LL UART configuration, relative to
18 * start of RAM. See also uncompress.h and debug-macro.S.
19 *
20 * Note that using a memory location for storing the UART configuration
21 * has at least two limitations:
22 *
23 * 1. Kernel uncompress code cannot overlap OMAP_UART_INFO as the
24 * uncompress code could then partially overwrite itself
25 * 2. We assume printascii is called at least once before paging_init,
26 * and addruart has a chance to read OMAP_UART_INFO
27 */
28#define OMAP_UART_INFO_OFS 0x3ffc
29
30/* OMAP1 serial ports */
31#define OMAP1_UART1_BASE 0xfffb0000
32#define OMAP1_UART2_BASE 0xfffb0800
33#define OMAP1_UART3_BASE 0xfffb9800
34
35#define OMAP_PORT_SHIFT 2
36#define OMAP7XX_PORT_SHIFT 0
37
38#define OMAP1510_BASE_BAUD (12000000/16)
39#define OMAP16XX_BASE_BAUD (48000000/16)
40
41/*
42 * DEBUG_LL port encoding stored into the UART1 scratchpad register by
43 * decomp_setup in uncompress.h
44 */
45#define OMAP1UART1 11
46#define OMAP1UART2 12
47#define OMAP1UART3 13
48
49#ifndef __ASSEMBLER__
50extern void omap_serial_init(void);
51#endif
52
53#endif
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/include/mach/uncompress.h b/arch/arm/mach-omap1/include/mach/uncompress.h
index 0ff22dc075c7..ad6fbe7d83f2 100644
--- a/arch/arm/mach-omap1/include/mach/uncompress.h
+++ b/arch/arm/mach-omap1/include/mach/uncompress.h
@@ -1,5 +1,122 @@
1/* 1/*
2 * arch/arm/mach-omap1/include/mach/uncompress.h 2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
3 */ 18 */
4 19
5#include <plat/uncompress.h> 20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include "serial.h"
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP7XX(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
81
82#define DEBUG_LL_OMAP1(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
85
86static inline void arch_decomp_setup(void)
87{
88 int port = 0;
89
90 /*
91 * Initialize the port based on the machine ID from the bootloader.
92 * Note that we're using macros here instead of switch statement
93 * as machine_is functions are optimized out for the boards that
94 * are not selected.
95 */
96 do {
97 /* omap7xx/8xx based boards using UART1 with shift 0 */
98 DEBUG_LL_OMAP7XX(1, herald);
99 DEBUG_LL_OMAP7XX(1, omap_perseus2);
100
101 /* omap15xx/16xx based boards using UART1 */
102 DEBUG_LL_OMAP1(1, ams_delta);
103 DEBUG_LL_OMAP1(1, nokia770);
104 DEBUG_LL_OMAP1(1, omap_h2);
105 DEBUG_LL_OMAP1(1, omap_h3);
106 DEBUG_LL_OMAP1(1, omap_innovator);
107 DEBUG_LL_OMAP1(1, omap_osk);
108 DEBUG_LL_OMAP1(1, omap_palmte);
109 DEBUG_LL_OMAP1(1, omap_palmz71);
110
111 /* omap15xx/16xx based boards using UART2 */
112 DEBUG_LL_OMAP1(2, omap_palmtt);
113
114 /* omap15xx/16xx based boards using UART3 */
115 DEBUG_LL_OMAP1(3, sx1);
116 } while (0);
117}
118
119/*
120 * nothing to do
121 */
122#define arch_decomp_wdog()
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..3f2d39672393 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -19,8 +19,7 @@
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> 22#include "soc.h"
23#include <plat/omap-pm.h>
24 23
25#ifdef CONFIG_PM_RUNTIME 24#ifdef CONFIG_PM_RUNTIME
26static int omap1_pm_runtime_suspend(struct device *dev) 25static int omap1_pm_runtime_suspend(struct device *dev)
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index b17709103866..5eebd7e889d0 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -4,12 +4,24 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/io.h> 5#include <linux/io.h>
6 6
7#include <plat/prcm.h>
8
9#include <mach/hardware.h> 7#include <mach/hardware.h>
10 8
9#include "iomap.h"
11#include "common.h" 10#include "common.h"
12 11
12/* ARM_SYSST bit shifts related to SoC reset sources */
13#define ARM_SYSST_POR_SHIFT 5
14#define ARM_SYSST_EXT_RST_SHIFT 4
15#define ARM_SYSST_ARM_WDRST_SHIFT 2
16#define ARM_SYSST_GLOB_SWRST_SHIFT 1
17
18/* Standardized reset source bits (across all OMAP SoCs) */
19#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
20#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
21#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
22#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
23
24
13void omap1_restart(char mode, const char *cmd) 25void omap1_restart(char mode, const char *cmd)
14{ 26{
15 /* 27 /*
@@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd)
23 35
24 omap_writew(1, ARM_RSTCT1); 36 omap_writew(1, ARM_RSTCT1);
25} 37}
38
39/**
40 * omap1_get_reset_sources - return the source of the SoC's last reset
41 *
42 * Returns bits that represent the last reset source for the SoC. The
43 * format is standardized across OMAPs for use by the OMAP watchdog.
44 */
45u32 omap1_get_reset_sources(void)
46{
47 u32 ret = 0;
48 u16 rs;
49
50 rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
51
52 if (rs & (1 << ARM_SYSST_POR_SHIFT))
53 ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
54 if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
55 ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
56 if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
57 ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
58 if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
59 ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
60
61 return ret;
62}
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/Kconfig b/arch/arm/mach-omap2/Kconfig
index d669e227e00c..c81bc508e7a3 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -34,6 +34,7 @@ config ARCH_OMAP2
34 select CPU_V6 34 select CPU_V6
35 select MULTI_IRQ_HANDLER 35 select MULTI_IRQ_HANDLER
36 select SOC_HAS_OMAP2_SDRC 36 select SOC_HAS_OMAP2_SDRC
37 select COMMON_CLK
37 38
38config ARCH_OMAP3 39config ARCH_OMAP3
39 bool "TI OMAP3" 40 bool "TI OMAP3"
@@ -47,6 +48,7 @@ config ARCH_OMAP3
47 select PM_OPP if PM 48 select PM_OPP if PM
48 select PM_RUNTIME if CPU_IDLE 49 select PM_RUNTIME if CPU_IDLE
49 select SOC_HAS_OMAP2_SDRC 50 select SOC_HAS_OMAP2_SDRC
51 select COMMON_CLK
50 select USB_ARCH_HAS_EHCI if USB_SUPPORT 52 select USB_ARCH_HAS_EHCI if USB_SUPPORT
51 53
52config ARCH_OMAP4 54config ARCH_OMAP4
@@ -68,6 +70,7 @@ config ARCH_OMAP4
68 select PM_OPP if PM 70 select PM_OPP if PM
69 select PM_RUNTIME if CPU_IDLE 71 select PM_RUNTIME if CPU_IDLE
70 select USB_ARCH_HAS_EHCI if USB_SUPPORT 72 select USB_ARCH_HAS_EHCI if USB_SUPPORT
73 select COMMON_CLK
71 74
72config SOC_OMAP5 75config SOC_OMAP5
73 bool "TI OMAP5" 76 bool "TI OMAP5"
@@ -77,6 +80,7 @@ config SOC_OMAP5
77 select CPU_V7 80 select CPU_V7
78 select HAVE_SMP 81 select HAVE_SMP
79 select SOC_HAS_REALTIME_COUNTER 82 select SOC_HAS_REALTIME_COUNTER
83 select COMMON_CLK
80 84
81comment "OMAP Core Type" 85comment "OMAP Core Type"
82 depends on ARCH_OMAP2 86 depends on ARCH_OMAP2
@@ -111,6 +115,7 @@ config SOC_AM33XX
111 select ARM_CPU_SUSPEND if PM 115 select ARM_CPU_SUSPEND if PM
112 select CPU_V7 116 select CPU_V7
113 select MULTI_IRQ_HANDLER 117 select MULTI_IRQ_HANDLER
118 select COMMON_CLK
114 119
115config OMAP_PACKAGE_ZAF 120config OMAP_PACKAGE_ZAF
116 bool 121 bool
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e488c9..798f35b8ea59 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,30 +4,37 @@
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 8 omap_device.o
9# INTCPS IP block support - XXX should be moved to drivers/ 9
10obj-$(CONFIG_ARCH_OMAP2) += irq.o 10omap-2-3-common = irq.o
11obj-$(CONFIG_ARCH_OMAP3) += irq.o 11hwmod-common = omap_hwmod.o \
12obj-$(CONFIG_SOC_AM33XX) += irq.o 12 omap_hwmod_common_data.o
13 13clock-common = clock.o clock_common_data.o \
14# Secure monitor API support 14 clkt_dpll.o clkt_clksel.o
15obj-$(CONFIG_ARCH_OMAP3) += omap-smc.o omap-secure.o 15secure-common = omap-smc.o omap-secure.o
16obj-$(CONFIG_ARCH_OMAP4) += omap-smc.o omap-secure.o 16
17obj-$(CONFIG_SOC_OMAP5) += omap-smc.o omap-secure.o 17obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
18obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
19obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
20obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
21obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
18 22
19ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 23ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
20obj-y += mcbsp.o 24obj-y += mcbsp.o
21endif 25endif
22 26
23obj-$(CONFIG_TWL4030_CORE) += omap_twl.o 27obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
28obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
24 29
25# SMP support ONLY available for OMAP4 30# SMP support ONLY available for OMAP4
26 31
27obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 32obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
28obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 33obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
29obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o 34omap-4-5-common = omap4-common.o omap-wakeupgen.o \
30obj-$(CONFIG_SOC_OMAP5) += omap4-common.o omap-wakeupgen.o 35 sleep44xx.o
36obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common)
37obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common)
31 38
32plus_sec := $(call as-instr,.arch_extension sec,+sec) 39plus_sec := $(call as-instr,.arch_extension sec,+sec)
33AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) 40AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -43,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6
43AFLAGS_sram243x.o :=-Wa,-march=armv6 50AFLAGS_sram243x.o :=-Wa,-march=armv6
44AFLAGS_sram34xx.o :=-Wa,-march=armv7-a 51AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
45 52
53# Restart code (OMAP4/5 currently in omap4-common.c)
54obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
55obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
56obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
57
46# Pin multiplexing 58# Pin multiplexing
47obj-$(CONFIG_SOC_OMAP2420) += mux2420.o 59obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
48obj-$(CONFIG_SOC_OMAP2430) += mux2430.o 60obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
@@ -52,7 +64,6 @@ obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
52# SMS/SDRC 64# SMS/SDRC
53obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o 65obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
54# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o 66# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
55obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
56 67
57# OPP table initialization 68# OPP table initialization
58ifeq ($(CONFIG_PM_OPP),y) 69ifeq ($(CONFIG_PM_OPP),y)
@@ -63,15 +74,15 @@ endif
63 74
64# Power Management 75# Power Management
65ifeq ($(CONFIG_PM),y) 76ifeq ($(CONFIG_PM),y)
66obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o sleep24xx.o 77obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
78obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
67obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 79obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
68obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o 80obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o
69obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o 81obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o
70obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o
71obj-$(CONFIG_PM_DEBUG) += pm-debug.o 82obj-$(CONFIG_PM_DEBUG) += pm-debug.o
72 83
73obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o 84obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
74obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o 85obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
75 86
76AFLAGS_sleep24xx.o :=-Wa,-march=armv6 87AFLAGS_sleep24xx.o :=-Wa,-march=armv6
77AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) 88AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -83,76 +94,82 @@ endif
83endif 94endif
84 95
85ifeq ($(CONFIG_CPU_IDLE),y) 96ifeq ($(CONFIG_CPU_IDLE),y)
86obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o 97obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
87obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o 98obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
88endif 99endif
89 100
90# PRCM 101# PRCM
91obj-y += prcm.o prm_common.o 102obj-y += prm_common.o cm_common.o
92obj-$(CONFIG_ARCH_OMAP2) += cm2xxx_3xxx.o prm2xxx_3xxx.o 103obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
93obj-$(CONFIG_ARCH_OMAP3) += cm2xxx_3xxx.o prm2xxx_3xxx.o 104obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
94obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 105obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
95obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o 106obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
96omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 107omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
97 prcm_mpu44xx.o prminst44xx.o \ 108 prcm_mpu44xx.o prminst44xx.o \
98 vc44xx_data.o vp44xx_data.o \ 109 vc44xx_data.o vp44xx_data.o
99 prm44xx.o
100obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 110obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
101obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) 111obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
102 112
103# OMAP voltage domains 113# OMAP voltage domains
104obj-y += voltage.o vc.o vp.o 114voltagedomain-common := voltage.o vc.o vp.o
115obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common)
105obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o 116obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o
117obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common)
106obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o 118obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
119obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
107obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o 120obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
108obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o 121obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
122obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
123obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
109 124
110# OMAP powerdomain framework 125# OMAP powerdomain framework
111obj-y += powerdomain.o powerdomain-common.o 126powerdomain-common += powerdomain.o powerdomain-common.o
127obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common)
112obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o 128obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o
113obj-$(CONFIG_ARCH_OMAP2) += powerdomain2xxx_3xxx.o
114obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o 129obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o
115obj-$(CONFIG_ARCH_OMAP3) += powerdomain2xxx_3xxx.o 130obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common)
116obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o 131obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o
117obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o 132obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o
118obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o 133obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
119obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o 134obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
120obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o 135obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
121obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o 136obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
122obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o 137obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
123 138
124# PRCM clockdomain control 139# PRCM clockdomain control
125obj-y += clockdomain.o 140clockdomain-common += clockdomain.o
126obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o 141obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common)
127obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o 142obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o
128obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o 143obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
129obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o 144obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
130obj-$(CONFIG_ARCH_OMAP3) += clockdomain2xxx_3xxx.o 145obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common)
131obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o 146obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o
132obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o 147obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o
133obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o 148obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
134obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o 149obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
135obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o 150obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
136obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o 151obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
137obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o 152obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
138 153
139# Clock framework 154# Clock framework
140obj-y += clock.o clock_common_data.o \ 155obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
141 clkt_dpll.o clkt_clksel.o 156obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o
142obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o 157obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
143obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o clkt2xxx_sys.o
144obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o 158obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
145obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o 159obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o
146obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o 160obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
147obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o 161obj-$(CONFIG_SOC_OMAP2420) += cclock2420_data.o
148obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o 162obj-$(CONFIG_SOC_OMAP2430) += clock2430.o cclock2430_data.o
149obj-$(CONFIG_ARCH_OMAP3) += clock3xxx.o 163obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
150obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o 164obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
151obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o clkt_iclk.o 165obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
152obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o 166obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o
153obj-$(CONFIG_ARCH_OMAP4) += clock44xx_data.o 167obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
168obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) cclock44xx_data.o
154obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o 169obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
155obj-$(CONFIG_SOC_AM33XX) += dpll3xxx.o clock33xx_data.o 170obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
171obj-$(CONFIG_SOC_AM33XX) += cclock33xx_data.o
172obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
156obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o 173obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
157 174
158# OMAP2 clock rate set data (old "OPP" data) 175# OMAP2 clock rate set data (old "OPP" data)
@@ -160,7 +177,6 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
160obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o 177obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o
161 178
162# hwmod data 179# hwmod data
163obj-y += omap_hwmod_common_data.o
164obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o 180obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o
165obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o 181obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o
166obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o 182obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o
@@ -206,10 +222,10 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
206obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o 222obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
207obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 223obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
208obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 224obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
209obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o 225obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
210obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 226obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
211obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 227obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
212obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 228obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
213obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o 229obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
214obj-$(CONFIG_MACH_OVERO) += board-overo.o 230obj-$(CONFIG_MACH_OVERO) += board-overo.o
215obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o 231obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
diff --git a/arch/arm/mach-omap2/am33xx.h b/arch/arm/mach-omap2/am33xx.h
index 06c19bb7bca6..43296c1af9ee 100644
--- a/arch/arm/mach-omap2/am33xx.h
+++ b/arch/arm/mach-omap2/am33xx.h
@@ -21,5 +21,6 @@
21#define AM33XX_SCM_BASE 0x44E10000 21#define AM33XX_SCM_BASE 0x44E10000
22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE 22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE
23#define AM33XX_PRCM_BASE 0x44E00000 23#define AM33XX_PRCM_BASE 0x44E00000
24#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC)
24 25
25#endif /* __ASM_ARCH_AM33XX_H */ 26#endif /* __ASM_ARCH_AM33XX_H */
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..acb0a524ff7b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -34,8 +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>
39#include "gpmc-smc91x.h" 38#include "gpmc-smc91x.h"
40 39
41#include <video/omapdss.h> 40#include <video/omapdss.h>
@@ -287,5 +286,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
287 .init_machine = omap_2430sdp_init, 286 .init_machine = omap_2430sdp_init,
288 .init_late = omap2430_init_late, 287 .init_late = omap2430_init_late,
289 .timer = &omap2_timer, 288 .timer = &omap2_timer,
290 .restart = omap_prcm_restart, 289 .restart = omap2xxx_restart,
291MACHINE_END 290MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 96cd3693e1ae..6601754f9512 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -30,15 +30,15 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <plat/usb.h>
34#include "common.h" 33#include "common.h"
35#include <plat/dma.h> 34#include <plat-omap/dma-omap.h>
36#include <plat/gpmc.h>
37#include <video/omapdss.h> 35#include <video/omapdss.h>
38#include <video/omap-panel-tfp410.h> 36#include <video/omap-panel-tfp410.h>
39 37
38#include "gpmc.h"
40#include "gpmc-smc91x.h" 39#include "gpmc-smc91x.h"
41 40
41#include "soc.h"
42#include "board-flash.h" 42#include "board-flash.h"
43#include "mux.h" 43#include "mux.h"
44#include "sdram-qimonda-hyb18m512160af-6.h" 44#include "sdram-qimonda-hyb18m512160af-6.h"
@@ -597,5 +597,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
597 .init_machine = omap_3430sdp_init, 597 .init_machine = omap_3430sdp_init,
598 .init_late = omap3430_init_late, 598 .init_late = omap3430_init_late,
599 .timer = &omap3_timer, 599 .timer = &omap3_timer,
600 .restart = omap_prcm_restart, 600 .restart = omap3xxx_restart,
601MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index fc224ad86747..050aaa771254 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -18,9 +18,8 @@
18 18
19#include "common.h" 19#include "common.h"
20#include "gpmc-smc91x.h" 20#include "gpmc-smc91x.h"
21#include <plat/usb.h>
22 21
23#include <mach/board-zoom.h> 22#include "board-zoom.h"
24 23
25#include "board-flash.h" 24#include "board-flash.h"
26#include "mux.h" 25#include "mux.h"
@@ -213,5 +212,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
213 .init_machine = omap_sdp_init, 212 .init_machine = omap_sdp_init,
214 .init_late = omap3630_init_late, 213 .init_late = omap3630_init_late,
215 .timer = &omap3_timer, 214 .timer = &omap3_timer,
216 .restart = omap_prcm_restart, 215 .restart = omap3xxx_restart,
217MACHINE_END 216MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 3669c120c7e8..85dfa71e0dc6 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -27,6 +27,7 @@
27#include <linux/leds.h> 27#include <linux/leds.h>
28#include <linux/leds_pwm.h> 28#include <linux/leds_pwm.h>
29#include <linux/platform_data/omap4-keypad.h> 29#include <linux/platform_data/omap4-keypad.h>
30#include <linux/usb/musb.h>
30 31
31#include <asm/hardware/gic.h> 32#include <asm/hardware/gic.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -34,8 +35,6 @@
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35 36
36#include "common.h" 37#include "common.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"
@@ -881,5 +881,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
881 .init_machine = omap_4430sdp_init, 881 .init_machine = omap_4430sdp_init,
882 .init_late = omap4430_init_late, 882 .init_late = omap4430_init_late,
883 .timer = &omap4_timer, 883 .timer = &omap4_timer,
884 .restart = omap_prcm_restart, 884 .restart = omap44xx_restart,
885MACHINE_END 885MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 318feadb1d6e..51b96a1206d1 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -26,7 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include "common.h" 28#include "common.h"
29#include <plat/usb.h>
30 29
31#include "am35xx-emac.h" 30#include "am35xx-emac.h"
32#include "mux.h" 31#include "mux.h"
@@ -94,5 +93,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
94 .init_machine = am3517_crane_init, 93 .init_machine = am3517_crane_init,
95 .init_late = am35xx_init_late, 94 .init_late = am35xx_init_late,
96 .timer = &omap3_timer, 95 .timer = &omap3_timer,
97 .restart = omap_prcm_restart, 96 .restart = omap3xxx_restart,
98MACHINE_END 97MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index e16289755f2e..4be58fd071f6 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -25,6 +25,7 @@
25#include <linux/can/platform/ti_hecc.h> 25#include <linux/can/platform/ti_hecc.h>
26#include <linux/davinci_emac.h> 26#include <linux/davinci_emac.h>
27#include <linux/mmc/host.h> 27#include <linux/mmc/host.h>
28#include <linux/usb/musb.h>
28#include <linux/platform_data/gpio-omap.h> 29#include <linux/platform_data/gpio-omap.h>
29 30
30#include "am35xx.h" 31#include "am35xx.h"
@@ -33,7 +34,6 @@
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include "common.h" 36#include "common.h"
36#include <plat/usb.h>
37#include <video/omapdss.h> 37#include <video/omapdss.h>
38#include <video/omap-panel-generic-dpi.h> 38#include <video/omap-panel-generic-dpi.h>
39#include <video/omap-panel-tfp410.h> 39#include <video/omap-panel-tfp410.h>
@@ -393,5 +393,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
393 .init_machine = am3517_evm_init, 393 .init_machine = am3517_evm_init,
394 .init_late = am35xx_init_late, 394 .init_late = am35xx_init_late,
395 .timer = &omap3_timer, 395 .timer = &omap3_timer,
396 .restart = omap_prcm_restart, 396 .restart = omap3xxx_restart,
397MACHINE_END 397MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index cea3abace815..5d0a61f54165 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>
@@ -338,5 +338,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
338 .init_machine = omap_apollon_init, 338 .init_machine = omap_apollon_init,
339 .init_late = omap2420_init_late, 339 .init_late = omap2420_init_late,
340 .timer = &omap2_timer, 340 .timer = &omap2_timer,
341 .restart = omap_prcm_restart, 341 .restart = omap2xxx_restart,
342MACHINE_END 342MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 376d26eb601c..488f86fd0e72 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -38,10 +38,7 @@
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include "common.h"
42#include <linux/platform_data/mtd-nand-omap2.h> 41#include <linux/platform_data/mtd-nand-omap2.h>
43#include <plat/gpmc.h>
44#include <plat/usb.h>
45#include <video/omapdss.h> 42#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 43#include <video/omap-panel-generic-dpi.h>
47#include <video/omap-panel-tfp410.h> 44#include <video/omap-panel-tfp410.h>
@@ -49,10 +46,13 @@
49 46
50#include <mach/hardware.h> 47#include <mach/hardware.h>
51 48
49#include "common.h"
52#include "mux.h" 50#include "mux.h"
53#include "sdram-micron-mt46h32m32lf-6.h" 51#include "sdram-micron-mt46h32m32lf-6.h"
54#include "hsmmc.h" 52#include "hsmmc.h"
55#include "common-board-devices.h" 53#include "common-board-devices.h"
54#include "gpmc.h"
55#include "gpmc-nand.h"
56 56
57#define CM_T35_GPIO_PENDOWN 57 57#define CM_T35_GPIO_PENDOWN 57
58#define SB_T35_USB_HUB_RESET_GPIO 167 58#define SB_T35_USB_HUB_RESET_GPIO 167
@@ -181,7 +181,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
181 181
182static void __init cm_t35_init_nand(void) 182static void __init cm_t35_init_nand(void)
183{ 183{
184 if (gpmc_nand_init(&cm_t35_nand_data) < 0) 184 if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
185 pr_err("CM-T35: Unable to register NAND device\n"); 185 pr_err("CM-T35: Unable to register NAND device\n");
186} 186}
187#else 187#else
@@ -753,18 +753,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
753 .init_machine = cm_t35_init, 753 .init_machine = cm_t35_init,
754 .init_late = omap35xx_init_late, 754 .init_late = omap35xx_init_late,
755 .timer = &omap3_timer, 755 .timer = &omap3_timer,
756 .restart = omap_prcm_restart, 756 .restart = omap3xxx_restart,
757MACHINE_END 757MACHINE_END
758 758
759MACHINE_START(CM_T3730, "Compulab CM-T3730") 759MACHINE_START(CM_T3730, "Compulab CM-T3730")
760 .atag_offset = 0x100, 760 .atag_offset = 0x100,
761 .reserve = omap_reserve, 761 .reserve = omap_reserve,
762 .map_io = omap3_map_io, 762 .map_io = omap3_map_io,
763 .init_early = omap3630_init_early, 763 .init_early = omap3630_init_early,
764 .init_irq = omap3_init_irq, 764 .init_irq = omap3_init_irq,
765 .handle_irq = omap3_intc_handle_irq, 765 .handle_irq = omap3_intc_handle_irq,
766 .init_machine = cm_t3730_init, 766 .init_machine = cm_t3730_init,
767 .init_late = omap3630_init_late, 767 .init_late = omap3630_init_late,
768 .timer = &omap3_timer, 768 .timer = &omap3_timer,
769 .restart = omap_prcm_restart, 769 .restart = omap3xxx_restart,
770MACHINE_END 770MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 59c0a45f75b0..699caec8f9e2 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -39,9 +39,8 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h>
43#include <linux/platform_data/mtd-nand-omap2.h> 42#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/gpmc.h> 43#include "gpmc.h"
45 44
46#include "am35xx.h" 45#include "am35xx.h"
47 46
@@ -49,6 +48,7 @@
49#include "control.h" 48#include "control.h"
50#include "common-board-devices.h" 49#include "common-board-devices.h"
51#include "am35xx-emac.h" 50#include "am35xx-emac.h"
51#include "gpmc-nand.h"
52 52
53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
54static struct gpio_led cm_t3517_leds[] = { 54static struct gpio_led cm_t3517_leds[] = {
@@ -240,7 +240,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
240 240
241static void __init cm_t3517_init_nand(void) 241static void __init cm_t3517_init_nand(void)
242{ 242{
243 if (gpmc_nand_init(&cm_t3517_nand_data) < 0) 243 if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
244 pr_err("CM-T3517: NAND initialization failed\n"); 244 pr_err("CM-T3517: NAND initialization failed\n");
245} 245}
246#else 246#else
@@ -298,5 +298,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
298 .init_machine = cm_t3517_init, 298 .init_machine = cm_t3517_init,
299 .init_late = am35xx_init_late, 299 .init_late = am35xx_init_late,
300 .timer = &omap3_timer, 300 .timer = &omap3_timer,
301 .restart = omap_prcm_restart, 301 .restart = omap3xxx_restart,
302MACHINE_END 302MACHINE_END
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 1fd161e934c7..7667eb749522 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -39,9 +39,8 @@
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>
45#include <video/omapdss.h> 44#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 45#include <video/omap-panel-generic-dpi.h>
47#include <video/omap-panel-tfp410.h> 46#include <video/omap-panel-tfp410.h>
@@ -55,8 +54,11 @@
55#include "sdram-micron-mt46h32m32lf-6.h" 54#include "sdram-micron-mt46h32m32lf-6.h"
56#include "mux.h" 55#include "mux.h"
57#include "hsmmc.h" 56#include "hsmmc.h"
57#include "board-flash.h"
58#include "common-board-devices.h" 58#include "common-board-devices.h"
59 59
60#define NAND_CS 0
61
60#define OMAP_DM9000_GPIO_IRQ 25 62#define OMAP_DM9000_GPIO_IRQ 25
61#define OMAP3_DEVKIT_TS_GPIO 27 63#define OMAP3_DEVKIT_TS_GPIO 27
62 64
@@ -621,8 +623,9 @@ static void __init devkit8000_init(void)
621 623
622 usb_musb_init(NULL); 624 usb_musb_init(NULL);
623 usbhs_init(&usbhs_bdata); 625 usbhs_init(&usbhs_bdata);
624 omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions, 626 board_nand_init(devkit8000_nand_partitions,
625 ARRAY_SIZE(devkit8000_nand_partitions)); 627 ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
628 NAND_BUSWIDTH_16, NULL);
626 omap_twl4030_audio_init("omap3beagle"); 629 omap_twl4030_audio_init("omap3beagle");
627 630
628 /* Ensure SDRC pins are mux'd for self-refresh */ 631 /* Ensure SDRC pins are mux'd for self-refresh */
@@ -640,5 +643,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
640 .init_machine = devkit8000_init, 643 .init_machine = devkit8000_init,
641 .init_late = omap35xx_init_late, 644 .init_late = omap35xx_init_late,
642 .timer = &omap3_secure_timer, 645 .timer = &omap3_secure_timer,
643 .restart = omap_prcm_restart, 646 .restart = omap3xxx_restart,
644MACHINE_END 647MACHINE_END
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-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdfb1cf9..475e14f07216 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -57,7 +57,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
57 .init_machine = omap_generic_init, 57 .init_machine = omap_generic_init,
58 .timer = &omap2_timer, 58 .timer = &omap2_timer,
59 .dt_compat = omap242x_boards_compat, 59 .dt_compat = omap242x_boards_compat,
60 .restart = omap_prcm_restart, 60 .restart = omap2xxx_restart,
61MACHINE_END 61MACHINE_END
62#endif 62#endif
63 63
@@ -76,7 +76,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
76 .init_machine = omap_generic_init, 76 .init_machine = omap_generic_init,
77 .timer = &omap2_timer, 77 .timer = &omap2_timer,
78 .dt_compat = omap243x_boards_compat, 78 .dt_compat = omap243x_boards_compat,
79 .restart = omap_prcm_restart, 79 .restart = omap2xxx_restart,
80MACHINE_END 80MACHINE_END
81#endif 81#endif
82 82
@@ -95,7 +95,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
95 .init_machine = omap_generic_init, 95 .init_machine = omap_generic_init,
96 .timer = &omap3_timer, 96 .timer = &omap3_timer,
97 .dt_compat = omap3_boards_compat, 97 .dt_compat = omap3_boards_compat,
98 .restart = omap_prcm_restart, 98 .restart = omap3xxx_restart,
99MACHINE_END 99MACHINE_END
100#endif 100#endif
101 101
@@ -134,7 +134,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
134 .init_late = omap4430_init_late, 134 .init_late = omap4430_init_late,
135 .timer = &omap4_timer, 135 .timer = &omap4_timer,
136 .dt_compat = omap4_boards_compat, 136 .dt_compat = omap4_boards_compat,
137 .restart = omap_prcm_restart, 137 .restart = omap44xx_restart,
138MACHINE_END 138MACHINE_END
139#endif 139#endif
140 140
@@ -154,6 +154,6 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
154 .init_machine = omap_generic_init, 154 .init_machine = omap_generic_init,
155 .timer = &omap5_timer, 155 .timer = &omap5_timer,
156 .dt_compat = omap5_boards_compat, 156 .dt_compat = omap5_boards_compat,
157 .restart = omap_prcm_restart, 157 .restart = omap44xx_restart,
158MACHINE_END 158MACHINE_END
159#endif 159#endif
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 8d04bf851af4..3c1e458f68a1 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -26,14 +26,13 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/input/matrix_keypad.h> 28#include <linux/input/matrix_keypad.h>
29#include <linux/mfd/menelaus.h>
29 30
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33 34
34#include <plat/menelaus.h> 35#include <plat-omap/dma-omap.h>
35#include <plat/dma.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
@@ -386,5 +386,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
386 .init_machine = omap_h4_init, 386 .init_machine = omap_h4_init,
387 .init_late = omap2420_init_late, 387 .init_late = omap2420_init_late,
388 .timer = &omap2_timer, 388 .timer = &omap2_timer,
389 .restart = omap_prcm_restart, 389 .restart = omap2xxx_restart,
390MACHINE_END 390MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 48d5e41dfbfa..cea5d5292628 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -29,20 +29,19 @@
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include "common.h"
33#include <plat/gpmc.h>
34#include <plat/usb.h>
35
36#include <video/omapdss.h> 32#include <video/omapdss.h>
37#include <video/omap-panel-tfp410.h> 33#include <video/omap-panel-tfp410.h>
38#include <linux/platform_data/mtd-onenand-omap2.h> 34#include <linux/platform_data/mtd-onenand-omap2.h>
39 35
36#include "common.h"
37#include "gpmc.h"
40#include "mux.h" 38#include "mux.h"
41#include "hsmmc.h" 39#include "hsmmc.h"
42#include "sdram-numonyx-m65kxxxxam.h" 40#include "sdram-numonyx-m65kxxxxam.h"
43#include "common-board-devices.h" 41#include "common-board-devices.h"
44#include "board-flash.h" 42#include "board-flash.h"
45#include "control.h" 43#include "control.h"
44#include "gpmc-onenand.h"
46 45
47#define IGEP2_SMSC911X_CS 5 46#define IGEP2_SMSC911X_CS 5
48#define IGEP2_SMSC911X_GPIO 176 47#define IGEP2_SMSC911X_GPIO 176
@@ -175,7 +174,7 @@ static void __init igep_flash_init(void)
175 pr_info("IGEP: initializing NAND memory device\n"); 174 pr_info("IGEP: initializing NAND memory device\n");
176 board_nand_init(igep_flash_partitions, 175 board_nand_init(igep_flash_partitions,
177 ARRAY_SIZE(igep_flash_partitions), 176 ARRAY_SIZE(igep_flash_partitions),
178 0, NAND_BUSWIDTH_16); 177 0, NAND_BUSWIDTH_16, nand_default_timings);
179 } else if (mux == IGEP_SYSBOOT_ONENAND) { 178 } else if (mux == IGEP_SYSBOOT_ONENAND) {
180 pr_info("IGEP: initializing OneNAND memory device\n"); 179 pr_info("IGEP: initializing OneNAND memory device\n");
181 board_onenand_init(igep_flash_partitions, 180 board_onenand_init(igep_flash_partitions,
@@ -652,7 +651,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
652 .init_machine = igep_init, 651 .init_machine = igep_init,
653 .init_late = omap35xx_init_late, 652 .init_late = omap35xx_init_late,
654 .timer = &omap3_timer, 653 .timer = &omap3_timer,
655 .restart = omap_prcm_restart, 654 .restart = omap3xxx_restart,
656MACHINE_END 655MACHINE_END
657 656
658MACHINE_START(IGEP0030, "IGEP OMAP3 module") 657MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@@ -665,5 +664,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
665 .init_machine = igep_init, 664 .init_machine = igep_init,
666 .init_late = omap35xx_init_late, 665 .init_late = omap35xx_init_late,
667 .timer = &omap3_timer, 666 .timer = &omap3_timer,
668 .restart = omap_prcm_restart, 667 .restart = omap3xxx_restart,
669MACHINE_END 668MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index ee8c3cfb95b3..0869f4f3d3e1 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -35,9 +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 "board-zoom.h"
39#include <mach/board-zoom.h> 39#include "gpmc.h"
40#include <plat/usb.h>
41#include "gpmc-smsc911x.h" 40#include "gpmc-smsc911x.h"
42 41
43#include <video/omapdss.h> 42#include <video/omapdss.h>
@@ -420,8 +419,8 @@ static void __init omap_ldp_init(void)
420 omap_serial_init(); 419 omap_serial_init();
421 omap_sdrc_init(NULL, NULL); 420 omap_sdrc_init(NULL, NULL);
422 usb_musb_init(NULL); 421 usb_musb_init(NULL);
423 board_nand_init(ldp_nand_partitions, 422 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
424 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 423 ZOOM_NAND_CS, 0, nand_default_timings);
425 424
426 omap_hsmmc_init(mmc); 425 omap_hsmmc_init(mmc);
427 ldp_display_init(); 426 ldp_display_init();
@@ -437,5 +436,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
437 .init_machine = omap_ldp_init, 436 .init_machine = omap_ldp_init,
438 .init_late = omap3430_init_late, 437 .init_late = omap3430_init_late,
439 .timer = &omap3_timer, 438 .timer = &omap3_timer,
440 .restart = omap_prcm_restart, 439 .restart = omap3xxx_restart,
441MACHINE_END 440MACHINE_END
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index d95f727ca39a..a4e167c55c1d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -22,16 +22,17 @@
22#include <linux/usb/musb.h> 22#include <linux/usb/musb.h>
23#include <linux/platform_data/spi-omap2-mcspi.h> 23#include <linux/platform_data/spi-omap2-mcspi.h>
24#include <linux/platform_data/mtd-onenand-omap2.h> 24#include <linux/platform_data/mtd-onenand-omap2.h>
25#include <linux/mfd/menelaus.h>
25#include <sound/tlv320aic3x.h> 26#include <sound/tlv320aic3x.h>
26 27
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29 30
30#include "common.h" 31#include "common.h"
31#include <plat/menelaus.h> 32#include "mmc.h"
32#include <plat/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
@@ -689,7 +690,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
689 .init_machine = n8x0_init_machine, 690 .init_machine = n8x0_init_machine,
690 .init_late = omap2420_init_late, 691 .init_late = omap2420_init_late,
691 .timer = &omap2_timer, 692 .timer = &omap2_timer,
692 .restart = omap_prcm_restart, 693 .restart = omap2xxx_restart,
693MACHINE_END 694MACHINE_END
694 695
695MACHINE_START(NOKIA_N810, "Nokia N810") 696MACHINE_START(NOKIA_N810, "Nokia N810")
@@ -702,7 +703,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
702 .init_machine = n8x0_init_machine, 703 .init_machine = n8x0_init_machine,
703 .init_late = omap2420_init_late, 704 .init_late = omap2420_init_late,
704 .timer = &omap2_timer, 705 .timer = &omap2_timer,
705 .restart = omap_prcm_restart, 706 .restart = omap2xxx_restart,
706MACHINE_END 707MACHINE_END
707 708
708MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 709MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@@ -715,5 +716,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
715 .init_machine = n8x0_init_machine, 716 .init_machine = n8x0_init_machine,
716 .init_late = omap2420_init_late, 717 .init_late = omap2420_init_late,
717 .timer = &omap2_timer, 718 .timer = &omap2_timer,
718 .restart = omap_prcm_restart, 719 .restart = omap2xxx_restart,
719MACHINE_END 720MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index d41ab98890ff..22c483d5dfa8 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -39,19 +39,22 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include "common.h"
43#include <video/omapdss.h> 42#include <video/omapdss.h>
44#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
45#include <plat/gpmc.h>
46#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
47#include <plat/usb.h>
48#include <plat/omap_device.h>
49 45
46#include "common.h"
47#include "omap_device.h"
48#include "gpmc.h"
49#include "soc.h"
50#include "mux.h" 50#include "mux.h"
51#include "hsmmc.h" 51#include "hsmmc.h"
52#include "pm.h" 52#include "pm.h"
53#include "board-flash.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54 55
56#define NAND_CS 0
57
55/* 58/*
56 * OMAP3 Beagle revision 59 * OMAP3 Beagle revision
57 * Run time detection of Beagle revision is done by reading GPIO. 60 * Run time detection of Beagle revision is done by reading GPIO.
@@ -518,8 +521,9 @@ static void __init omap3_beagle_init(void)
518 521
519 usb_musb_init(NULL); 522 usb_musb_init(NULL);
520 usbhs_init(&usbhs_bdata); 523 usbhs_init(&usbhs_bdata);
521 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 524 board_nand_init(omap3beagle_nand_partitions,
522 ARRAY_SIZE(omap3beagle_nand_partitions)); 525 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
526 NAND_BUSWIDTH_16, NULL);
523 omap_twl4030_audio_init("omap3beagle"); 527 omap_twl4030_audio_init("omap3beagle");
524 528
525 /* Ensure msecure is mux'd to be able to set the RTC. */ 529 /* Ensure msecure is mux'd to be able to set the RTC. */
@@ -541,5 +545,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
541 .init_machine = omap3_beagle_init, 545 .init_machine = omap3_beagle_init,
542 .init_late = omap3_init_late, 546 .init_late = omap3_init_late,
543 .timer = &omap3_secure_timer, 547 .timer = &omap3_secure_timer,
544 .restart = omap_prcm_restart, 548 .restart = omap3xxx_restart,
545MACHINE_END 549MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b9b776b6c954..54647d6286b4 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -32,6 +32,7 @@
32#include <linux/spi/ads7846.h> 32#include <linux/spi/ads7846.h>
33#include <linux/i2c/twl.h> 33#include <linux/i2c/twl.h>
34#include <linux/usb/otg.h> 34#include <linux/usb/otg.h>
35#include <linux/usb/musb.h>
35#include <linux/usb/nop-usb-xceiv.h> 36#include <linux/usb/nop-usb-xceiv.h>
36#include <linux/smsc911x.h> 37#include <linux/smsc911x.h>
37 38
@@ -45,17 +46,20 @@
45#include <asm/mach/arch.h> 46#include <asm/mach/arch.h>
46#include <asm/mach/map.h> 47#include <asm/mach/map.h>
47 48
48#include <plat/usb.h>
49#include <linux/platform_data/mtd-nand-omap2.h> 49#include <linux/platform_data/mtd-nand-omap2.h>
50#include "common.h" 50#include "common.h"
51#include <linux/platform_data/spi-omap2-mcspi.h> 51#include <linux/platform_data/spi-omap2-mcspi.h>
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();
@@ -752,5 +757,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
752 .init_machine = omap3_evm_init, 757 .init_machine = omap3_evm_init,
753 .init_late = omap35xx_init_late, 758 .init_late = omap35xx_init_late,
754 .timer = &omap3_timer, 759 .timer = &omap3_timer,
755 .restart = omap_prcm_restart, 760 .restart = omap3xxx_restart,
756MACHINE_END 761MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7bd8253b5d1d..2a065ba6eb58 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -34,16 +34,13 @@
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>
41
42#include "common.h" 37#include "common.h"
43#include "mux.h" 38#include "mux.h"
44#include "hsmmc.h" 39#include "hsmmc.h"
45#include "control.h" 40#include "control.h"
46#include "common-board-devices.h" 41#include "common-board-devices.h"
42#include "gpmc.h"
43#include "gpmc-smsc911x.h"
47 44
48#define OMAP3LOGIC_SMSC911X_CS 1 45#define OMAP3LOGIC_SMSC911X_CS 1
49 46
@@ -235,7 +232,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
235 .init_machine = omap3logic_init, 232 .init_machine = omap3logic_init,
236 .init_late = omap35xx_init_late, 233 .init_late = omap35xx_init_late,
237 .timer = &omap3_timer, 234 .timer = &omap3_timer,
238 .restart = omap_prcm_restart, 235 .restart = omap3xxx_restart,
239MACHINE_END 236MACHINE_END
240 237
241MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") 238MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@@ -248,5 +245,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
248 .init_machine = omap3logic_init, 245 .init_machine = omap3logic_init,
249 .init_late = omap35xx_init_late, 246 .init_late = omap35xx_init_late,
250 .timer = &omap3_timer, 247 .timer = &omap3_timer,
251 .restart = omap_prcm_restart, 248 .restart = omap3xxx_restart,
252MACHINE_END 249MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 00a1f4ae6e44..a53a6683c1b8 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -42,7 +42,6 @@
42#include <asm/mach/map.h> 42#include <asm/mach/map.h>
43 43
44#include "common.h" 44#include "common.h"
45#include <plat/usb.h>
46#include <video/omapdss.h> 45#include <video/omapdss.h>
47#include <linux/platform_data/mtd-nand-omap2.h> 46#include <linux/platform_data/mtd-nand-omap2.h>
48 47
@@ -50,6 +49,7 @@
50#include "sdram-micron-mt46h32m32lf-6.h" 49#include "sdram-micron-mt46h32m32lf-6.h"
51#include "hsmmc.h" 50#include "hsmmc.h"
52#include "common-board-devices.h" 51#include "common-board-devices.h"
52#include "gpmc-nand.h"
53 53
54#define PANDORA_WIFI_IRQ_GPIO 21 54#define PANDORA_WIFI_IRQ_GPIO 21
55#define PANDORA_WIFI_NRESET_GPIO 23 55#define PANDORA_WIFI_NRESET_GPIO 23
@@ -602,7 +602,7 @@ static void __init omap3pandora_init(void)
602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
603 usbhs_init(&usbhs_bdata); 603 usbhs_init(&usbhs_bdata);
604 usb_musb_init(NULL); 604 usb_musb_init(NULL);
605 gpmc_nand_init(&pandora_nand_data); 605 gpmc_nand_init(&pandora_nand_data, NULL);
606 606
607 /* Ensure SDRC pins are mux'd for self-refresh */ 607 /* Ensure SDRC pins are mux'd for self-refresh */
608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -619,5 +619,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
619 .init_machine = omap3pandora_init, 619 .init_machine = omap3pandora_init,
620 .init_late = omap35xx_init_late, 620 .init_late = omap35xx_init_late,
621 .timer = &omap3_timer, 621 .timer = &omap3_timer,
622 .restart = omap_prcm_restart, 622 .restart = omap3xxx_restart,
623MACHINE_END 623MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 731235eb319e..d8638b3b4f94 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -40,9 +40,8 @@
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>
46#include <video/omapdss.h> 45#include <video/omapdss.h>
47#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-generic-dpi.h>
48#include <video/omap-panel-tfp410.h> 47#include <video/omap-panel-tfp410.h>
@@ -428,5 +427,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
428 .init_machine = omap3_stalker_init, 427 .init_machine = omap3_stalker_init,
429 .init_late = omap35xx_init_late, 428 .init_late = omap35xx_init_late,
430 .timer = &omap3_secure_timer, 429 .timer = &omap3_secure_timer,
431 .restart = omap_prcm_restart, 430 .restart = omap3xxx_restart,
432MACHINE_END 431MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 944ffc436577..263cb9cfbf37 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -44,12 +44,12 @@
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>
50 49
51#include "mux.h" 50#include "mux.h"
52#include "hsmmc.h" 51#include "hsmmc.h"
52#include "board-flash.h"
53#include "common-board-devices.h" 53#include "common-board-devices.h"
54 54
55#include <asm/setup.h> 55#include <asm/setup.h>
@@ -59,6 +59,8 @@
59#define TB_BL_PWM_TIMER 9 59#define TB_BL_PWM_TIMER 9
60#define TB_KILL_POWER_GPIO 168 60#define TB_KILL_POWER_GPIO 168
61 61
62#define NAND_CS 0
63
62static unsigned long touchbook_revision; 64static unsigned long touchbook_revision;
63 65
64static struct mtd_partition omap3touchbook_nand_partitions[] = { 66static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +367,9 @@ static void __init omap3_touchbook_init(void)
365 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 367 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
366 usb_musb_init(NULL); 368 usb_musb_init(NULL);
367 usbhs_init(&usbhs_bdata); 369 usbhs_init(&usbhs_bdata);
368 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, 370 board_nand_init(omap3touchbook_nand_partitions,
369 ARRAY_SIZE(omap3touchbook_nand_partitions)); 371 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
372 NAND_BUSWIDTH_16, NULL);
370 373
371 /* Ensure SDRC pins are mux'd for self-refresh */ 374 /* Ensure SDRC pins are mux'd for self-refresh */
372 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 375 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -384,5 +387,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
384 .init_machine = omap3_touchbook_init, 387 .init_machine = omap3_touchbook_init,
385 .init_late = omap3430_init_late, 388 .init_late = omap3430_init_late,
386 .timer = &omap3_secure_timer, 389 .timer = &omap3_secure_timer,
387 .restart = omap_prcm_restart, 390 .restart = omap3xxx_restart,
388MACHINE_END 391MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index bfcd397e233c..12a3a24d5bb5 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -29,6 +29,7 @@
29#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/ti_wilink_st.h> 31#include <linux/ti_wilink_st.h>
32#include <linux/usb/musb.h>
32#include <linux/wl12xx.h> 33#include <linux/wl12xx.h>
33#include <linux/platform_data/omap-abe-twl6040.h> 34#include <linux/platform_data/omap-abe-twl6040.h>
34 35
@@ -38,12 +39,11 @@
38#include <asm/mach/map.h> 39#include <asm/mach/map.h>
39#include <video/omapdss.h> 40#include <video/omapdss.h>
40 41
41#include "common.h"
42#include <plat/usb.h>
43#include <plat/mmc.h>
44#include <video/omap-panel-tfp410.h> 42#include <video/omap-panel-tfp410.h>
45 43
44#include "common.h"
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"
@@ -524,5 +524,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
524 .init_machine = omap4_panda_init, 524 .init_machine = omap4_panda_init,
525 .init_late = omap4430_init_late, 525 .init_late = omap4430_init_late,
526 .timer = &omap4_timer, 526 .timer = &omap4_timer,
527 .restart = omap_prcm_restart, 527 .restart = omap44xx_restart,
528MACHINE_END 528MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b700685762b5..140b73094aff 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>
53#include <plat/usb.h>
54 52
53#include "common.h"
55#include "mux.h" 54#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 55#include "sdram-micron-mt46h32m32lf-6.h"
56#include "gpmc.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();
@@ -550,5 +553,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
550 .init_machine = overo_init, 553 .init_machine = overo_init,
551 .init_late = omap35xx_init_late, 554 .init_late = omap35xx_init_late,
552 .timer = &omap3_timer, 555 .timer = &omap3_timer,
553 .restart = omap_prcm_restart, 556 .restart = omap3xxx_restart,
554MACHINE_END 557MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 45997bfbcbd2..cbcb1b2dc31f 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -22,17 +22,14 @@
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>
28#include <plat/gpmc.h>
29#include "common.h" 25#include "common.h"
30#include <plat/serial.h>
31
32#include "mux.h" 26#include "mux.h"
27#include "gpmc.h"
28#include "mmc.h"
33#include "hsmmc.h" 29#include "hsmmc.h"
34#include "sdram-nokia.h" 30#include "sdram-nokia.h"
35#include "common-board-devices.h" 31#include "common-board-devices.h"
32#include "gpmc-onenand.h"
36 33
37static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 34static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
38 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 35 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
@@ -151,7 +148,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
151 .init_machine = rm680_init, 148 .init_machine = rm680_init,
152 .init_late = omap3630_init_late, 149 .init_late = omap3630_init_late,
153 .timer = &omap3_timer, 150 .timer = &omap3_timer,
154 .restart = omap_prcm_restart, 151 .restart = omap3xxx_restart,
155MACHINE_END 152MACHINE_END
156 153
157MACHINE_START(NOKIA_RM696, "Nokia RM-696 board") 154MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
@@ -164,5 +161,5 @@ MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
164 .init_machine = rm680_init, 161 .init_machine = rm680_init,
165 .init_late = omap3630_init_late, 162 .init_late = omap3630_init_late,
166 .timer = &omap3_timer, 163 .timer = &omap3_timer,
167 .restart = omap_prcm_restart, 164 .restart = omap3xxx_restart,
168MACHINE_END 165MACHINE_END
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..bf8f74b0ce3e 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -17,18 +17,18 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/usb/musb.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 21#include <linux/platform_data/spi-omap2-mcspi.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25 26
26#include "common.h" 27#include <plat-omap/dma-omap.h>
27#include <plat/dma.h>
28#include <plat/gpmc.h>
29#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
@@ -127,5 +127,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
127 .init_machine = rx51_init, 127 .init_machine = rx51_init,
128 .init_late = omap3430_init_late, 128 .init_late = omap3430_init_late,
129 .timer = &omap3_timer, 129 .timer = &omap3_timer,
130 .restart = omap_prcm_restart, 130 .restart = omap3xxx_restart,
131MACHINE_END 131MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index c4f8833b4c3c..1a3e056d63a7 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -14,13 +14,14 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/usb/musb.h>
17 19
18#include <asm/mach-types.h> 20#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 22#include <asm/mach/map.h>
21 23
22#include "common.h" 24#include "common.h"
23#include <plat/usb.h>
24 25
25static struct omap_musb_board_data musb_board_data = { 26static struct omap_musb_board_data musb_board_data = {
26 .set_phy_power = ti81xx_musb_phy_power, 27 .set_phy_power = ti81xx_musb_phy_power,
@@ -45,7 +46,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
45 .timer = &omap3_timer, 46 .timer = &omap3_timer,
46 .init_machine = ti81xx_evm_init, 47 .init_machine = ti81xx_evm_init,
47 .init_late = ti81xx_init_late, 48 .init_late = ti81xx_init_late,
48 .restart = omap_prcm_restart, 49 .restart = omap44xx_restart,
49MACHINE_END 50MACHINE_END
50 51
51MACHINE_START(TI8148EVM, "ti8148evm") 52MACHINE_START(TI8148EVM, "ti8148evm")
@@ -57,5 +58,5 @@ MACHINE_START(TI8148EVM, "ti8148evm")
57 .timer = &omap3_timer, 58 .timer = &omap3_timer,
58 .init_machine = ti81xx_evm_init, 59 .init_machine = ti81xx_evm_init,
59 .init_late = ti81xx_init_late, 60 .init_late = ti81xx_init_late,
60 .restart = omap_prcm_restart, 61 .restart = omap44xx_restart,
61MACHINE_END 62MACHINE_END
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..26e07addc9d7 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -26,9 +26,8 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include "common.h" 28#include "common.h"
29#include <plat/usb.h>
30 29
31#include <mach/board-zoom.h> 30#include "board-zoom.h"
32 31
33#include "mux.h" 32#include "mux.h"
34#include "hsmmc.h" 33#include "hsmmc.h"
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 4994438e1f46..d7fa31e67238 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -22,9 +22,8 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23 23
24#include "common.h" 24#include "common.h"
25#include <plat/usb.h>
26 25
27#include <mach/board-zoom.h> 26#include "board-zoom.h"
28 27
29#include "board-flash.h" 28#include "board-flash.h"
30#include "mux.h" 29#include "mux.h"
@@ -113,8 +112,9 @@ static void __init omap_zoom_init(void)
113 usbhs_init(&usbhs_bdata); 112 usbhs_init(&usbhs_bdata);
114 } 113 }
115 114
116 board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions), 115 board_nand_init(zoom_nand_partitions,
117 ZOOM_NAND_CS, NAND_BUSWIDTH_16); 116 ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
117 NAND_BUSWIDTH_16, nand_default_timings);
118 zoom_debugboard_init(); 118 zoom_debugboard_init();
119 zoom_peripherals_init(); 119 zoom_peripherals_init();
120 120
@@ -138,7 +138,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
138 .init_machine = omap_zoom_init, 138 .init_machine = omap_zoom_init,
139 .init_late = omap3430_init_late, 139 .init_late = omap3430_init_late,
140 .timer = &omap3_timer, 140 .timer = &omap3_timer,
141 .restart = omap_prcm_restart, 141 .restart = omap3xxx_restart,
142MACHINE_END 142MACHINE_END
143 143
144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board") 144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@@ -151,5 +151,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
151 .init_machine = omap_zoom_init, 151 .init_machine = omap_zoom_init,
152 .init_late = omap3630_init_late, 152 .init_late = omap3630_init_late,
153 .timer = &omap3_timer, 153 .timer = &omap3_timer,
154 .restart = omap_prcm_restart, 154 .restart = omap3xxx_restart,
155MACHINE_END 155MACHINE_END
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/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
new file mode 100644
index 000000000000..7e5febe456d9
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2420_data.c
@@ -0,0 +1,1950 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 * Updated to COMMON clk format by Rajendra Nayak <rnayak@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 version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/clk-private.h>
21#include <linux/list.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx.h"
29#include "prm2xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
55
56DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
57
58DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
59
60static struct clk osc_ck;
61
62static const struct clk_ops osc_ck_ops = {
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static struct clk func_96m_ck;
226
227static const char *func_96m_ck_parent_names[] = {
228 "apll96_ck",
229};
230
231DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
232DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
233
234static struct clk cam_fck;
235
236static const char *cam_fck_parent_names[] = {
237 "func_96m_ck",
238};
239
240static struct clk_hw_omap cam_fck_hw = {
241 .hw = {
242 .clk = &cam_fck,
243 },
244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
245 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
246 .clkdm_name = "core_l3_clkdm",
247};
248
249DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
250
251static struct clk cam_ick;
252
253static struct clk_hw_omap cam_ick_hw = {
254 .hw = {
255 .clk = &cam_ick,
256 },
257 .ops = &clkhwops_iclk,
258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
259 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
260 .clkdm_name = "core_l4_clkdm",
261};
262
263DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
264
265static struct clk des_ick;
266
267static struct clk_hw_omap des_ick_hw = {
268 .hw = {
269 .clk = &des_ick,
270 },
271 .ops = &clkhwops_iclk_wait,
272 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
273 .enable_bit = OMAP24XX_EN_DES_SHIFT,
274 .clkdm_name = "core_l4_clkdm",
275};
276
277DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
278
279static const struct clksel_rate dsp_fck_core_rates[] = {
280 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
281 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
282 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
283 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
284 { .div = 6, .val = 6, .flags = RATE_IN_242X },
285 { .div = 8, .val = 8, .flags = RATE_IN_242X },
286 { .div = 12, .val = 12, .flags = RATE_IN_242X },
287 { .div = 0 }
288};
289
290static const struct clksel dsp_fck_clksel[] = {
291 { .parent = &core_ck, .rates = dsp_fck_core_rates },
292 { .parent = NULL },
293};
294
295static const char *dsp_fck_parent_names[] = {
296 "core_ck",
297};
298
299static const struct clk_ops dsp_fck_ops = {
300 .init = &omap2_init_clk_clkdm,
301 .enable = &omap2_dflt_clk_enable,
302 .disable = &omap2_dflt_clk_disable,
303 .is_enabled = &omap2_dflt_clk_is_enabled,
304 .recalc_rate = &omap2_clksel_recalc,
305 .set_rate = &omap2_clksel_set_rate,
306 .round_rate = &omap2_clksel_round_rate,
307};
308
309DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
311 OMAP24XX_CLKSEL_DSP_MASK,
312 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
313 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
314 dsp_fck_parent_names, dsp_fck_ops);
315
316static const struct clksel dsp_ick_clksel[] = {
317 { .parent = &dsp_fck, .rates = dsp_ick_rates },
318 { .parent = NULL },
319};
320
321static const char *dsp_ick_parent_names[] = {
322 "dsp_fck",
323};
324
325DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
326 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
327 OMAP24XX_CLKSEL_DSP_IF_MASK,
328 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
329 OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
330 dsp_ick_parent_names, dsp_fck_ops);
331
332static const struct clksel_rate dss1_fck_sys_rates[] = {
333 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
334 { .div = 0 }
335};
336
337static const struct clksel_rate dss1_fck_core_rates[] = {
338 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
339 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
340 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
341 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
342 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
343 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
344 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
345 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
346 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
347 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
348 { .div = 0 }
349};
350
351static const struct clksel dss1_fck_clksel[] = {
352 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
353 { .parent = &core_ck, .rates = dss1_fck_core_rates },
354 { .parent = NULL },
355};
356
357static const char *dss1_fck_parent_names[] = {
358 "sys_ck", "core_ck",
359};
360
361static struct clk dss1_fck;
362
363static const struct clk_ops dss1_fck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap2_dflt_clk_enable,
366 .disable = &omap2_dflt_clk_disable,
367 .is_enabled = &omap2_dflt_clk_is_enabled,
368 .recalc_rate = &omap2_clksel_recalc,
369 .get_parent = &omap2_clksel_find_parent_index,
370 .set_parent = &omap2_clksel_set_parent,
371};
372
373DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
374 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
375 OMAP24XX_CLKSEL_DSS1_MASK,
376 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
377 OMAP24XX_EN_DSS1_SHIFT, NULL,
378 dss1_fck_parent_names, dss1_fck_ops);
379
380static const struct clksel_rate dss2_fck_sys_rates[] = {
381 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
382 { .div = 0 }
383};
384
385static const struct clksel_rate dss2_fck_48m_rates[] = {
386 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
387 { .div = 0 }
388};
389
390static const struct clksel_rate func_48m_apll96_rates[] = {
391 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
392 { .div = 0 }
393};
394
395static const struct clksel_rate func_48m_alt_rates[] = {
396 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
397 { .div = 0 }
398};
399
400static const struct clksel func_48m_clksel[] = {
401 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
402 { .parent = &alt_ck, .rates = func_48m_alt_rates },
403 { .parent = NULL },
404};
405
406static const char *func_48m_ck_parent_names[] = {
407 "apll96_ck", "alt_ck",
408};
409
410static struct clk func_48m_ck;
411
412static const struct clk_ops func_48m_ck_ops = {
413 .init = &omap2_init_clk_clkdm,
414 .recalc_rate = &omap2_clksel_recalc,
415 .set_rate = &omap2_clksel_set_rate,
416 .round_rate = &omap2_clksel_round_rate,
417 .get_parent = &omap2_clksel_find_parent_index,
418 .set_parent = &omap2_clksel_set_parent,
419};
420
421static struct clk_hw_omap func_48m_ck_hw = {
422 .hw = {
423 .clk = &func_48m_ck,
424 },
425 .clksel = func_48m_clksel,
426 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
427 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
428 .clkdm_name = "wkup_clkdm",
429};
430
431DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
432
433static const struct clksel dss2_fck_clksel[] = {
434 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
435 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
436 { .parent = NULL },
437};
438
439static const char *dss2_fck_parent_names[] = {
440 "sys_ck", "func_48m_ck",
441};
442
443DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
444 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
445 OMAP24XX_CLKSEL_DSS2_MASK,
446 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
447 OMAP24XX_EN_DSS2_SHIFT, NULL,
448 dss2_fck_parent_names, dss1_fck_ops);
449
450static const char *func_54m_ck_parent_names[] = {
451 "apll54_ck", "alt_ck",
452};
453
454DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
455 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
456 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
457 0x0, NULL);
458
459static struct clk dss_54m_fck;
460
461static const char *dss_54m_fck_parent_names[] = {
462 "func_54m_ck",
463};
464
465static struct clk_hw_omap dss_54m_fck_hw = {
466 .hw = {
467 .clk = &dss_54m_fck,
468 },
469 .ops = &clkhwops_wait,
470 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
471 .enable_bit = OMAP24XX_EN_TV_SHIFT,
472 .clkdm_name = "dss_clkdm",
473};
474
475DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
476
477static struct clk dss_ick;
478
479static struct clk_hw_omap dss_ick_hw = {
480 .hw = {
481 .clk = &dss_ick,
482 },
483 .ops = &clkhwops_iclk,
484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
485 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
486 .clkdm_name = "dss_clkdm",
487};
488
489DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
490
491static struct clk eac_fck;
492
493static struct clk_hw_omap eac_fck_hw = {
494 .hw = {
495 .clk = &eac_fck,
496 },
497 .ops = &clkhwops_wait,
498 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
499 .enable_bit = OMAP2420_EN_EAC_SHIFT,
500 .clkdm_name = "core_l4_clkdm",
501};
502
503DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
504
505static struct clk eac_ick;
506
507static struct clk_hw_omap eac_ick_hw = {
508 .hw = {
509 .clk = &eac_ick,
510 },
511 .ops = &clkhwops_iclk_wait,
512 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
513 .enable_bit = OMAP2420_EN_EAC_SHIFT,
514 .clkdm_name = "core_l4_clkdm",
515};
516
517DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
518
519static struct clk emul_ck;
520
521static struct clk_hw_omap emul_ck_hw = {
522 .hw = {
523 .clk = &emul_ck,
524 },
525 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
526 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
527 .clkdm_name = "wkup_clkdm",
528};
529
530DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
531
532DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
533
534static struct clk fac_fck;
535
536static const char *fac_fck_parent_names[] = {
537 "func_12m_ck",
538};
539
540static struct clk_hw_omap fac_fck_hw = {
541 .hw = {
542 .clk = &fac_fck,
543 },
544 .ops = &clkhwops_wait,
545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
547 .clkdm_name = "core_l4_clkdm",
548};
549
550DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
551
552static struct clk fac_ick;
553
554static struct clk_hw_omap fac_ick_hw = {
555 .hw = {
556 .clk = &fac_ick,
557 },
558 .ops = &clkhwops_iclk_wait,
559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
560 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
561 .clkdm_name = "core_l4_clkdm",
562};
563
564DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
565
566static const struct clksel gfx_fck_clksel[] = {
567 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
568 { .parent = NULL },
569};
570
571static const char *gfx_2d_fck_parent_names[] = {
572 "core_l3_ck",
573};
574
575DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
576 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
577 OMAP_CLKSEL_GFX_MASK,
578 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
579 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
580 gfx_2d_fck_parent_names, dsp_fck_ops);
581
582DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
583 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
584 OMAP_CLKSEL_GFX_MASK,
585 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
586 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
587 gfx_2d_fck_parent_names, dsp_fck_ops);
588
589static struct clk gfx_ick;
590
591static const char *gfx_ick_parent_names[] = {
592 "core_l3_ck",
593};
594
595static struct clk_hw_omap gfx_ick_hw = {
596 .hw = {
597 .clk = &gfx_ick,
598 },
599 .ops = &clkhwops_wait,
600 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
601 .enable_bit = OMAP_EN_GFX_SHIFT,
602 .clkdm_name = "gfx_clkdm",
603};
604
605DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
606
607static struct clk gpios_fck;
608
609static const char *gpios_fck_parent_names[] = {
610 "func_32k_ck",
611};
612
613static struct clk_hw_omap gpios_fck_hw = {
614 .hw = {
615 .clk = &gpios_fck,
616 },
617 .ops = &clkhwops_wait,
618 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
619 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
620 .clkdm_name = "wkup_clkdm",
621};
622
623DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
624
625static struct clk wu_l4_ick;
626
627DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
628DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
629
630static struct clk gpios_ick;
631
632static const char *gpios_ick_parent_names[] = {
633 "wu_l4_ick",
634};
635
636static struct clk_hw_omap gpios_ick_hw = {
637 .hw = {
638 .clk = &gpios_ick,
639 },
640 .ops = &clkhwops_iclk_wait,
641 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
642 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
643 .clkdm_name = "wkup_clkdm",
644};
645
646DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
647
648static struct clk gpmc_fck;
649
650static struct clk_hw_omap gpmc_fck_hw = {
651 .hw = {
652 .clk = &gpmc_fck,
653 },
654 .ops = &clkhwops_iclk,
655 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
656 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
657 .flags = ENABLE_ON_INIT,
658 .clkdm_name = "core_l3_clkdm",
659};
660
661DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
662
663static const struct clksel_rate gpt_alt_rates[] = {
664 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
665 { .div = 0 }
666};
667
668static const struct clksel omap24xx_gpt_clksel[] = {
669 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
670 { .parent = &sys_ck, .rates = gpt_sys_rates },
671 { .parent = &alt_ck, .rates = gpt_alt_rates },
672 { .parent = NULL },
673};
674
675static const char *gpt10_fck_parent_names[] = {
676 "func_32k_ck", "sys_ck", "alt_ck",
677};
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT10_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt10_ick;
687
688static struct clk_hw_omap gpt10_ick_hw = {
689 .hw = {
690 .clk = &gpt10_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT11_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt11_ick;
708
709static struct clk_hw_omap gpt11_ick_hw = {
710 .hw = {
711 .clk = &gpt11_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
720
721DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
722 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
723 OMAP24XX_CLKSEL_GPT12_MASK,
724 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
725 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
726 gpt10_fck_parent_names, dss1_fck_ops);
727
728static struct clk gpt12_ick;
729
730static struct clk_hw_omap gpt12_ick_hw = {
731 .hw = {
732 .clk = &gpt12_ick,
733 },
734 .ops = &clkhwops_iclk_wait,
735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
736 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
737 .clkdm_name = "core_l4_clkdm",
738};
739
740DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
741
742static const struct clk_ops gpt1_fck_ops = {
743 .init = &omap2_init_clk_clkdm,
744 .enable = &omap2_dflt_clk_enable,
745 .disable = &omap2_dflt_clk_disable,
746 .is_enabled = &omap2_dflt_clk_is_enabled,
747 .recalc_rate = &omap2_clksel_recalc,
748 .set_rate = &omap2_clksel_set_rate,
749 .round_rate = &omap2_clksel_round_rate,
750 .get_parent = &omap2_clksel_find_parent_index,
751 .set_parent = &omap2_clksel_set_parent,
752};
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
756 OMAP24XX_CLKSEL_GPT1_MASK,
757 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
758 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, gpt1_fck_ops);
760
761static struct clk gpt1_ick;
762
763static struct clk_hw_omap gpt1_ick_hw = {
764 .hw = {
765 .clk = &gpt1_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
769 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
770 .clkdm_name = "wkup_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT2_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt2_ick;
783
784static struct clk_hw_omap gpt2_ick_hw = {
785 .hw = {
786 .clk = &gpt2_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT3_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt3_ick;
804
805static struct clk_hw_omap gpt3_ick_hw = {
806 .hw = {
807 .clk = &gpt3_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT4_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt4_ick;
825
826static struct clk_hw_omap gpt4_ick_hw = {
827 .hw = {
828 .clk = &gpt4_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT5_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt5_ick;
846
847static struct clk_hw_omap gpt5_ick_hw = {
848 .hw = {
849 .clk = &gpt5_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT6_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt6_ick;
867
868static struct clk_hw_omap gpt6_ick_hw = {
869 .hw = {
870 .clk = &gpt6_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
879
880DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
881 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
882 OMAP24XX_CLKSEL_GPT7_MASK,
883 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
884 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
885 gpt10_fck_parent_names, dss1_fck_ops);
886
887static struct clk gpt7_ick;
888
889static struct clk_hw_omap gpt7_ick_hw = {
890 .hw = {
891 .clk = &gpt7_ick,
892 },
893 .ops = &clkhwops_iclk_wait,
894 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
895 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
896 .clkdm_name = "core_l4_clkdm",
897};
898
899DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
900
901DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
902 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
903 OMAP24XX_CLKSEL_GPT8_MASK,
904 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
905 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
906 gpt10_fck_parent_names, dss1_fck_ops);
907
908static struct clk gpt8_ick;
909
910static struct clk_hw_omap gpt8_ick_hw = {
911 .hw = {
912 .clk = &gpt8_ick,
913 },
914 .ops = &clkhwops_iclk_wait,
915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
916 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
917 .clkdm_name = "core_l4_clkdm",
918};
919
920DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
921
922DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
923 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
924 OMAP24XX_CLKSEL_GPT9_MASK,
925 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
926 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
927 gpt10_fck_parent_names, dss1_fck_ops);
928
929static struct clk gpt9_ick;
930
931static struct clk_hw_omap gpt9_ick_hw = {
932 .hw = {
933 .clk = &gpt9_ick,
934 },
935 .ops = &clkhwops_iclk_wait,
936 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
937 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
938 .clkdm_name = "core_l4_clkdm",
939};
940
941DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
942
943static struct clk hdq_fck;
944
945static struct clk_hw_omap hdq_fck_hw = {
946 .hw = {
947 .clk = &hdq_fck,
948 },
949 .ops = &clkhwops_wait,
950 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
951 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
952 .clkdm_name = "core_l4_clkdm",
953};
954
955DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
956
957static struct clk hdq_ick;
958
959static struct clk_hw_omap hdq_ick_hw = {
960 .hw = {
961 .clk = &hdq_ick,
962 },
963 .ops = &clkhwops_iclk_wait,
964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
965 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
966 .clkdm_name = "core_l4_clkdm",
967};
968
969DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
970
971static struct clk i2c1_fck;
972
973static struct clk_hw_omap i2c1_fck_hw = {
974 .hw = {
975 .clk = &i2c1_fck,
976 },
977 .ops = &clkhwops_wait,
978 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
979 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
980 .clkdm_name = "core_l4_clkdm",
981};
982
983DEFINE_STRUCT_CLK(i2c1_fck, fac_fck_parent_names, aes_ick_ops);
984
985static struct clk i2c1_ick;
986
987static struct clk_hw_omap i2c1_ick_hw = {
988 .hw = {
989 .clk = &i2c1_ick,
990 },
991 .ops = &clkhwops_iclk_wait,
992 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
993 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
994 .clkdm_name = "core_l4_clkdm",
995};
996
997DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
998
999static struct clk i2c2_fck;
1000
1001static struct clk_hw_omap i2c2_fck_hw = {
1002 .hw = {
1003 .clk = &i2c2_fck,
1004 },
1005 .ops = &clkhwops_wait,
1006 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1007 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1008 .clkdm_name = "core_l4_clkdm",
1009};
1010
1011DEFINE_STRUCT_CLK(i2c2_fck, fac_fck_parent_names, aes_ick_ops);
1012
1013static struct clk i2c2_ick;
1014
1015static struct clk_hw_omap i2c2_ick_hw = {
1016 .hw = {
1017 .clk = &i2c2_ick,
1018 },
1019 .ops = &clkhwops_iclk_wait,
1020 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1021 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1022 .clkdm_name = "core_l4_clkdm",
1023};
1024
1025DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
1026
1027DEFINE_CLK_OMAP_MUX_GATE(iva1_ifck, "iva1_clkdm", dsp_fck_clksel,
1028 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1029 OMAP2420_CLKSEL_IVA_MASK,
1030 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1031 OMAP2420_EN_IVA_COP_SHIFT, &clkhwops_wait,
1032 dsp_fck_parent_names, dsp_fck_ops);
1033
1034static struct clk iva1_mpu_int_ifck;
1035
1036static const char *iva1_mpu_int_ifck_parent_names[] = {
1037 "iva1_ifck",
1038};
1039
1040static const struct clk_ops iva1_mpu_int_ifck_ops = {
1041 .init = &omap2_init_clk_clkdm,
1042 .enable = &omap2_dflt_clk_enable,
1043 .disable = &omap2_dflt_clk_disable,
1044 .is_enabled = &omap2_dflt_clk_is_enabled,
1045 .recalc_rate = &omap_fixed_divisor_recalc,
1046};
1047
1048static struct clk_hw_omap iva1_mpu_int_ifck_hw = {
1049 .hw = {
1050 .clk = &iva1_mpu_int_ifck,
1051 },
1052 .ops = &clkhwops_wait,
1053 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1054 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
1055 .clkdm_name = "iva1_clkdm",
1056 .fixed_div = 2,
1057};
1058
1059DEFINE_STRUCT_CLK(iva1_mpu_int_ifck, iva1_mpu_int_ifck_parent_names,
1060 iva1_mpu_int_ifck_ops);
1061
1062static struct clk mailboxes_ick;
1063
1064static struct clk_hw_omap mailboxes_ick_hw = {
1065 .hw = {
1066 .clk = &mailboxes_ick,
1067 },
1068 .ops = &clkhwops_iclk_wait,
1069 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1070 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1071 .clkdm_name = "core_l4_clkdm",
1072};
1073
1074DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1075
1076static const struct clksel_rate common_mcbsp_96m_rates[] = {
1077 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1078 { .div = 0 }
1079};
1080
1081static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1082 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1083 { .div = 0 }
1084};
1085
1086static const struct clksel mcbsp_fck_clksel[] = {
1087 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1088 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1089 { .parent = NULL },
1090};
1091
1092static const char *mcbsp1_fck_parent_names[] = {
1093 "func_96m_ck", "mcbsp_clks",
1094};
1095
1096DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1097 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1098 OMAP2_MCBSP1_CLKS_MASK,
1099 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1100 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1101 mcbsp1_fck_parent_names, dss1_fck_ops);
1102
1103static struct clk mcbsp1_ick;
1104
1105static struct clk_hw_omap mcbsp1_ick_hw = {
1106 .hw = {
1107 .clk = &mcbsp1_ick,
1108 },
1109 .ops = &clkhwops_iclk_wait,
1110 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1111 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1112 .clkdm_name = "core_l4_clkdm",
1113};
1114
1115DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1116
1117DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1118 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1119 OMAP2_MCBSP2_CLKS_MASK,
1120 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1121 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1122 mcbsp1_fck_parent_names, dss1_fck_ops);
1123
1124static struct clk mcbsp2_ick;
1125
1126static struct clk_hw_omap mcbsp2_ick_hw = {
1127 .hw = {
1128 .clk = &mcbsp2_ick,
1129 },
1130 .ops = &clkhwops_iclk_wait,
1131 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1132 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1133 .clkdm_name = "core_l4_clkdm",
1134};
1135
1136DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1137
1138static struct clk mcspi1_fck;
1139
1140static const char *mcspi1_fck_parent_names[] = {
1141 "func_48m_ck",
1142};
1143
1144static struct clk_hw_omap mcspi1_fck_hw = {
1145 .hw = {
1146 .clk = &mcspi1_fck,
1147 },
1148 .ops = &clkhwops_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1150 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1155
1156static struct clk mcspi1_ick;
1157
1158static struct clk_hw_omap mcspi1_ick_hw = {
1159 .hw = {
1160 .clk = &mcspi1_ick,
1161 },
1162 .ops = &clkhwops_iclk_wait,
1163 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1164 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1165 .clkdm_name = "core_l4_clkdm",
1166};
1167
1168DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1169
1170static struct clk mcspi2_fck;
1171
1172static struct clk_hw_omap mcspi2_fck_hw = {
1173 .hw = {
1174 .clk = &mcspi2_fck,
1175 },
1176 .ops = &clkhwops_wait,
1177 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1178 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1179 .clkdm_name = "core_l4_clkdm",
1180};
1181
1182DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1183
1184static struct clk mcspi2_ick;
1185
1186static struct clk_hw_omap mcspi2_ick_hw = {
1187 .hw = {
1188 .clk = &mcspi2_ick,
1189 },
1190 .ops = &clkhwops_iclk_wait,
1191 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1192 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1193 .clkdm_name = "core_l4_clkdm",
1194};
1195
1196DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1197
1198static struct clk mmc_fck;
1199
1200static struct clk_hw_omap mmc_fck_hw = {
1201 .hw = {
1202 .clk = &mmc_fck,
1203 },
1204 .ops = &clkhwops_wait,
1205 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1206 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1207 .clkdm_name = "core_l4_clkdm",
1208};
1209
1210DEFINE_STRUCT_CLK(mmc_fck, cam_fck_parent_names, aes_ick_ops);
1211
1212static struct clk mmc_ick;
1213
1214static struct clk_hw_omap mmc_ick_hw = {
1215 .hw = {
1216 .clk = &mmc_ick,
1217 },
1218 .ops = &clkhwops_iclk_wait,
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1220 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1221 .clkdm_name = "core_l4_clkdm",
1222};
1223
1224DEFINE_STRUCT_CLK(mmc_ick, aes_ick_parent_names, aes_ick_ops);
1225
1226DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1227 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1228 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1229 CLK_DIVIDER_ONE_BASED, NULL);
1230
1231static struct clk mpu_wdt_fck;
1232
1233static struct clk_hw_omap mpu_wdt_fck_hw = {
1234 .hw = {
1235 .clk = &mpu_wdt_fck,
1236 },
1237 .ops = &clkhwops_wait,
1238 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1239 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1240 .clkdm_name = "wkup_clkdm",
1241};
1242
1243DEFINE_STRUCT_CLK(mpu_wdt_fck, gpios_fck_parent_names, aes_ick_ops);
1244
1245static struct clk mpu_wdt_ick;
1246
1247static struct clk_hw_omap mpu_wdt_ick_hw = {
1248 .hw = {
1249 .clk = &mpu_wdt_ick,
1250 },
1251 .ops = &clkhwops_iclk_wait,
1252 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1253 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1254 .clkdm_name = "wkup_clkdm",
1255};
1256
1257DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1258
1259static struct clk mspro_fck;
1260
1261static struct clk_hw_omap mspro_fck_hw = {
1262 .hw = {
1263 .clk = &mspro_fck,
1264 },
1265 .ops = &clkhwops_wait,
1266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1267 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1268 .clkdm_name = "core_l4_clkdm",
1269};
1270
1271DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1272
1273static struct clk mspro_ick;
1274
1275static struct clk_hw_omap mspro_ick_hw = {
1276 .hw = {
1277 .clk = &mspro_ick,
1278 },
1279 .ops = &clkhwops_iclk_wait,
1280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1281 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1282 .clkdm_name = "core_l4_clkdm",
1283};
1284
1285DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1286
1287static struct clk omapctrl_ick;
1288
1289static struct clk_hw_omap omapctrl_ick_hw = {
1290 .hw = {
1291 .clk = &omapctrl_ick,
1292 },
1293 .ops = &clkhwops_iclk_wait,
1294 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1295 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1296 .flags = ENABLE_ON_INIT,
1297 .clkdm_name = "wkup_clkdm",
1298};
1299
1300DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1301
1302static struct clk pka_ick;
1303
1304static struct clk_hw_omap pka_ick_hw = {
1305 .hw = {
1306 .clk = &pka_ick,
1307 },
1308 .ops = &clkhwops_iclk_wait,
1309 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1310 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1311 .clkdm_name = "core_l4_clkdm",
1312};
1313
1314DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1315
1316static struct clk rng_ick;
1317
1318static struct clk_hw_omap rng_ick_hw = {
1319 .hw = {
1320 .clk = &rng_ick,
1321 },
1322 .ops = &clkhwops_iclk_wait,
1323 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1324 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1325 .clkdm_name = "core_l4_clkdm",
1326};
1327
1328DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1329
1330static struct clk sdma_fck;
1331
1332DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1333DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1334
1335static struct clk sdma_ick;
1336
1337static struct clk_hw_omap sdma_ick_hw = {
1338 .hw = {
1339 .clk = &sdma_ick,
1340 },
1341 .ops = &clkhwops_iclk,
1342 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1343 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1344 .clkdm_name = "core_l3_clkdm",
1345};
1346
1347DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1348
1349static struct clk sdrc_ick;
1350
1351static struct clk_hw_omap sdrc_ick_hw = {
1352 .hw = {
1353 .clk = &sdrc_ick,
1354 },
1355 .ops = &clkhwops_iclk,
1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1357 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1358 .flags = ENABLE_ON_INIT,
1359 .clkdm_name = "core_l3_clkdm",
1360};
1361
1362DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1363
1364static struct clk sha_ick;
1365
1366static struct clk_hw_omap sha_ick_hw = {
1367 .hw = {
1368 .clk = &sha_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1372 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1373 .clkdm_name = "core_l4_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1377
1378static struct clk ssi_l4_ick;
1379
1380static struct clk_hw_omap ssi_l4_ick_hw = {
1381 .hw = {
1382 .clk = &ssi_l4_ick,
1383 },
1384 .ops = &clkhwops_iclk_wait,
1385 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1386 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1387 .clkdm_name = "core_l4_clkdm",
1388};
1389
1390DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1391
1392static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1393 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1394 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1395 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1396 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1397 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1398 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1399 { .div = 0 }
1400};
1401
1402static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1403 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1404 { .parent = NULL },
1405};
1406
1407static const char *ssi_ssr_sst_fck_parent_names[] = {
1408 "core_ck",
1409};
1410
1411DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1412 ssi_ssr_sst_fck_clksel,
1413 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1414 OMAP24XX_CLKSEL_SSI_MASK,
1415 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1416 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1417 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1418
1419static struct clk sync_32k_ick;
1420
1421static struct clk_hw_omap sync_32k_ick_hw = {
1422 .hw = {
1423 .clk = &sync_32k_ick,
1424 },
1425 .ops = &clkhwops_iclk_wait,
1426 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1427 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1428 .flags = ENABLE_ON_INIT,
1429 .clkdm_name = "wkup_clkdm",
1430};
1431
1432DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1433
1434static const struct clksel_rate common_clkout_src_core_rates[] = {
1435 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1436 { .div = 0 }
1437};
1438
1439static const struct clksel_rate common_clkout_src_sys_rates[] = {
1440 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1441 { .div = 0 }
1442};
1443
1444static const struct clksel_rate common_clkout_src_96m_rates[] = {
1445 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1446 { .div = 0 }
1447};
1448
1449static const struct clksel_rate common_clkout_src_54m_rates[] = {
1450 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1451 { .div = 0 }
1452};
1453
1454static const struct clksel common_clkout_src_clksel[] = {
1455 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1456 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1457 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1458 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1459 { .parent = NULL },
1460};
1461
1462static const char *sys_clkout_src_parent_names[] = {
1463 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1464};
1465
1466DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1467 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1468 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1469 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1470
1471DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1472 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1473 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1474
1475DEFINE_CLK_OMAP_MUX_GATE(sys_clkout2_src, "wkup_clkdm",
1476 common_clkout_src_clksel, OMAP2420_PRCM_CLKOUT_CTRL,
1477 OMAP2420_CLKOUT2_SOURCE_MASK,
1478 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_EN_SHIFT,
1479 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1480
1481DEFINE_CLK_DIVIDER(sys_clkout2, "sys_clkout2_src", &sys_clkout2_src, 0x0,
1482 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_DIV_SHIFT,
1483 OMAP2420_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1484
1485static struct clk uart1_fck;
1486
1487static struct clk_hw_omap uart1_fck_hw = {
1488 .hw = {
1489 .clk = &uart1_fck,
1490 },
1491 .ops = &clkhwops_wait,
1492 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1493 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1494 .clkdm_name = "core_l4_clkdm",
1495};
1496
1497DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1498
1499static struct clk uart1_ick;
1500
1501static struct clk_hw_omap uart1_ick_hw = {
1502 .hw = {
1503 .clk = &uart1_ick,
1504 },
1505 .ops = &clkhwops_iclk_wait,
1506 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1507 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1508 .clkdm_name = "core_l4_clkdm",
1509};
1510
1511DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1512
1513static struct clk uart2_fck;
1514
1515static struct clk_hw_omap uart2_fck_hw = {
1516 .hw = {
1517 .clk = &uart2_fck,
1518 },
1519 .ops = &clkhwops_wait,
1520 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1521 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1522 .clkdm_name = "core_l4_clkdm",
1523};
1524
1525DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1526
1527static struct clk uart2_ick;
1528
1529static struct clk_hw_omap uart2_ick_hw = {
1530 .hw = {
1531 .clk = &uart2_ick,
1532 },
1533 .ops = &clkhwops_iclk_wait,
1534 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1535 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1536 .clkdm_name = "core_l4_clkdm",
1537};
1538
1539DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1540
1541static struct clk uart3_fck;
1542
1543static struct clk_hw_omap uart3_fck_hw = {
1544 .hw = {
1545 .clk = &uart3_fck,
1546 },
1547 .ops = &clkhwops_wait,
1548 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1549 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1550 .clkdm_name = "core_l4_clkdm",
1551};
1552
1553DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1554
1555static struct clk uart3_ick;
1556
1557static struct clk_hw_omap uart3_ick_hw = {
1558 .hw = {
1559 .clk = &uart3_ick,
1560 },
1561 .ops = &clkhwops_iclk_wait,
1562 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1563 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1564 .clkdm_name = "core_l4_clkdm",
1565};
1566
1567DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1568
1569static struct clk usb_fck;
1570
1571static struct clk_hw_omap usb_fck_hw = {
1572 .hw = {
1573 .clk = &usb_fck,
1574 },
1575 .ops = &clkhwops_wait,
1576 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1577 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1578 .clkdm_name = "core_l3_clkdm",
1579};
1580
1581DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1582
1583static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1584 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1585 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1586 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1587 { .div = 0 }
1588};
1589
1590static const struct clksel usb_l4_ick_clksel[] = {
1591 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1592 { .parent = NULL },
1593};
1594
1595static const char *usb_l4_ick_parent_names[] = {
1596 "core_l3_ck",
1597};
1598
1599DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1600 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1601 OMAP24XX_CLKSEL_USB_MASK,
1602 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1603 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1604 usb_l4_ick_parent_names, dsp_fck_ops);
1605
1606static struct clk virt_prcm_set;
1607
1608static const char *virt_prcm_set_parent_names[] = {
1609 "mpu_ck",
1610};
1611
1612static const struct clk_ops virt_prcm_set_ops = {
1613 .recalc_rate = &omap2_table_mpu_recalc,
1614 .set_rate = &omap2_select_table_rate,
1615 .round_rate = &omap2_round_to_table_rate,
1616};
1617
1618DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1619DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1620
1621static const struct clksel_rate vlynq_fck_96m_rates[] = {
1622 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1623 { .div = 0 }
1624};
1625
1626static const struct clksel_rate vlynq_fck_core_rates[] = {
1627 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1628 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1629 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1630 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1631 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1632 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1633 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1634 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1635 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1636 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1637 { .div = 0 }
1638};
1639
1640static const struct clksel vlynq_fck_clksel[] = {
1641 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1642 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1643 { .parent = NULL },
1644};
1645
1646static const char *vlynq_fck_parent_names[] = {
1647 "func_96m_ck", "core_ck",
1648};
1649
1650DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
1651 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1652 OMAP2420_CLKSEL_VLYNQ_MASK,
1653 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1654 OMAP2420_EN_VLYNQ_SHIFT, &clkhwops_wait,
1655 vlynq_fck_parent_names, dss1_fck_ops);
1656
1657static struct clk vlynq_ick;
1658
1659static struct clk_hw_omap vlynq_ick_hw = {
1660 .hw = {
1661 .clk = &vlynq_ick,
1662 },
1663 .ops = &clkhwops_iclk_wait,
1664 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1665 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1666 .clkdm_name = "core_l3_clkdm",
1667};
1668
1669DEFINE_STRUCT_CLK(vlynq_ick, gfx_ick_parent_names, aes_ick_ops);
1670
1671static struct clk wdt1_ick;
1672
1673static struct clk_hw_omap wdt1_ick_hw = {
1674 .hw = {
1675 .clk = &wdt1_ick,
1676 },
1677 .ops = &clkhwops_iclk_wait,
1678 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1679 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1680 .clkdm_name = "wkup_clkdm",
1681};
1682
1683DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1684
1685static struct clk wdt1_osc_ck;
1686
1687static const struct clk_ops wdt1_osc_ck_ops = {};
1688
1689DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1690DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1691
1692static struct clk wdt3_fck;
1693
1694static struct clk_hw_omap wdt3_fck_hw = {
1695 .hw = {
1696 .clk = &wdt3_fck,
1697 },
1698 .ops = &clkhwops_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1700 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(wdt3_fck, gpios_fck_parent_names, aes_ick_ops);
1705
1706static struct clk wdt3_ick;
1707
1708static struct clk_hw_omap wdt3_ick_hw = {
1709 .hw = {
1710 .clk = &wdt3_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1714 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(wdt3_ick, aes_ick_parent_names, aes_ick_ops);
1719
1720static struct clk wdt4_fck;
1721
1722static struct clk_hw_omap wdt4_fck_hw = {
1723 .hw = {
1724 .clk = &wdt4_fck,
1725 },
1726 .ops = &clkhwops_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1728 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(wdt4_fck, gpios_fck_parent_names, aes_ick_ops);
1733
1734static struct clk wdt4_ick;
1735
1736static struct clk_hw_omap wdt4_ick_hw = {
1737 .hw = {
1738 .clk = &wdt4_ick,
1739 },
1740 .ops = &clkhwops_iclk_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1742 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1743 .clkdm_name = "core_l4_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1747
1748/*
1749 * clkdev integration
1750 */
1751
1752static struct omap_clk omap2420_clks[] = {
1753 /* external root sources */
1754 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1755 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1756 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1757 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1758 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1759 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1760 /* internal analog sources */
1761 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1762 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1763 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1764 /* internal prcm root sources */
1765 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1766 CLK(NULL, "core_ck", &core_ck, CK_242X),
1767 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1768 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1769 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1770 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1771 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1772 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1773 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1774 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1775 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1776 /* mpu domain clocks */
1777 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1778 /* dsp domain clocks */
1779 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1780 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1781 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1782 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1783 /* GFX domain clocks */
1784 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1785 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1786 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1787 /* DSS domain clocks */
1788 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1789 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1790 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1791 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1792 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1793 /* L3 domain clocks */
1794 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1795 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1796 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1797 /* L4 domain clocks */
1798 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1799 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1800 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1801 /* virtual meta-group clock */
1802 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1803 /* general l4 interface ck, multi-parent functional clk */
1804 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1805 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1806 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1807 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1808 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1809 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1810 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1811 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1812 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1813 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1814 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1815 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1816 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1817 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1818 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1819 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1820 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1821 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1822 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1823 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1824 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1825 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1826 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1827 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1828 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1829 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1830 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1831 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1832 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1833 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1834 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1835 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1836 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1837 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1838 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1839 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1840 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1841 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1842 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1843 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1844 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1845 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1846 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1847 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1848 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1849 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1850 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1851 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1852 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1853 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1854 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1855 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1856 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1857 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1858 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1859 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1860 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1861 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1862 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1863 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1864 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1865 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1866 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1867 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1868 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1869 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1870 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1871 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1872 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1873 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1874 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1875 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1876 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1877 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1878 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1879 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1880 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1881 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1882 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1883 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1884 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1885 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1886 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1887 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1888 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1889 CLK(NULL, "des_ick", &des_ick, CK_242X),
1890 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1891 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1892 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1893 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1894 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1895 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1896 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1897 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1898 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1899 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1900 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1901 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1902 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1903};
1904
1905
1906static const char *enable_init_clks[] = {
1907 "apll96_ck",
1908 "apll54_ck",
1909 "sync_32k_ick",
1910 "omapctrl_ick",
1911 "gpmc_fck",
1912 "sdrc_ick",
1913};
1914
1915/*
1916 * init code
1917 */
1918
1919int __init omap2420_clk_init(void)
1920{
1921 struct omap_clk *c;
1922
1923 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1924 cpu_mask = RATE_IN_242X;
1925 rate_table = omap2420_rate_table;
1926
1927 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
1928
1929 omap2xxx_clkt_vps_check_bootloader_rates();
1930
1931 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1932 c++) {
1933 clkdev_add(&c->lk);
1934 if (!__clk_init(NULL, c->lk.clk))
1935 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1936 }
1937
1938 omap2_clk_disable_autoidle_all();
1939
1940 omap2_clk_enable_init_clocks(enable_init_clks,
1941 ARRAY_SIZE(enable_init_clks));
1942
1943 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1944 (clk_get_rate(&sys_ck) / 1000000),
1945 (clk_get_rate(&sys_ck) / 100000) % 10,
1946 (clk_get_rate(&dpll_ck) / 1000000),
1947 (clk_get_rate(&mpu_ck) / 1000000));
1948
1949 return 0;
1950}
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
new file mode 100644
index 000000000000..eda079b96c6a
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -0,0 +1,2065 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/clk-private.h>
19#include <linux/list.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "clock.h"
24#include "clock2xxx.h"
25#include "opp2xxx.h"
26#include "cm2xxx.h"
27#include "prm2xxx.h"
28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h"
30#include "sdrc.h"
31#include "control.h"
32
33#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
34
35/*
36 * 2430 clock tree.
37 *
38 * NOTE:In many cases here we are assigning a 'default' parent. In
39 * many cases the parent is selectable. The set parent calls will
40 * also switch sources.
41 *
42 * Several sources are given initial rates which may be wrong, this will
43 * be fixed up in the init func.
44 *
45 * Things are broadly separated below by clock domains. It is
46 * noteworthy that most peripherals have dependencies on multiple clock
47 * domains. Many get their interface clocks from the L4 domain, but get
48 * functional clocks from fixed sources or other core domain derived
49 * clocks.
50 */
51
52DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
57
58static struct clk osc_ck;
59
60static const struct clk_ops osc_ck_ops = {
61 .enable = &omap2_enable_osc_ck,
62 .disable = omap2_disable_osc_ck,
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static const char *func_96m_ck_parent_names[] = {
226 "apll96_ck", "alt_ck",
227};
228
229DEFINE_CLK_MUX(func_96m_ck, func_96m_ck_parent_names, NULL, 0x0,
230 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP2430_96M_SOURCE_SHIFT,
231 OMAP2430_96M_SOURCE_WIDTH, 0x0, NULL);
232
233static struct clk cam_fck;
234
235static const char *cam_fck_parent_names[] = {
236 "func_96m_ck",
237};
238
239static struct clk_hw_omap cam_fck_hw = {
240 .hw = {
241 .clk = &cam_fck,
242 },
243 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
244 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
245 .clkdm_name = "core_l3_clkdm",
246};
247
248DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
249
250static struct clk cam_ick;
251
252static struct clk_hw_omap cam_ick_hw = {
253 .hw = {
254 .clk = &cam_ick,
255 },
256 .ops = &clkhwops_iclk,
257 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
258 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
259 .clkdm_name = "core_l4_clkdm",
260};
261
262DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
263
264static struct clk des_ick;
265
266static struct clk_hw_omap des_ick_hw = {
267 .hw = {
268 .clk = &des_ick,
269 },
270 .ops = &clkhwops_iclk_wait,
271 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
272 .enable_bit = OMAP24XX_EN_DES_SHIFT,
273 .clkdm_name = "core_l4_clkdm",
274};
275
276DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
277
278static const struct clksel_rate dsp_fck_core_rates[] = {
279 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
280 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
281 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
282 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
283 { .div = 0 }
284};
285
286static const struct clksel dsp_fck_clksel[] = {
287 { .parent = &core_ck, .rates = dsp_fck_core_rates },
288 { .parent = NULL },
289};
290
291static const char *dsp_fck_parent_names[] = {
292 "core_ck",
293};
294
295static struct clk dsp_fck;
296
297static const struct clk_ops dsp_fck_ops = {
298 .init = &omap2_init_clk_clkdm,
299 .enable = &omap2_dflt_clk_enable,
300 .disable = &omap2_dflt_clk_disable,
301 .is_enabled = &omap2_dflt_clk_is_enabled,
302 .recalc_rate = &omap2_clksel_recalc,
303 .set_rate = &omap2_clksel_set_rate,
304 .round_rate = &omap2_clksel_round_rate,
305};
306
307DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
308 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
309 OMAP24XX_CLKSEL_DSP_MASK,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
311 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
312 dsp_fck_parent_names, dsp_fck_ops);
313
314static const struct clksel_rate dss1_fck_sys_rates[] = {
315 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
316 { .div = 0 }
317};
318
319static const struct clksel_rate dss1_fck_core_rates[] = {
320 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
321 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
322 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
323 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
324 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
325 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
326 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
327 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
328 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
329 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
330 { .div = 0 }
331};
332
333static const struct clksel dss1_fck_clksel[] = {
334 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
335 { .parent = &core_ck, .rates = dss1_fck_core_rates },
336 { .parent = NULL },
337};
338
339static const char *dss1_fck_parent_names[] = {
340 "sys_ck", "core_ck",
341};
342
343static const struct clk_ops dss1_fck_ops = {
344 .init = &omap2_init_clk_clkdm,
345 .enable = &omap2_dflt_clk_enable,
346 .disable = &omap2_dflt_clk_disable,
347 .is_enabled = &omap2_dflt_clk_is_enabled,
348 .recalc_rate = &omap2_clksel_recalc,
349 .get_parent = &omap2_clksel_find_parent_index,
350 .set_parent = &omap2_clksel_set_parent,
351};
352
353DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
354 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
355 OMAP24XX_CLKSEL_DSS1_MASK,
356 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
357 OMAP24XX_EN_DSS1_SHIFT, NULL,
358 dss1_fck_parent_names, dss1_fck_ops);
359
360static const struct clksel_rate dss2_fck_sys_rates[] = {
361 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
362 { .div = 0 }
363};
364
365static const struct clksel_rate dss2_fck_48m_rates[] = {
366 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
367 { .div = 0 }
368};
369
370static const struct clksel_rate func_48m_apll96_rates[] = {
371 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
372 { .div = 0 }
373};
374
375static const struct clksel_rate func_48m_alt_rates[] = {
376 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
377 { .div = 0 }
378};
379
380static const struct clksel func_48m_clksel[] = {
381 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
382 { .parent = &alt_ck, .rates = func_48m_alt_rates },
383 { .parent = NULL },
384};
385
386static const char *func_48m_ck_parent_names[] = {
387 "apll96_ck", "alt_ck",
388};
389
390static struct clk func_48m_ck;
391
392static const struct clk_ops func_48m_ck_ops = {
393 .init = &omap2_init_clk_clkdm,
394 .recalc_rate = &omap2_clksel_recalc,
395 .set_rate = &omap2_clksel_set_rate,
396 .round_rate = &omap2_clksel_round_rate,
397 .get_parent = &omap2_clksel_find_parent_index,
398 .set_parent = &omap2_clksel_set_parent,
399};
400
401static struct clk_hw_omap func_48m_ck_hw = {
402 .hw = {
403 .clk = &func_48m_ck,
404 },
405 .clksel = func_48m_clksel,
406 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
407 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
408 .clkdm_name = "wkup_clkdm",
409};
410
411DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
412
413static const struct clksel dss2_fck_clksel[] = {
414 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
415 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
416 { .parent = NULL },
417};
418
419static const char *dss2_fck_parent_names[] = {
420 "sys_ck", "func_48m_ck",
421};
422
423DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
424 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
425 OMAP24XX_CLKSEL_DSS2_MASK,
426 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
427 OMAP24XX_EN_DSS2_SHIFT, NULL,
428 dss2_fck_parent_names, dss1_fck_ops);
429
430static const char *func_54m_ck_parent_names[] = {
431 "apll54_ck", "alt_ck",
432};
433
434DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
435 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
436 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH, 0x0, NULL);
437
438static struct clk dss_54m_fck;
439
440static const char *dss_54m_fck_parent_names[] = {
441 "func_54m_ck",
442};
443
444static struct clk_hw_omap dss_54m_fck_hw = {
445 .hw = {
446 .clk = &dss_54m_fck,
447 },
448 .ops = &clkhwops_wait,
449 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
450 .enable_bit = OMAP24XX_EN_TV_SHIFT,
451 .clkdm_name = "dss_clkdm",
452};
453
454DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
455
456static struct clk dss_ick;
457
458static struct clk_hw_omap dss_ick_hw = {
459 .hw = {
460 .clk = &dss_ick,
461 },
462 .ops = &clkhwops_iclk,
463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
464 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
465 .clkdm_name = "dss_clkdm",
466};
467
468DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
469
470static struct clk emul_ck;
471
472static struct clk_hw_omap emul_ck_hw = {
473 .hw = {
474 .clk = &emul_ck,
475 },
476 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
477 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
478 .clkdm_name = "wkup_clkdm",
479};
480
481DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
482
483DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
484
485static struct clk fac_fck;
486
487static const char *fac_fck_parent_names[] = {
488 "func_12m_ck",
489};
490
491static struct clk_hw_omap fac_fck_hw = {
492 .hw = {
493 .clk = &fac_fck,
494 },
495 .ops = &clkhwops_wait,
496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
498 .clkdm_name = "core_l4_clkdm",
499};
500
501DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
502
503static struct clk fac_ick;
504
505static struct clk_hw_omap fac_ick_hw = {
506 .hw = {
507 .clk = &fac_ick,
508 },
509 .ops = &clkhwops_iclk_wait,
510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
511 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
512 .clkdm_name = "core_l4_clkdm",
513};
514
515DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
516
517static const struct clksel gfx_fck_clksel[] = {
518 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
519 { .parent = NULL },
520};
521
522static const char *gfx_2d_fck_parent_names[] = {
523 "core_l3_ck",
524};
525
526DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
527 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
528 OMAP_CLKSEL_GFX_MASK,
529 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
530 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
531 gfx_2d_fck_parent_names, dsp_fck_ops);
532
533DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
534 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
535 OMAP_CLKSEL_GFX_MASK,
536 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
537 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
538 gfx_2d_fck_parent_names, dsp_fck_ops);
539
540static struct clk gfx_ick;
541
542static const char *gfx_ick_parent_names[] = {
543 "core_l3_ck",
544};
545
546static struct clk_hw_omap gfx_ick_hw = {
547 .hw = {
548 .clk = &gfx_ick,
549 },
550 .ops = &clkhwops_wait,
551 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
552 .enable_bit = OMAP_EN_GFX_SHIFT,
553 .clkdm_name = "gfx_clkdm",
554};
555
556DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
557
558static struct clk gpio5_fck;
559
560static const char *gpio5_fck_parent_names[] = {
561 "func_32k_ck",
562};
563
564static struct clk_hw_omap gpio5_fck_hw = {
565 .hw = {
566 .clk = &gpio5_fck,
567 },
568 .ops = &clkhwops_wait,
569 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
570 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
571 .clkdm_name = "core_l4_clkdm",
572};
573
574DEFINE_STRUCT_CLK(gpio5_fck, gpio5_fck_parent_names, aes_ick_ops);
575
576static struct clk gpio5_ick;
577
578static struct clk_hw_omap gpio5_ick_hw = {
579 .hw = {
580 .clk = &gpio5_ick,
581 },
582 .ops = &clkhwops_iclk_wait,
583 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
584 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
585 .clkdm_name = "core_l4_clkdm",
586};
587
588DEFINE_STRUCT_CLK(gpio5_ick, aes_ick_parent_names, aes_ick_ops);
589
590static struct clk gpios_fck;
591
592static struct clk_hw_omap gpios_fck_hw = {
593 .hw = {
594 .clk = &gpios_fck,
595 },
596 .ops = &clkhwops_wait,
597 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
598 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
599 .clkdm_name = "wkup_clkdm",
600};
601
602DEFINE_STRUCT_CLK(gpios_fck, gpio5_fck_parent_names, aes_ick_ops);
603
604static struct clk wu_l4_ick;
605
606DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
607DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
608
609static struct clk gpios_ick;
610
611static const char *gpios_ick_parent_names[] = {
612 "wu_l4_ick",
613};
614
615static struct clk_hw_omap gpios_ick_hw = {
616 .hw = {
617 .clk = &gpios_ick,
618 },
619 .ops = &clkhwops_iclk_wait,
620 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
621 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
622 .clkdm_name = "wkup_clkdm",
623};
624
625DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
626
627static struct clk gpmc_fck;
628
629static struct clk_hw_omap gpmc_fck_hw = {
630 .hw = {
631 .clk = &gpmc_fck,
632 },
633 .ops = &clkhwops_iclk,
634 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
635 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
636 .flags = ENABLE_ON_INIT,
637 .clkdm_name = "core_l3_clkdm",
638};
639
640DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
641
642static const struct clksel_rate gpt_alt_rates[] = {
643 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
644 { .div = 0 }
645};
646
647static const struct clksel omap24xx_gpt_clksel[] = {
648 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
649 { .parent = &sys_ck, .rates = gpt_sys_rates },
650 { .parent = &alt_ck, .rates = gpt_alt_rates },
651 { .parent = NULL },
652};
653
654static const char *gpt10_fck_parent_names[] = {
655 "func_32k_ck", "sys_ck", "alt_ck",
656};
657
658DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
659 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
660 OMAP24XX_CLKSEL_GPT10_MASK,
661 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
662 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
663 gpt10_fck_parent_names, dss1_fck_ops);
664
665static struct clk gpt10_ick;
666
667static struct clk_hw_omap gpt10_ick_hw = {
668 .hw = {
669 .clk = &gpt10_ick,
670 },
671 .ops = &clkhwops_iclk_wait,
672 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
673 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
674 .clkdm_name = "core_l4_clkdm",
675};
676
677DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT11_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt11_ick;
687
688static struct clk_hw_omap gpt11_ick_hw = {
689 .hw = {
690 .clk = &gpt11_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT12_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt12_ick;
708
709static struct clk_hw_omap gpt12_ick_hw = {
710 .hw = {
711 .clk = &gpt12_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
720
721static const struct clk_ops gpt1_fck_ops = {
722 .init = &omap2_init_clk_clkdm,
723 .enable = &omap2_dflt_clk_enable,
724 .disable = &omap2_dflt_clk_disable,
725 .is_enabled = &omap2_dflt_clk_is_enabled,
726 .recalc_rate = &omap2_clksel_recalc,
727 .set_rate = &omap2_clksel_set_rate,
728 .round_rate = &omap2_clksel_round_rate,
729 .get_parent = &omap2_clksel_find_parent_index,
730 .set_parent = &omap2_clksel_set_parent,
731};
732
733DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
734 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
735 OMAP24XX_CLKSEL_GPT1_MASK,
736 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
737 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
738 gpt10_fck_parent_names, gpt1_fck_ops);
739
740static struct clk gpt1_ick;
741
742static struct clk_hw_omap gpt1_ick_hw = {
743 .hw = {
744 .clk = &gpt1_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
748 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
749 .clkdm_name = "wkup_clkdm",
750};
751
752DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
756 OMAP24XX_CLKSEL_GPT2_MASK,
757 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
758 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, dss1_fck_ops);
760
761static struct clk gpt2_ick;
762
763static struct clk_hw_omap gpt2_ick_hw = {
764 .hw = {
765 .clk = &gpt2_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
769 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
770 .clkdm_name = "core_l4_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT3_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt3_ick;
783
784static struct clk_hw_omap gpt3_ick_hw = {
785 .hw = {
786 .clk = &gpt3_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT4_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt4_ick;
804
805static struct clk_hw_omap gpt4_ick_hw = {
806 .hw = {
807 .clk = &gpt4_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT5_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt5_ick;
825
826static struct clk_hw_omap gpt5_ick_hw = {
827 .hw = {
828 .clk = &gpt5_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT6_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt6_ick;
846
847static struct clk_hw_omap gpt6_ick_hw = {
848 .hw = {
849 .clk = &gpt6_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT7_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt7_ick;
867
868static struct clk_hw_omap gpt7_ick_hw = {
869 .hw = {
870 .clk = &gpt7_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
879
880static struct clk gpt8_fck;
881
882DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
883 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
884 OMAP24XX_CLKSEL_GPT8_MASK,
885 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
886 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
887 gpt10_fck_parent_names, dss1_fck_ops);
888
889static struct clk gpt8_ick;
890
891static struct clk_hw_omap gpt8_ick_hw = {
892 .hw = {
893 .clk = &gpt8_ick,
894 },
895 .ops = &clkhwops_iclk_wait,
896 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
897 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
898 .clkdm_name = "core_l4_clkdm",
899};
900
901DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
902
903DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
904 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
905 OMAP24XX_CLKSEL_GPT9_MASK,
906 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
907 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
908 gpt10_fck_parent_names, dss1_fck_ops);
909
910static struct clk gpt9_ick;
911
912static struct clk_hw_omap gpt9_ick_hw = {
913 .hw = {
914 .clk = &gpt9_ick,
915 },
916 .ops = &clkhwops_iclk_wait,
917 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
918 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
919 .clkdm_name = "core_l4_clkdm",
920};
921
922DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
923
924static struct clk hdq_fck;
925
926static struct clk_hw_omap hdq_fck_hw = {
927 .hw = {
928 .clk = &hdq_fck,
929 },
930 .ops = &clkhwops_wait,
931 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
932 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
933 .clkdm_name = "core_l4_clkdm",
934};
935
936DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
937
938static struct clk hdq_ick;
939
940static struct clk_hw_omap hdq_ick_hw = {
941 .hw = {
942 .clk = &hdq_ick,
943 },
944 .ops = &clkhwops_iclk_wait,
945 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
946 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
947 .clkdm_name = "core_l4_clkdm",
948};
949
950DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
951
952static struct clk i2c1_ick;
953
954static struct clk_hw_omap i2c1_ick_hw = {
955 .hw = {
956 .clk = &i2c1_ick,
957 },
958 .ops = &clkhwops_iclk_wait,
959 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
960 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
961 .clkdm_name = "core_l4_clkdm",
962};
963
964DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
965
966static struct clk i2c2_ick;
967
968static struct clk_hw_omap i2c2_ick_hw = {
969 .hw = {
970 .clk = &i2c2_ick,
971 },
972 .ops = &clkhwops_iclk_wait,
973 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
974 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
975 .clkdm_name = "core_l4_clkdm",
976};
977
978DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
979
980static struct clk i2chs1_fck;
981
982static struct clk_hw_omap i2chs1_fck_hw = {
983 .hw = {
984 .clk = &i2chs1_fck,
985 },
986 .ops = &clkhwops_omap2430_i2chs_wait,
987 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
988 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
989 .clkdm_name = "core_l4_clkdm",
990};
991
992DEFINE_STRUCT_CLK(i2chs1_fck, cam_fck_parent_names, aes_ick_ops);
993
994static struct clk i2chs2_fck;
995
996static struct clk_hw_omap i2chs2_fck_hw = {
997 .hw = {
998 .clk = &i2chs2_fck,
999 },
1000 .ops = &clkhwops_omap2430_i2chs_wait,
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1002 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1003 .clkdm_name = "core_l4_clkdm",
1004};
1005
1006DEFINE_STRUCT_CLK(i2chs2_fck, cam_fck_parent_names, aes_ick_ops);
1007
1008static struct clk icr_ick;
1009
1010static struct clk_hw_omap icr_ick_hw = {
1011 .hw = {
1012 .clk = &icr_ick,
1013 },
1014 .ops = &clkhwops_iclk_wait,
1015 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1016 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1017 .clkdm_name = "wkup_clkdm",
1018};
1019
1020DEFINE_STRUCT_CLK(icr_ick, gpios_ick_parent_names, aes_ick_ops);
1021
1022static const struct clksel dsp_ick_clksel[] = {
1023 { .parent = &dsp_fck, .rates = dsp_ick_rates },
1024 { .parent = NULL },
1025};
1026
1027static const char *iva2_1_ick_parent_names[] = {
1028 "dsp_fck",
1029};
1030
1031DEFINE_CLK_OMAP_MUX_GATE(iva2_1_ick, "dsp_clkdm", dsp_ick_clksel,
1032 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1033 OMAP24XX_CLKSEL_DSP_IF_MASK,
1034 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1035 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
1036 iva2_1_ick_parent_names, dsp_fck_ops);
1037
1038static struct clk mailboxes_ick;
1039
1040static struct clk_hw_omap mailboxes_ick_hw = {
1041 .hw = {
1042 .clk = &mailboxes_ick,
1043 },
1044 .ops = &clkhwops_iclk_wait,
1045 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1046 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1047 .clkdm_name = "core_l4_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1051
1052static const struct clksel_rate common_mcbsp_96m_rates[] = {
1053 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1054 { .div = 0 }
1055};
1056
1057static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1058 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1059 { .div = 0 }
1060};
1061
1062static const struct clksel mcbsp_fck_clksel[] = {
1063 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1064 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1065 { .parent = NULL },
1066};
1067
1068static const char *mcbsp1_fck_parent_names[] = {
1069 "func_96m_ck", "mcbsp_clks",
1070};
1071
1072DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1073 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1074 OMAP2_MCBSP1_CLKS_MASK,
1075 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1076 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1077 mcbsp1_fck_parent_names, dss1_fck_ops);
1078
1079static struct clk mcbsp1_ick;
1080
1081static struct clk_hw_omap mcbsp1_ick_hw = {
1082 .hw = {
1083 .clk = &mcbsp1_ick,
1084 },
1085 .ops = &clkhwops_iclk_wait,
1086 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1087 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1088 .clkdm_name = "core_l4_clkdm",
1089};
1090
1091DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1092
1093DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1094 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1095 OMAP2_MCBSP2_CLKS_MASK,
1096 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1097 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1098 mcbsp1_fck_parent_names, dss1_fck_ops);
1099
1100static struct clk mcbsp2_ick;
1101
1102static struct clk_hw_omap mcbsp2_ick_hw = {
1103 .hw = {
1104 .clk = &mcbsp2_ick,
1105 },
1106 .ops = &clkhwops_iclk_wait,
1107 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1108 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1109 .clkdm_name = "core_l4_clkdm",
1110};
1111
1112DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1113
1114DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1115 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1116 OMAP2_MCBSP3_CLKS_MASK,
1117 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1118 OMAP2430_EN_MCBSP3_SHIFT, &clkhwops_wait,
1119 mcbsp1_fck_parent_names, dss1_fck_ops);
1120
1121static struct clk mcbsp3_ick;
1122
1123static struct clk_hw_omap mcbsp3_ick_hw = {
1124 .hw = {
1125 .clk = &mcbsp3_ick,
1126 },
1127 .ops = &clkhwops_iclk_wait,
1128 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1129 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1130 .clkdm_name = "core_l4_clkdm",
1131};
1132
1133DEFINE_STRUCT_CLK(mcbsp3_ick, aes_ick_parent_names, aes_ick_ops);
1134
1135DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1136 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1137 OMAP2_MCBSP4_CLKS_MASK,
1138 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1139 OMAP2430_EN_MCBSP4_SHIFT, &clkhwops_wait,
1140 mcbsp1_fck_parent_names, dss1_fck_ops);
1141
1142static struct clk mcbsp4_ick;
1143
1144static struct clk_hw_omap mcbsp4_ick_hw = {
1145 .hw = {
1146 .clk = &mcbsp4_ick,
1147 },
1148 .ops = &clkhwops_iclk_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1150 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcbsp4_ick, aes_ick_parent_names, aes_ick_ops);
1155
1156DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1157 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1158 OMAP2_MCBSP5_CLKS_MASK,
1159 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1160 OMAP2430_EN_MCBSP5_SHIFT, &clkhwops_wait,
1161 mcbsp1_fck_parent_names, dss1_fck_ops);
1162
1163static struct clk mcbsp5_ick;
1164
1165static struct clk_hw_omap mcbsp5_ick_hw = {
1166 .hw = {
1167 .clk = &mcbsp5_ick,
1168 },
1169 .ops = &clkhwops_iclk_wait,
1170 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1171 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1172 .clkdm_name = "core_l4_clkdm",
1173};
1174
1175DEFINE_STRUCT_CLK(mcbsp5_ick, aes_ick_parent_names, aes_ick_ops);
1176
1177static struct clk mcspi1_fck;
1178
1179static const char *mcspi1_fck_parent_names[] = {
1180 "func_48m_ck",
1181};
1182
1183static struct clk_hw_omap mcspi1_fck_hw = {
1184 .hw = {
1185 .clk = &mcspi1_fck,
1186 },
1187 .ops = &clkhwops_wait,
1188 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1189 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1190 .clkdm_name = "core_l4_clkdm",
1191};
1192
1193DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1194
1195static struct clk mcspi1_ick;
1196
1197static struct clk_hw_omap mcspi1_ick_hw = {
1198 .hw = {
1199 .clk = &mcspi1_ick,
1200 },
1201 .ops = &clkhwops_iclk_wait,
1202 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1203 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1204 .clkdm_name = "core_l4_clkdm",
1205};
1206
1207DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1208
1209static struct clk mcspi2_fck;
1210
1211static struct clk_hw_omap mcspi2_fck_hw = {
1212 .hw = {
1213 .clk = &mcspi2_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1222
1223static struct clk mcspi2_ick;
1224
1225static struct clk_hw_omap mcspi2_ick_hw = {
1226 .hw = {
1227 .clk = &mcspi2_ick,
1228 },
1229 .ops = &clkhwops_iclk_wait,
1230 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1231 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1232 .clkdm_name = "core_l4_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1236
1237static struct clk mcspi3_fck;
1238
1239static struct clk_hw_omap mcspi3_fck_hw = {
1240 .hw = {
1241 .clk = &mcspi3_fck,
1242 },
1243 .ops = &clkhwops_wait,
1244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1245 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1246 .clkdm_name = "core_l4_clkdm",
1247};
1248
1249DEFINE_STRUCT_CLK(mcspi3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1250
1251static struct clk mcspi3_ick;
1252
1253static struct clk_hw_omap mcspi3_ick_hw = {
1254 .hw = {
1255 .clk = &mcspi3_ick,
1256 },
1257 .ops = &clkhwops_iclk_wait,
1258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1259 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1260 .clkdm_name = "core_l4_clkdm",
1261};
1262
1263DEFINE_STRUCT_CLK(mcspi3_ick, aes_ick_parent_names, aes_ick_ops);
1264
1265static const struct clksel_rate mdm_ick_core_rates[] = {
1266 { .div = 1, .val = 1, .flags = RATE_IN_243X },
1267 { .div = 4, .val = 4, .flags = RATE_IN_243X },
1268 { .div = 6, .val = 6, .flags = RATE_IN_243X },
1269 { .div = 9, .val = 9, .flags = RATE_IN_243X },
1270 { .div = 0 }
1271};
1272
1273static const struct clksel mdm_ick_clksel[] = {
1274 { .parent = &core_ck, .rates = mdm_ick_core_rates },
1275 { .parent = NULL },
1276};
1277
1278static const char *mdm_ick_parent_names[] = {
1279 "core_ck",
1280};
1281
1282DEFINE_CLK_OMAP_MUX_GATE(mdm_ick, "mdm_clkdm", mdm_ick_clksel,
1283 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
1284 OMAP2430_CLKSEL_MDM_MASK,
1285 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
1286 OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
1287 &clkhwops_iclk_wait, mdm_ick_parent_names,
1288 dsp_fck_ops);
1289
1290static struct clk mdm_intc_ick;
1291
1292static struct clk_hw_omap mdm_intc_ick_hw = {
1293 .hw = {
1294 .clk = &mdm_intc_ick,
1295 },
1296 .ops = &clkhwops_iclk_wait,
1297 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1298 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1299 .clkdm_name = "core_l4_clkdm",
1300};
1301
1302DEFINE_STRUCT_CLK(mdm_intc_ick, aes_ick_parent_names, aes_ick_ops);
1303
1304static struct clk mdm_osc_ck;
1305
1306static struct clk_hw_omap mdm_osc_ck_hw = {
1307 .hw = {
1308 .clk = &mdm_osc_ck,
1309 },
1310 .ops = &clkhwops_iclk_wait,
1311 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
1312 .enable_bit = OMAP2430_EN_OSC_SHIFT,
1313 .clkdm_name = "mdm_clkdm",
1314};
1315
1316DEFINE_STRUCT_CLK(mdm_osc_ck, sys_ck_parent_names, aes_ick_ops);
1317
1318static struct clk mmchs1_fck;
1319
1320static struct clk_hw_omap mmchs1_fck_hw = {
1321 .hw = {
1322 .clk = &mmchs1_fck,
1323 },
1324 .ops = &clkhwops_wait,
1325 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1326 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1327 .clkdm_name = "core_l4_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(mmchs1_fck, cam_fck_parent_names, aes_ick_ops);
1331
1332static struct clk mmchs1_ick;
1333
1334static struct clk_hw_omap mmchs1_ick_hw = {
1335 .hw = {
1336 .clk = &mmchs1_ick,
1337 },
1338 .ops = &clkhwops_iclk_wait,
1339 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1340 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1341 .clkdm_name = "core_l4_clkdm",
1342};
1343
1344DEFINE_STRUCT_CLK(mmchs1_ick, aes_ick_parent_names, aes_ick_ops);
1345
1346static struct clk mmchs2_fck;
1347
1348static struct clk_hw_omap mmchs2_fck_hw = {
1349 .hw = {
1350 .clk = &mmchs2_fck,
1351 },
1352 .ops = &clkhwops_wait,
1353 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1354 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1355 .clkdm_name = "core_l4_clkdm",
1356};
1357
1358DEFINE_STRUCT_CLK(mmchs2_fck, cam_fck_parent_names, aes_ick_ops);
1359
1360static struct clk mmchs2_ick;
1361
1362static struct clk_hw_omap mmchs2_ick_hw = {
1363 .hw = {
1364 .clk = &mmchs2_ick,
1365 },
1366 .ops = &clkhwops_iclk_wait,
1367 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1368 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1369 .clkdm_name = "core_l4_clkdm",
1370};
1371
1372DEFINE_STRUCT_CLK(mmchs2_ick, aes_ick_parent_names, aes_ick_ops);
1373
1374static struct clk mmchsdb1_fck;
1375
1376static struct clk_hw_omap mmchsdb1_fck_hw = {
1377 .hw = {
1378 .clk = &mmchsdb1_fck,
1379 },
1380 .ops = &clkhwops_wait,
1381 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1382 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1383 .clkdm_name = "core_l4_clkdm",
1384};
1385
1386DEFINE_STRUCT_CLK(mmchsdb1_fck, gpio5_fck_parent_names, aes_ick_ops);
1387
1388static struct clk mmchsdb2_fck;
1389
1390static struct clk_hw_omap mmchsdb2_fck_hw = {
1391 .hw = {
1392 .clk = &mmchsdb2_fck,
1393 },
1394 .ops = &clkhwops_wait,
1395 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1396 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1397 .clkdm_name = "core_l4_clkdm",
1398};
1399
1400DEFINE_STRUCT_CLK(mmchsdb2_fck, gpio5_fck_parent_names, aes_ick_ops);
1401
1402DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1403 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1404 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1405 CLK_DIVIDER_ONE_BASED, NULL);
1406
1407static struct clk mpu_wdt_fck;
1408
1409static struct clk_hw_omap mpu_wdt_fck_hw = {
1410 .hw = {
1411 .clk = &mpu_wdt_fck,
1412 },
1413 .ops = &clkhwops_wait,
1414 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1415 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1416 .clkdm_name = "wkup_clkdm",
1417};
1418
1419DEFINE_STRUCT_CLK(mpu_wdt_fck, gpio5_fck_parent_names, aes_ick_ops);
1420
1421static struct clk mpu_wdt_ick;
1422
1423static struct clk_hw_omap mpu_wdt_ick_hw = {
1424 .hw = {
1425 .clk = &mpu_wdt_ick,
1426 },
1427 .ops = &clkhwops_iclk_wait,
1428 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1429 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1430 .clkdm_name = "wkup_clkdm",
1431};
1432
1433DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1434
1435static struct clk mspro_fck;
1436
1437static struct clk_hw_omap mspro_fck_hw = {
1438 .hw = {
1439 .clk = &mspro_fck,
1440 },
1441 .ops = &clkhwops_wait,
1442 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1443 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1444 .clkdm_name = "core_l4_clkdm",
1445};
1446
1447DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1448
1449static struct clk mspro_ick;
1450
1451static struct clk_hw_omap mspro_ick_hw = {
1452 .hw = {
1453 .clk = &mspro_ick,
1454 },
1455 .ops = &clkhwops_iclk_wait,
1456 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1457 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1458 .clkdm_name = "core_l4_clkdm",
1459};
1460
1461DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1462
1463static struct clk omapctrl_ick;
1464
1465static struct clk_hw_omap omapctrl_ick_hw = {
1466 .hw = {
1467 .clk = &omapctrl_ick,
1468 },
1469 .ops = &clkhwops_iclk_wait,
1470 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1471 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1472 .flags = ENABLE_ON_INIT,
1473 .clkdm_name = "wkup_clkdm",
1474};
1475
1476DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1477
1478static struct clk pka_ick;
1479
1480static struct clk_hw_omap pka_ick_hw = {
1481 .hw = {
1482 .clk = &pka_ick,
1483 },
1484 .ops = &clkhwops_iclk_wait,
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1486 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1487 .clkdm_name = "core_l4_clkdm",
1488};
1489
1490DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1491
1492static struct clk rng_ick;
1493
1494static struct clk_hw_omap rng_ick_hw = {
1495 .hw = {
1496 .clk = &rng_ick,
1497 },
1498 .ops = &clkhwops_iclk_wait,
1499 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1500 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1501 .clkdm_name = "core_l4_clkdm",
1502};
1503
1504DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1505
1506static struct clk sdma_fck;
1507
1508DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1509DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1510
1511static struct clk sdma_ick;
1512
1513static struct clk_hw_omap sdma_ick_hw = {
1514 .hw = {
1515 .clk = &sdma_ick,
1516 },
1517 .ops = &clkhwops_iclk,
1518 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1519 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1520 .clkdm_name = "core_l3_clkdm",
1521};
1522
1523DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1524
1525static struct clk sdrc_ick;
1526
1527static struct clk_hw_omap sdrc_ick_hw = {
1528 .hw = {
1529 .clk = &sdrc_ick,
1530 },
1531 .ops = &clkhwops_iclk,
1532 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1533 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1534 .flags = ENABLE_ON_INIT,
1535 .clkdm_name = "core_l3_clkdm",
1536};
1537
1538DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1539
1540static struct clk sha_ick;
1541
1542static struct clk_hw_omap sha_ick_hw = {
1543 .hw = {
1544 .clk = &sha_ick,
1545 },
1546 .ops = &clkhwops_iclk_wait,
1547 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1548 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1549 .clkdm_name = "core_l4_clkdm",
1550};
1551
1552DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1553
1554static struct clk ssi_l4_ick;
1555
1556static struct clk_hw_omap ssi_l4_ick_hw = {
1557 .hw = {
1558 .clk = &ssi_l4_ick,
1559 },
1560 .ops = &clkhwops_iclk_wait,
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1562 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1563 .clkdm_name = "core_l4_clkdm",
1564};
1565
1566DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1567
1568static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1569 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1570 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1571 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1572 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1573 { .div = 5, .val = 5, .flags = RATE_IN_243X },
1574 { .div = 0 }
1575};
1576
1577static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1578 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1579 { .parent = NULL },
1580};
1581
1582static const char *ssi_ssr_sst_fck_parent_names[] = {
1583 "core_ck",
1584};
1585
1586DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1587 ssi_ssr_sst_fck_clksel,
1588 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1589 OMAP24XX_CLKSEL_SSI_MASK,
1590 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1591 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1592 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1593
1594static struct clk sync_32k_ick;
1595
1596static struct clk_hw_omap sync_32k_ick_hw = {
1597 .hw = {
1598 .clk = &sync_32k_ick,
1599 },
1600 .ops = &clkhwops_iclk_wait,
1601 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1602 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1603 .flags = ENABLE_ON_INIT,
1604 .clkdm_name = "wkup_clkdm",
1605};
1606
1607DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1608
1609static const struct clksel_rate common_clkout_src_core_rates[] = {
1610 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1611 { .div = 0 }
1612};
1613
1614static const struct clksel_rate common_clkout_src_sys_rates[] = {
1615 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1616 { .div = 0 }
1617};
1618
1619static const struct clksel_rate common_clkout_src_96m_rates[] = {
1620 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1621 { .div = 0 }
1622};
1623
1624static const struct clksel_rate common_clkout_src_54m_rates[] = {
1625 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1626 { .div = 0 }
1627};
1628
1629static const struct clksel common_clkout_src_clksel[] = {
1630 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1631 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1632 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1633 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1634 { .parent = NULL },
1635};
1636
1637static const char *sys_clkout_src_parent_names[] = {
1638 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1639};
1640
1641DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1642 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1643 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1644 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1645
1646DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1647 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1648 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1649
1650static struct clk uart1_fck;
1651
1652static struct clk_hw_omap uart1_fck_hw = {
1653 .hw = {
1654 .clk = &uart1_fck,
1655 },
1656 .ops = &clkhwops_wait,
1657 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1658 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1659 .clkdm_name = "core_l4_clkdm",
1660};
1661
1662DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1663
1664static struct clk uart1_ick;
1665
1666static struct clk_hw_omap uart1_ick_hw = {
1667 .hw = {
1668 .clk = &uart1_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1672 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1673 .clkdm_name = "core_l4_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1677
1678static struct clk uart2_fck;
1679
1680static struct clk_hw_omap uart2_fck_hw = {
1681 .hw = {
1682 .clk = &uart2_fck,
1683 },
1684 .ops = &clkhwops_wait,
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1686 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1687 .clkdm_name = "core_l4_clkdm",
1688};
1689
1690DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1691
1692static struct clk uart2_ick;
1693
1694static struct clk_hw_omap uart2_ick_hw = {
1695 .hw = {
1696 .clk = &uart2_ick,
1697 },
1698 .ops = &clkhwops_iclk_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1700 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1705
1706static struct clk uart3_fck;
1707
1708static struct clk_hw_omap uart3_fck_hw = {
1709 .hw = {
1710 .clk = &uart3_fck,
1711 },
1712 .ops = &clkhwops_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1714 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1719
1720static struct clk uart3_ick;
1721
1722static struct clk_hw_omap uart3_ick_hw = {
1723 .hw = {
1724 .clk = &uart3_ick,
1725 },
1726 .ops = &clkhwops_iclk_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1728 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1733
1734static struct clk usb_fck;
1735
1736static struct clk_hw_omap usb_fck_hw = {
1737 .hw = {
1738 .clk = &usb_fck,
1739 },
1740 .ops = &clkhwops_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1742 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1743 .clkdm_name = "core_l3_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1747
1748static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1749 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1750 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1751 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1752 { .div = 0 }
1753};
1754
1755static const struct clksel usb_l4_ick_clksel[] = {
1756 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1757 { .parent = NULL },
1758};
1759
1760static const char *usb_l4_ick_parent_names[] = {
1761 "core_l3_ck",
1762};
1763
1764DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1765 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1766 OMAP24XX_CLKSEL_USB_MASK,
1767 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1768 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1769 usb_l4_ick_parent_names, dsp_fck_ops);
1770
1771static struct clk usbhs_ick;
1772
1773static struct clk_hw_omap usbhs_ick_hw = {
1774 .hw = {
1775 .clk = &usbhs_ick,
1776 },
1777 .ops = &clkhwops_iclk_wait,
1778 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1779 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1780 .clkdm_name = "core_l3_clkdm",
1781};
1782
1783DEFINE_STRUCT_CLK(usbhs_ick, gfx_ick_parent_names, aes_ick_ops);
1784
1785static struct clk virt_prcm_set;
1786
1787static const char *virt_prcm_set_parent_names[] = {
1788 "mpu_ck",
1789};
1790
1791static const struct clk_ops virt_prcm_set_ops = {
1792 .recalc_rate = &omap2_table_mpu_recalc,
1793 .set_rate = &omap2_select_table_rate,
1794 .round_rate = &omap2_round_to_table_rate,
1795};
1796
1797DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1798DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1799
1800static struct clk wdt1_ick;
1801
1802static struct clk_hw_omap wdt1_ick_hw = {
1803 .hw = {
1804 .clk = &wdt1_ick,
1805 },
1806 .ops = &clkhwops_iclk_wait,
1807 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1808 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1809 .clkdm_name = "wkup_clkdm",
1810};
1811
1812DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1813
1814static struct clk wdt1_osc_ck;
1815
1816static const struct clk_ops wdt1_osc_ck_ops = {};
1817
1818DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1819DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1820
1821static struct clk wdt4_fck;
1822
1823static struct clk_hw_omap wdt4_fck_hw = {
1824 .hw = {
1825 .clk = &wdt4_fck,
1826 },
1827 .ops = &clkhwops_wait,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1829 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1830 .clkdm_name = "core_l4_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(wdt4_fck, gpio5_fck_parent_names, aes_ick_ops);
1834
1835static struct clk wdt4_ick;
1836
1837static struct clk_hw_omap wdt4_ick_hw = {
1838 .hw = {
1839 .clk = &wdt4_ick,
1840 },
1841 .ops = &clkhwops_iclk_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1844 .clkdm_name = "core_l4_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1848
1849/*
1850 * clkdev integration
1851 */
1852
1853static struct omap_clk omap2430_clks[] = {
1854 /* external root sources */
1855 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1856 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1857 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1858 CLK("twl", "fck", &osc_ck, CK_243X),
1859 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1860 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1861 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1862 /* internal analog sources */
1863 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1864 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1865 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1866 /* internal prcm root sources */
1867 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1868 CLK(NULL, "core_ck", &core_ck, CK_243X),
1869 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1870 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1871 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1872 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1873 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1874 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1875 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1876 /* mpu domain clocks */
1877 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1878 /* dsp domain clocks */
1879 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1880 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1881 /* GFX domain clocks */
1882 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1883 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1884 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1885 /* Modem domain clocks */
1886 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1887 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1888 /* DSS domain clocks */
1889 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1890 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1892 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1893 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1894 /* L3 domain clocks */
1895 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1896 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1897 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1898 /* L4 domain clocks */
1899 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1900 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1901 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1902 /* virtual meta-group clock */
1903 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1904 /* general l4 interface ck, multi-parent functional clk */
1905 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1906 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1907 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1908 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1909 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1910 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1911 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1912 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1913 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1914 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1915 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1916 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1917 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1918 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1919 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1920 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1921 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1922 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1923 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1924 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1925 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1926 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1927 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1928 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1929 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1930 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1932 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1933 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1935 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1936 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1938 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1939 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1941 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1942 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1944 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1945 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1947 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1948 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1950 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1951 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1953 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1954 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1955 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1956 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1957 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1958 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1959 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1960 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1961 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1962 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1964 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1965 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1966 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1967 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1968 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1969 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1970 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1971 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1972 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1973 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1974 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1975 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1976 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1977 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1978 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1979 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1980 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1981 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1982 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1983 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1984 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1986 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1987 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1989 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1990 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1991 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1992 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1993 CLK(NULL, "des_ick", &des_ick, CK_243X),
1994 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1995 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1996 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1997 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1998 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1999 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
2000 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2001 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2002 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2003 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2005 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2006 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2008 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2009 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2010 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2011 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2012 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2013 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2014 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2016 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2017 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2018 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2019};
2020
2021static const char *enable_init_clks[] = {
2022 "apll96_ck",
2023 "apll54_ck",
2024 "sync_32k_ick",
2025 "omapctrl_ick",
2026 "gpmc_fck",
2027 "sdrc_ick",
2028};
2029
2030/*
2031 * init code
2032 */
2033
2034int __init omap2430_clk_init(void)
2035{
2036 struct omap_clk *c;
2037
2038 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2039 cpu_mask = RATE_IN_243X;
2040 rate_table = omap2430_rate_table;
2041
2042 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
2043
2044 omap2xxx_clkt_vps_check_bootloader_rates();
2045
2046 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2047 c++) {
2048 clkdev_add(&c->lk);
2049 if (!__clk_init(NULL, c->lk.clk))
2050 omap2_init_clk_hw_omap_clocks(c->lk.clk);
2051 }
2052
2053 omap2_clk_disable_autoidle_all();
2054
2055 omap2_clk_enable_init_clocks(enable_init_clks,
2056 ARRAY_SIZE(enable_init_clks));
2057
2058 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2059 (clk_get_rate(&sys_ck) / 1000000),
2060 (clk_get_rate(&sys_ck) / 100000) % 10,
2061 (clk_get_rate(&dpll_ck) / 1000000),
2062 (clk_get_rate(&mpu_ck) / 1000000));
2063
2064 return 0;
2065}
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
new file mode 100644
index 000000000000..ea64ad606759
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -0,0 +1,961 @@
1/*
2 * AM33XX Clock data
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-private.h>
20#include <linux/clkdev.h>
21#include <linux/io.h>
22
23#include "am33xx.h"
24#include "soc.h"
25#include "iomap.h"
26#include "clock.h"
27#include "control.h"
28#include "cm.h"
29#include "cm33xx.h"
30#include "cm-regbits-33xx.h"
31#include "prm.h"
32
33/* Modulemode control */
34#define AM33XX_MODULEMODE_HWCTRL_SHIFT 0
35#define AM33XX_MODULEMODE_SWCTRL_SHIFT 1
36
37/*LIST_HEAD(clocks);*/
38
39/* Root clocks */
40
41/* RTC 32k */
42DEFINE_CLK_FIXED_RATE(clk_32768_ck, CLK_IS_ROOT, 32768, 0x0);
43
44/* On-Chip 32KHz RC OSC */
45DEFINE_CLK_FIXED_RATE(clk_rc32k_ck, CLK_IS_ROOT, 32000, 0x0);
46
47/* Crystal input clks */
48DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
49
50DEFINE_CLK_FIXED_RATE(virt_24000000_ck, CLK_IS_ROOT, 24000000, 0x0);
51
52DEFINE_CLK_FIXED_RATE(virt_25000000_ck, CLK_IS_ROOT, 25000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
55
56/* Oscillator clock */
57/* 19.2, 24, 25 or 26 MHz */
58static const char *sys_clkin_ck_parents[] = {
59 "virt_19200000_ck", "virt_24000000_ck", "virt_25000000_ck",
60 "virt_26000000_ck",
61};
62
63/*
64 * sys_clk in: input to the dpll and also used as funtional clock for,
65 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
66 *
67 */
68DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
69 AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
70 AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT,
71 AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH,
72 0, NULL);
73
74/* External clock - 12 MHz */
75DEFINE_CLK_FIXED_RATE(tclkin_ck, CLK_IS_ROOT, 12000000, 0x0);
76
77/* Module clocks and DPLL outputs */
78
79/* DPLL_CORE */
80static struct dpll_data dpll_core_dd = {
81 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
82 .clk_bypass = &sys_clkin_ck,
83 .clk_ref = &sys_clkin_ck,
84 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
85 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
86 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
87 .mult_mask = AM33XX_DPLL_MULT_MASK,
88 .div1_mask = AM33XX_DPLL_DIV_MASK,
89 .enable_mask = AM33XX_DPLL_EN_MASK,
90 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
91 .max_multiplier = 2047,
92 .max_divider = 128,
93 .min_divider = 1,
94};
95
96/* CLKDCOLDO output */
97static const char *dpll_core_ck_parents[] = {
98 "sys_clkin_ck",
99};
100
101static struct clk dpll_core_ck;
102
103static const struct clk_ops dpll_core_ck_ops = {
104 .recalc_rate = &omap3_dpll_recalc,
105 .get_parent = &omap2_init_dpll_parent,
106};
107
108static struct clk_hw_omap dpll_core_ck_hw = {
109 .hw = {
110 .clk = &dpll_core_ck,
111 },
112 .dpll_data = &dpll_core_dd,
113 .ops = &clkhwops_omap3_dpll,
114};
115
116DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
117
118static const char *dpll_core_x2_ck_parents[] = {
119 "dpll_core_ck",
120};
121
122static struct clk dpll_core_x2_ck;
123
124static const struct clk_ops dpll_x2_ck_ops = {
125 .recalc_rate = &omap3_clkoutx2_recalc,
126};
127
128static struct clk_hw_omap dpll_core_x2_ck_hw = {
129 .hw = {
130 .clk = &dpll_core_x2_ck,
131 },
132 .flags = CLOCK_CLKOUTX2,
133};
134
135DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_x2_ck_ops);
136
137DEFINE_CLK_DIVIDER(dpll_core_m4_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
138 0x0, AM33XX_CM_DIV_M4_DPLL_CORE,
139 AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT,
140 AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
141 NULL);
142
143DEFINE_CLK_DIVIDER(dpll_core_m5_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
144 0x0, AM33XX_CM_DIV_M5_DPLL_CORE,
145 AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT,
146 AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH,
147 CLK_DIVIDER_ONE_BASED, NULL);
148
149DEFINE_CLK_DIVIDER(dpll_core_m6_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
150 0x0, AM33XX_CM_DIV_M6_DPLL_CORE,
151 AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT,
152 AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH,
153 CLK_DIVIDER_ONE_BASED, NULL);
154
155
156/* DPLL_MPU */
157static struct dpll_data dpll_mpu_dd = {
158 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
159 .clk_bypass = &sys_clkin_ck,
160 .clk_ref = &sys_clkin_ck,
161 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
162 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
163 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
164 .mult_mask = AM33XX_DPLL_MULT_MASK,
165 .div1_mask = AM33XX_DPLL_DIV_MASK,
166 .enable_mask = AM33XX_DPLL_EN_MASK,
167 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
168 .max_multiplier = 2047,
169 .max_divider = 128,
170 .min_divider = 1,
171};
172
173/* CLKOUT: fdpll/M2 */
174static struct clk dpll_mpu_ck;
175
176static const struct clk_ops dpll_mpu_ck_ops = {
177 .enable = &omap3_noncore_dpll_enable,
178 .disable = &omap3_noncore_dpll_disable,
179 .recalc_rate = &omap3_dpll_recalc,
180 .round_rate = &omap2_dpll_round_rate,
181 .set_rate = &omap3_noncore_dpll_set_rate,
182 .get_parent = &omap2_init_dpll_parent,
183};
184
185static struct clk_hw_omap dpll_mpu_ck_hw = {
186 .hw = {
187 .clk = &dpll_mpu_ck,
188 },
189 .dpll_data = &dpll_mpu_dd,
190 .ops = &clkhwops_omap3_dpll,
191};
192
193DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_mpu_ck_ops);
194
195/*
196 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
197 * and ALT_CLK1/2)
198 */
199DEFINE_CLK_DIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck,
200 0x0, AM33XX_CM_DIV_M2_DPLL_MPU, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
201 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
202
203/* DPLL_DDR */
204static struct dpll_data dpll_ddr_dd = {
205 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
206 .clk_bypass = &sys_clkin_ck,
207 .clk_ref = &sys_clkin_ck,
208 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
209 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
210 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
211 .mult_mask = AM33XX_DPLL_MULT_MASK,
212 .div1_mask = AM33XX_DPLL_DIV_MASK,
213 .enable_mask = AM33XX_DPLL_EN_MASK,
214 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
215 .max_multiplier = 2047,
216 .max_divider = 128,
217 .min_divider = 1,
218};
219
220/* CLKOUT: fdpll/M2 */
221static struct clk dpll_ddr_ck;
222
223static const struct clk_ops dpll_ddr_ck_ops = {
224 .recalc_rate = &omap3_dpll_recalc,
225 .get_parent = &omap2_init_dpll_parent,
226 .round_rate = &omap2_dpll_round_rate,
227 .set_rate = &omap3_noncore_dpll_set_rate,
228};
229
230static struct clk_hw_omap dpll_ddr_ck_hw = {
231 .hw = {
232 .clk = &dpll_ddr_ck,
233 },
234 .dpll_data = &dpll_ddr_dd,
235 .ops = &clkhwops_omap3_dpll,
236};
237
238DEFINE_STRUCT_CLK(dpll_ddr_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
239
240/*
241 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
242 * and ALT_CLK1/2)
243 */
244DEFINE_CLK_DIVIDER(dpll_ddr_m2_ck, "dpll_ddr_ck", &dpll_ddr_ck,
245 0x0, AM33XX_CM_DIV_M2_DPLL_DDR,
246 AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
247 CLK_DIVIDER_ONE_BASED, NULL);
248
249/* emif_fck functional clock */
250DEFINE_CLK_FIXED_FACTOR(dpll_ddr_m2_div2_ck, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck,
251 0x0, 1, 2);
252
253/* DPLL_DISP */
254static struct dpll_data dpll_disp_dd = {
255 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
256 .clk_bypass = &sys_clkin_ck,
257 .clk_ref = &sys_clkin_ck,
258 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
259 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
260 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
261 .mult_mask = AM33XX_DPLL_MULT_MASK,
262 .div1_mask = AM33XX_DPLL_DIV_MASK,
263 .enable_mask = AM33XX_DPLL_EN_MASK,
264 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
265 .max_multiplier = 2047,
266 .max_divider = 128,
267 .min_divider = 1,
268};
269
270/* CLKOUT: fdpll/M2 */
271static struct clk dpll_disp_ck;
272
273static struct clk_hw_omap dpll_disp_ck_hw = {
274 .hw = {
275 .clk = &dpll_disp_ck,
276 },
277 .dpll_data = &dpll_disp_dd,
278 .ops = &clkhwops_omap3_dpll,
279};
280
281DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
282
283/*
284 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
285 * and ALT_CLK1/2)
286 */
287DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, "dpll_disp_ck", &dpll_disp_ck, 0x0,
288 AM33XX_CM_DIV_M2_DPLL_DISP, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
289 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
290
291/* DPLL_PER */
292static struct dpll_data dpll_per_dd = {
293 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
294 .clk_bypass = &sys_clkin_ck,
295 .clk_ref = &sys_clkin_ck,
296 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
297 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
298 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
299 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
300 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
301 .enable_mask = AM33XX_DPLL_EN_MASK,
302 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
303 .max_multiplier = 2047,
304 .max_divider = 128,
305 .min_divider = 1,
306 .flags = DPLL_J_TYPE,
307};
308
309/* CLKDCOLDO */
310static struct clk dpll_per_ck;
311
312static struct clk_hw_omap dpll_per_ck_hw = {
313 .hw = {
314 .clk = &dpll_per_ck,
315 },
316 .dpll_data = &dpll_per_dd,
317 .ops = &clkhwops_omap3_dpll,
318};
319
320DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
321
322/* CLKOUT: fdpll/M2 */
323DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
324 AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
325 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
326 NULL);
327
328DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
329 &dpll_per_m2_ck, 0x0, 1, 4);
330
331DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
332 &dpll_per_m2_ck, 0x0, 1, 4);
333
334DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
335 &dpll_core_m4_ck, 0x0, 1, 2);
336
337DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
338 1, 2);
339
340DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
341 8);
342
343/*
344 * Below clock nodes describes clockdomains derived out
345 * of core clock.
346 */
347static const struct clk_ops clk_ops_null = {
348};
349
350static const char *l3_gclk_parents[] = {
351 "dpll_core_m4_ck"
352};
353
354static struct clk l3_gclk;
355DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
356DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
357
358static struct clk l4hs_gclk;
359DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
360DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
361
362static const char *l3s_gclk_parents[] = {
363 "dpll_core_m4_div2_ck"
364};
365
366static struct clk l3s_gclk;
367DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
368DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
369
370static struct clk l4fw_gclk;
371DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
372DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
373
374static struct clk l4ls_gclk;
375DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
376DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
377
378static struct clk sysclk_div_ck;
379DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
380DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
381
382/*
383 * In order to match the clock domain with hwmod clockdomain entry,
384 * separate clock nodes is required for the modules which are
385 * directly getting their funtioncal clock from sys_clkin.
386 */
387static struct clk adc_tsc_fck;
388DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
389DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
390
391static struct clk dcan0_fck;
392DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
393DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
394
395static struct clk dcan1_fck;
396DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
397DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
398
399static struct clk mcasp0_fck;
400DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
401DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
402
403static struct clk mcasp1_fck;
404DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
405DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
406
407static struct clk smartreflex0_fck;
408DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
409DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
410
411static struct clk smartreflex1_fck;
412DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
413DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
414
415/*
416 * Modules clock nodes
417 *
418 * The following clock leaf nodes are added for the moment because:
419 *
420 * - hwmod data is not present for these modules, either hwmod
421 * control is not required or its not populated.
422 * - Driver code is not yet migrated to use hwmod/runtime pm
423 * - Modules outside kernel access (to disable them by default)
424 *
425 * - debugss
426 * - mmu (gfx domain)
427 * - cefuse
428 * - usbotg_fck (its additional clock and not really a modulemode)
429 * - ieee5000
430 */
431DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
432 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
433 0x0, NULL);
434
435DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
436 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
437 0x0, NULL);
438
439DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
440 AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
441 0x0, NULL);
442
443/*
444 * clkdiv32 is generated from fixed division of 732.4219
445 */
446DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
447
448DEFINE_CLK_GATE(clkdiv32k_ick, "clkdiv32k_ck", &clkdiv32k_ck, 0x0,
449 AM33XX_CM_PER_CLKDIV32K_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
450 0x0, NULL);
451
452/* "usbotg_fck" is an additional clock and not really a modulemode */
453DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
454 AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
455 0x0, NULL);
456
457DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
458 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
459 AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
460
461/* Timers */
462static const struct clksel timer1_clkmux_sel[] = {
463 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
464 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
465 { .parent = &tclkin_ck, .rates = div_1_2_rates },
466 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
467 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
468 { .parent = NULL },
469};
470
471static const char *timer1_ck_parents[] = {
472 "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
473 "clk_32768_ck",
474};
475
476static struct clk timer1_fck;
477
478static const struct clk_ops timer1_fck_ops = {
479 .recalc_rate = &omap2_clksel_recalc,
480 .get_parent = &omap2_clksel_find_parent_index,
481 .set_parent = &omap2_clksel_set_parent,
482 .init = &omap2_init_clk_clkdm,
483};
484
485static struct clk_hw_omap timer1_fck_hw = {
486 .hw = {
487 .clk = &timer1_fck,
488 },
489 .clkdm_name = "l4ls_clkdm",
490 .clksel = timer1_clkmux_sel,
491 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
492 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
493};
494
495DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
496
497static const struct clksel timer2_to_7_clk_sel[] = {
498 { .parent = &tclkin_ck, .rates = div_1_0_rates },
499 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
500 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
501 { .parent = NULL },
502};
503
504static const char *timer2_to_7_ck_parents[] = {
505 "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
506};
507
508static struct clk timer2_fck;
509
510static struct clk_hw_omap timer2_fck_hw = {
511 .hw = {
512 .clk = &timer2_fck,
513 },
514 .clkdm_name = "l4ls_clkdm",
515 .clksel = timer2_to_7_clk_sel,
516 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
517 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
518};
519
520DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
521
522static struct clk timer3_fck;
523
524static struct clk_hw_omap timer3_fck_hw = {
525 .hw = {
526 .clk = &timer3_fck,
527 },
528 .clkdm_name = "l4ls_clkdm",
529 .clksel = timer2_to_7_clk_sel,
530 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
531 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
532};
533
534DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
535
536static struct clk timer4_fck;
537
538static struct clk_hw_omap timer4_fck_hw = {
539 .hw = {
540 .clk = &timer4_fck,
541 },
542 .clkdm_name = "l4ls_clkdm",
543 .clksel = timer2_to_7_clk_sel,
544 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
545 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
546};
547
548DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
549
550static struct clk timer5_fck;
551
552static struct clk_hw_omap timer5_fck_hw = {
553 .hw = {
554 .clk = &timer5_fck,
555 },
556 .clkdm_name = "l4ls_clkdm",
557 .clksel = timer2_to_7_clk_sel,
558 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
559 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
560};
561
562DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
563
564static struct clk timer6_fck;
565
566static struct clk_hw_omap timer6_fck_hw = {
567 .hw = {
568 .clk = &timer6_fck,
569 },
570 .clkdm_name = "l4ls_clkdm",
571 .clksel = timer2_to_7_clk_sel,
572 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
573 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
574};
575
576DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
577
578static struct clk timer7_fck;
579
580static struct clk_hw_omap timer7_fck_hw = {
581 .hw = {
582 .clk = &timer7_fck,
583 },
584 .clkdm_name = "l4ls_clkdm",
585 .clksel = timer2_to_7_clk_sel,
586 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
587 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
588};
589
590DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
591
592DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
593 "dpll_core_m5_ck",
594 &dpll_core_m5_ck,
595 0x0,
596 1, 2);
597
598static const struct clk_ops cpsw_fck_ops = {
599 .recalc_rate = &omap2_clksel_recalc,
600 .get_parent = &omap2_clksel_find_parent_index,
601 .set_parent = &omap2_clksel_set_parent,
602};
603
604static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
605 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
606 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
607 { .parent = NULL },
608};
609
610static const char *cpsw_cpts_rft_ck_parents[] = {
611 "dpll_core_m5_ck", "dpll_core_m4_ck",
612};
613
614static struct clk cpsw_cpts_rft_clk;
615
616static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
617 .hw = {
618 .clk = &cpsw_cpts_rft_clk,
619 },
620 .clkdm_name = "cpsw_125mhz_clkdm",
621 .clksel = cpsw_cpts_rft_clkmux_sel,
622 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
623 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
624};
625
626DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
627
628
629/* gpio */
630static const char *gpio0_ck_parents[] = {
631 "clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
632};
633
634static const struct clksel gpio0_dbclk_mux_sel[] = {
635 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
636 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
637 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
638 { .parent = NULL },
639};
640
641static const struct clk_ops gpio_fck_ops = {
642 .recalc_rate = &omap2_clksel_recalc,
643 .get_parent = &omap2_clksel_find_parent_index,
644 .set_parent = &omap2_clksel_set_parent,
645 .init = &omap2_init_clk_clkdm,
646};
647
648static struct clk gpio0_dbclk_mux_ck;
649
650static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
651 .hw = {
652 .clk = &gpio0_dbclk_mux_ck,
653 },
654 .clkdm_name = "l4_wkup_clkdm",
655 .clksel = gpio0_dbclk_mux_sel,
656 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
657 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
658};
659
660DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
661
662DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
663 AM33XX_CM_WKUP_GPIO0_CLKCTRL,
664 AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
665
666DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
667 AM33XX_CM_PER_GPIO1_CLKCTRL,
668 AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
669
670DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
671 AM33XX_CM_PER_GPIO2_CLKCTRL,
672 AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
673
674DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
675 AM33XX_CM_PER_GPIO3_CLKCTRL,
676 AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
677
678
679static const char *pruss_ck_parents[] = {
680 "l3_gclk", "dpll_disp_m2_ck",
681};
682
683static const struct clksel pruss_ocp_clk_mux_sel[] = {
684 { .parent = &l3_gclk, .rates = div_1_0_rates },
685 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
686 { .parent = NULL },
687};
688
689static struct clk pruss_ocp_gclk;
690
691static struct clk_hw_omap pruss_ocp_gclk_hw = {
692 .hw = {
693 .clk = &pruss_ocp_gclk,
694 },
695 .clkdm_name = "pruss_ocp_clkdm",
696 .clksel = pruss_ocp_clk_mux_sel,
697 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
698 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
699};
700
701DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
702
703static const char *lcd_ck_parents[] = {
704 "dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
705};
706
707static const struct clksel lcd_clk_mux_sel[] = {
708 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
709 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
710 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
711 { .parent = NULL },
712};
713
714static struct clk lcd_gclk;
715
716static struct clk_hw_omap lcd_gclk_hw = {
717 .hw = {
718 .clk = &lcd_gclk,
719 },
720 .clkdm_name = "lcdc_clkdm",
721 .clksel = lcd_clk_mux_sel,
722 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
723 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
724};
725
726DEFINE_STRUCT_CLK(lcd_gclk, lcd_ck_parents, gpio_fck_ops);
727
728DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
729
730static const char *gfx_ck_parents[] = {
731 "dpll_core_m4_ck", "dpll_per_m2_ck",
732};
733
734static const struct clksel gfx_clksel_sel[] = {
735 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
736 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
737 { .parent = NULL },
738};
739
740static struct clk gfx_fclk_clksel_ck;
741
742static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
743 .hw = {
744 .clk = &gfx_fclk_clksel_ck,
745 },
746 .clksel = gfx_clksel_sel,
747 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
748 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
749};
750
751DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
752
753static const struct clk_div_table div_1_0_2_1_rates[] = {
754 { .div = 1, .val = 0, },
755 { .div = 2, .val = 1, },
756 { .div = 0 },
757};
758
759DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
760 &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
761 AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
762 0x0, div_1_0_2_1_rates, NULL);
763
764static const char *sysclkout_ck_parents[] = {
765 "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
766 "lcd_gclk",
767};
768
769static const struct clksel sysclkout_pre_sel[] = {
770 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
771 { .parent = &l3_gclk, .rates = div_1_1_rates },
772 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
773 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
774 { .parent = &lcd_gclk, .rates = div_1_4_rates },
775 { .parent = NULL },
776};
777
778static struct clk sysclkout_pre_ck;
779
780static struct clk_hw_omap sysclkout_pre_ck_hw = {
781 .hw = {
782 .clk = &sysclkout_pre_ck,
783 },
784 .clksel = sysclkout_pre_sel,
785 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
786 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
787};
788
789DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
790
791/* Divide by 8 clock rates with default clock is 1/1*/
792static const struct clk_div_table div8_rates[] = {
793 { .div = 1, .val = 0, },
794 { .div = 2, .val = 1, },
795 { .div = 3, .val = 2, },
796 { .div = 4, .val = 3, },
797 { .div = 5, .val = 4, },
798 { .div = 6, .val = 5, },
799 { .div = 7, .val = 6, },
800 { .div = 8, .val = 7, },
801 { .div = 0 },
802};
803
804DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
805 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
806 AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
807
808DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
809 AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
810
811static const char *wdt_ck_parents[] = {
812 "clk_rc32k_ck", "clkdiv32k_ick",
813};
814
815static const struct clksel wdt_clkmux_sel[] = {
816 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
817 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
818 { .parent = NULL },
819};
820
821static struct clk wdt1_fck;
822
823static struct clk_hw_omap wdt1_fck_hw = {
824 .hw = {
825 .clk = &wdt1_fck,
826 },
827 .clkdm_name = "l4_wkup_clkdm",
828 .clksel = wdt_clkmux_sel,
829 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
830 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
831};
832
833DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
834
835/*
836 * clkdev
837 */
838static struct omap_clk am33xx_clks[] = {
839 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
840 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
841 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
842 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
843 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
844 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
845 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
846 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
847 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
848 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
849 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
850 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
851 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
852 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
853 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
854 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
855 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
856 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
857 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
858 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
859 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
860 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
861 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
862 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
863 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
864 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
865 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
866 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck, CK_AM33XX),
867 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
868 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
869 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
870 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
871 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
872 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
873 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
874 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
875 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
876 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
877 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
878 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
879 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
880 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
881 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
882 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
883 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
884 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
885 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
886 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
887 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
888 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
889 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
890 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
891 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
892 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
893 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
894 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
895 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
896 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
897 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
898 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
899 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
900 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
901 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
902 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
903 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
904 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
905 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
906 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
907 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
908 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
909 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
910 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck, CK_AM33XX),
911 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
912 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
913};
914
915
916static const char *enable_init_clks[] = {
917 "dpll_ddr_m2_ck",
918 "dpll_mpu_m2_ck",
919 "l3_gclk",
920 "l4hs_gclk",
921 "l4fw_gclk",
922 "l4ls_gclk",
923};
924
925int __init am33xx_clk_init(void)
926{
927 struct omap_clk *c;
928 u32 cpu_clkflg;
929
930 if (soc_is_am33xx()) {
931 cpu_mask = RATE_IN_AM33XX;
932 cpu_clkflg = CK_AM33XX;
933 }
934
935 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
936 if (c->cpu & cpu_clkflg) {
937 clkdev_add(&c->lk);
938 if (!__clk_init(NULL, c->lk.clk))
939 omap2_init_clk_hw_omap_clocks(c->lk.clk);
940 }
941 }
942
943 omap2_clk_disable_autoidle_all();
944
945 omap2_clk_enable_init_clocks(enable_init_clks,
946 ARRAY_SIZE(enable_init_clks));
947
948 /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
949 * physically present, in such a case HWMOD enabling of
950 * clock would be failure with default parent. And timer
951 * probe thinks clock is already enabled, this leads to
952 * crash upon accessing timer 3 & 6 registers in probe.
953 * Fix by setting parent of both these timers to master
954 * oscillator clock.
955 */
956
957 clk_set_parent(&timer3_fck, &sys_clkin_ck);
958 clk_set_parent(&timer6_fck, &sys_clkin_ck);
959
960 return 0;
961}
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
new file mode 100644
index 000000000000..bdf39481fbd6
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -0,0 +1,3595 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * Updated to COMMON clk data format by Rajendra Nayak <rnayak@ti.com>
9 * With many device clock fixes by Kevin Hilman and Jouni Högander
10 * DPLL bypass clock support added by Roman Tereshonkov
11 *
12 */
13
14/*
15 * Virtual clocks are introduced as convenient tools.
16 * They are sources for other clocks and not supposed
17 * to be requested from drivers directly.
18 */
19
20#include <linux/kernel.h>
21#include <linux/clk.h>
22#include <linux/clk-private.h>
23#include <linux/list.h>
24#include <linux/io.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "clock.h"
29#include "clock3xxx.h"
30#include "clock34xx.h"
31#include "clock36xx.h"
32#include "clock3517.h"
33#include "cm3xxx.h"
34#include "cm-regbits-34xx.h"
35#include "prm3xxx.h"
36#include "prm-regbits-34xx.h"
37#include "control.h"
38
39/*
40 * clocks
41 */
42
43#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
44
45/* Maximum DPLL multiplier, divider values for OMAP3 */
46#define OMAP3_MAX_DPLL_MULT 2047
47#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
48#define OMAP3_MAX_DPLL_DIV 128
49
50DEFINE_CLK_FIXED_RATE(dummy_apb_pclk, CLK_IS_ROOT, 0x0, 0x0);
51
52DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
53
54DEFINE_CLK_FIXED_RATE(omap_32k_fck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(pclk_ck, CLK_IS_ROOT, 27000000, 0x0);
57
58DEFINE_CLK_FIXED_RATE(rmii_ck, CLK_IS_ROOT, 50000000, 0x0);
59
60DEFINE_CLK_FIXED_RATE(secure_32k_fck, CLK_IS_ROOT, 32768, 0x0);
61
62DEFINE_CLK_FIXED_RATE(sys_altclk, CLK_IS_ROOT, 0x0, 0x0);
63
64DEFINE_CLK_FIXED_RATE(virt_12m_ck, CLK_IS_ROOT, 12000000, 0x0);
65
66DEFINE_CLK_FIXED_RATE(virt_13m_ck, CLK_IS_ROOT, 13000000, 0x0);
67
68DEFINE_CLK_FIXED_RATE(virt_16_8m_ck, CLK_IS_ROOT, 16800000, 0x0);
69
70DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
71
72DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
73
74DEFINE_CLK_FIXED_RATE(virt_38_4m_ck, CLK_IS_ROOT, 38400000, 0x0);
75
76static const char *osc_sys_ck_parent_names[] = {
77 "virt_12m_ck", "virt_13m_ck", "virt_19200000_ck", "virt_26000000_ck",
78 "virt_38_4m_ck", "virt_16_8m_ck",
79};
80
81DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0,
82 OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT,
83 OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL);
84
85DEFINE_CLK_DIVIDER(sys_ck, "osc_sys_ck", &osc_sys_ck, 0x0,
86 OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT,
87 OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
88
89static struct dpll_data dpll3_dd = {
90 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
91 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
92 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
93 .clk_bypass = &sys_ck,
94 .clk_ref = &sys_ck,
95 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
96 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
97 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
98 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
99 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
100 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
101 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
102 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
103 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
104 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
105 .max_multiplier = OMAP3_MAX_DPLL_MULT,
106 .min_divider = 1,
107 .max_divider = OMAP3_MAX_DPLL_DIV,
108};
109
110static struct clk dpll3_ck;
111
112static const char *dpll3_ck_parent_names[] = {
113 "sys_ck",
114};
115
116static const struct clk_ops dpll3_ck_ops = {
117 .init = &omap2_init_clk_clkdm,
118 .get_parent = &omap2_init_dpll_parent,
119 .recalc_rate = &omap3_dpll_recalc,
120 .round_rate = &omap2_dpll_round_rate,
121};
122
123static struct clk_hw_omap dpll3_ck_hw = {
124 .hw = {
125 .clk = &dpll3_ck,
126 },
127 .ops = &clkhwops_omap3_dpll,
128 .dpll_data = &dpll3_dd,
129 .clkdm_name = "dpll3_clkdm",
130};
131
132DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops);
133
134DEFINE_CLK_DIVIDER(dpll3_m2_ck, "dpll3_ck", &dpll3_ck, 0x0,
135 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
136 OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT,
137 OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH,
138 CLK_DIVIDER_ONE_BASED, NULL);
139
140static struct clk core_ck;
141
142static const char *core_ck_parent_names[] = {
143 "dpll3_m2_ck",
144};
145
146static const struct clk_ops core_ck_ops = {};
147
148DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL);
149DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
150
151DEFINE_CLK_DIVIDER(l3_ick, "core_ck", &core_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
153 OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156DEFINE_CLK_DIVIDER(l4_ick, "l3_ick", &l3_ick, 0x0,
157 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
158 OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH,
159 CLK_DIVIDER_ONE_BASED, NULL);
160
161static struct clk security_l4_ick2;
162
163static const char *security_l4_ick2_parent_names[] = {
164 "l4_ick",
165};
166
167DEFINE_STRUCT_CLK_HW_OMAP(security_l4_ick2, NULL);
168DEFINE_STRUCT_CLK(security_l4_ick2, security_l4_ick2_parent_names, core_ck_ops);
169
170static struct clk aes1_ick;
171
172static const char *aes1_ick_parent_names[] = {
173 "security_l4_ick2",
174};
175
176static const struct clk_ops aes1_ick_ops = {
177 .enable = &omap2_dflt_clk_enable,
178 .disable = &omap2_dflt_clk_disable,
179 .is_enabled = &omap2_dflt_clk_is_enabled,
180};
181
182static struct clk_hw_omap aes1_ick_hw = {
183 .hw = {
184 .clk = &aes1_ick,
185 },
186 .ops = &clkhwops_iclk_wait,
187 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
188 .enable_bit = OMAP3430_EN_AES1_SHIFT,
189};
190
191DEFINE_STRUCT_CLK(aes1_ick, aes1_ick_parent_names, aes1_ick_ops);
192
193static struct clk core_l4_ick;
194
195static const struct clk_ops core_l4_ick_ops = {
196 .init = &omap2_init_clk_clkdm,
197};
198
199DEFINE_STRUCT_CLK_HW_OMAP(core_l4_ick, "core_l4_clkdm");
200DEFINE_STRUCT_CLK(core_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
201
202static struct clk aes2_ick;
203
204static const char *aes2_ick_parent_names[] = {
205 "core_l4_ick",
206};
207
208static const struct clk_ops aes2_ick_ops = {
209 .init = &omap2_init_clk_clkdm,
210 .enable = &omap2_dflt_clk_enable,
211 .disable = &omap2_dflt_clk_disable,
212 .is_enabled = &omap2_dflt_clk_is_enabled,
213};
214
215static struct clk_hw_omap aes2_ick_hw = {
216 .hw = {
217 .clk = &aes2_ick,
218 },
219 .ops = &clkhwops_iclk_wait,
220 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
221 .enable_bit = OMAP3430_EN_AES2_SHIFT,
222 .clkdm_name = "core_l4_clkdm",
223};
224
225DEFINE_STRUCT_CLK(aes2_ick, aes2_ick_parent_names, aes2_ick_ops);
226
227static struct clk dpll1_fck;
228
229static struct dpll_data dpll1_dd = {
230 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
231 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
232 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
233 .clk_bypass = &dpll1_fck,
234 .clk_ref = &sys_ck,
235 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
236 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
237 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
238 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
239 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
240 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
241 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
242 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
243 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
244 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
245 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
246 .max_multiplier = OMAP3_MAX_DPLL_MULT,
247 .min_divider = 1,
248 .max_divider = OMAP3_MAX_DPLL_DIV,
249};
250
251static struct clk dpll1_ck;
252
253static const struct clk_ops dpll1_ck_ops = {
254 .init = &omap2_init_clk_clkdm,
255 .enable = &omap3_noncore_dpll_enable,
256 .disable = &omap3_noncore_dpll_disable,
257 .get_parent = &omap2_init_dpll_parent,
258 .recalc_rate = &omap3_dpll_recalc,
259 .set_rate = &omap3_noncore_dpll_set_rate,
260 .round_rate = &omap2_dpll_round_rate,
261};
262
263static struct clk_hw_omap dpll1_ck_hw = {
264 .hw = {
265 .clk = &dpll1_ck,
266 },
267 .ops = &clkhwops_omap3_dpll,
268 .dpll_data = &dpll1_dd,
269 .clkdm_name = "dpll1_clkdm",
270};
271
272DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops);
273
274DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, "dpll1_ck", &dpll1_ck, 0x0, 2, 1);
275
276DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, "dpll1_x2_ck", &dpll1_x2_ck, 0x0,
277 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
278 OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT,
279 OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH,
280 CLK_DIVIDER_ONE_BASED, NULL);
281
282static struct clk mpu_ck;
283
284static const char *mpu_ck_parent_names[] = {
285 "dpll1_x2m2_ck",
286};
287
288DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, "mpu_clkdm");
289DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, core_l4_ick_ops);
290
291DEFINE_CLK_DIVIDER(arm_fck, "mpu_ck", &mpu_ck, 0x0,
292 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
293 OMAP3430_ST_MPU_CLK_SHIFT, OMAP3430_ST_MPU_CLK_WIDTH,
294 0x0, NULL);
295
296static struct clk cam_ick;
297
298static struct clk_hw_omap cam_ick_hw = {
299 .hw = {
300 .clk = &cam_ick,
301 },
302 .ops = &clkhwops_iclk,
303 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
304 .enable_bit = OMAP3430_EN_CAM_SHIFT,
305 .clkdm_name = "cam_clkdm",
306};
307
308DEFINE_STRUCT_CLK(cam_ick, security_l4_ick2_parent_names, aes2_ick_ops);
309
310/* DPLL4 */
311/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
312/* Type: DPLL */
313static struct dpll_data dpll4_dd;
314
315static struct dpll_data dpll4_dd_34xx __initdata = {
316 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
317 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
318 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
319 .clk_bypass = &sys_ck,
320 .clk_ref = &sys_ck,
321 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
322 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
323 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
324 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
325 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
326 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
327 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
328 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
329 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
330 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
331 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
332 .max_multiplier = OMAP3_MAX_DPLL_MULT,
333 .min_divider = 1,
334 .max_divider = OMAP3_MAX_DPLL_DIV,
335};
336
337static struct dpll_data dpll4_dd_3630 __initdata = {
338 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
339 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
340 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
341 .clk_bypass = &sys_ck,
342 .clk_ref = &sys_ck,
343 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
344 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
345 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
346 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
347 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
348 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
349 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
350 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
351 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
352 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
353 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
354 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
355 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
356 .min_divider = 1,
357 .max_divider = OMAP3_MAX_DPLL_DIV,
358 .flags = DPLL_J_TYPE
359};
360
361static struct clk dpll4_ck;
362
363static const struct clk_ops dpll4_ck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap3_noncore_dpll_enable,
366 .disable = &omap3_noncore_dpll_disable,
367 .get_parent = &omap2_init_dpll_parent,
368 .recalc_rate = &omap3_dpll_recalc,
369 .set_rate = &omap3_dpll4_set_rate,
370 .round_rate = &omap2_dpll_round_rate,
371};
372
373static struct clk_hw_omap dpll4_ck_hw = {
374 .hw = {
375 .clk = &dpll4_ck,
376 },
377 .dpll_data = &dpll4_dd,
378 .ops = &clkhwops_omap3_dpll,
379 .clkdm_name = "dpll4_clkdm",
380};
381
382DEFINE_STRUCT_CLK(dpll4_ck, dpll3_ck_parent_names, dpll4_ck_ops);
383
384DEFINE_CLK_DIVIDER(dpll4_m5_ck, "dpll4_ck", &dpll4_ck, 0x0,
385 OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
386 OMAP3430_CLKSEL_CAM_SHIFT, OMAP3630_CLKSEL_CAM_WIDTH,
387 CLK_DIVIDER_ONE_BASED, NULL);
388
389static struct clk dpll4_m5x2_ck;
390
391static const char *dpll4_m5x2_ck_parent_names[] = {
392 "dpll4_m5_ck",
393};
394
395static const struct clk_ops dpll4_m5x2_ck_ops = {
396 .init = &omap2_init_clk_clkdm,
397 .enable = &omap2_dflt_clk_enable,
398 .disable = &omap2_dflt_clk_disable,
399 .is_enabled = &omap2_dflt_clk_is_enabled,
400 .recalc_rate = &omap3_clkoutx2_recalc,
401};
402
403static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
404 .init = &omap2_init_clk_clkdm,
405 .enable = &omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
406 .disable = &omap2_dflt_clk_disable,
407 .recalc_rate = &omap3_clkoutx2_recalc,
408};
409
410static struct clk_hw_omap dpll4_m5x2_ck_hw = {
411 .hw = {
412 .clk = &dpll4_m5x2_ck,
413 },
414 .ops = &clkhwops_wait,
415 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
416 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
417 .flags = INVERT_ENABLE,
418 .clkdm_name = "dpll4_clkdm",
419};
420
421DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops);
422
423static struct clk dpll4_m5x2_ck_3630 = {
424 .name = "dpll4_m5x2_ck",
425 .hw = &dpll4_m5x2_ck_hw.hw,
426 .parent_names = dpll4_m5x2_ck_parent_names,
427 .num_parents = ARRAY_SIZE(dpll4_m5x2_ck_parent_names),
428 .ops = &dpll4_m5x2_ck_3630_ops,
429};
430
431static struct clk cam_mclk;
432
433static const char *cam_mclk_parent_names[] = {
434 "dpll4_m5x2_ck",
435};
436
437static struct clk_hw_omap cam_mclk_hw = {
438 .hw = {
439 .clk = &cam_mclk,
440 },
441 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
442 .enable_bit = OMAP3430_EN_CAM_SHIFT,
443 .clkdm_name = "cam_clkdm",
444};
445
446DEFINE_STRUCT_CLK(cam_mclk, cam_mclk_parent_names, aes2_ick_ops);
447
448static const struct clksel_rate clkout2_src_core_rates[] = {
449 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
450 { .div = 0 }
451};
452
453static const struct clksel_rate clkout2_src_sys_rates[] = {
454 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
455 { .div = 0 }
456};
457
458static const struct clksel_rate clkout2_src_96m_rates[] = {
459 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
460 { .div = 0 }
461};
462
463DEFINE_CLK_DIVIDER(dpll4_m2_ck, "dpll4_ck", &dpll4_ck, 0x0,
464 OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
465 OMAP3430_DIV_96M_SHIFT, OMAP3630_DIV_96M_WIDTH,
466 CLK_DIVIDER_ONE_BASED, NULL);
467
468static struct clk dpll4_m2x2_ck;
469
470static const char *dpll4_m2x2_ck_parent_names[] = {
471 "dpll4_m2_ck",
472};
473
474static struct clk_hw_omap dpll4_m2x2_ck_hw = {
475 .hw = {
476 .clk = &dpll4_m2x2_ck,
477 },
478 .ops = &clkhwops_wait,
479 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
480 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
481 .flags = INVERT_ENABLE,
482 .clkdm_name = "dpll4_clkdm",
483};
484
485DEFINE_STRUCT_CLK(dpll4_m2x2_ck, dpll4_m2x2_ck_parent_names, dpll4_m5x2_ck_ops);
486
487static struct clk dpll4_m2x2_ck_3630 = {
488 .name = "dpll4_m2x2_ck",
489 .hw = &dpll4_m2x2_ck_hw.hw,
490 .parent_names = dpll4_m2x2_ck_parent_names,
491 .num_parents = ARRAY_SIZE(dpll4_m2x2_ck_parent_names),
492 .ops = &dpll4_m5x2_ck_3630_ops,
493};
494
495static struct clk omap_96m_alwon_fck;
496
497static const char *omap_96m_alwon_fck_parent_names[] = {
498 "dpll4_m2x2_ck",
499};
500
501DEFINE_STRUCT_CLK_HW_OMAP(omap_96m_alwon_fck, NULL);
502DEFINE_STRUCT_CLK(omap_96m_alwon_fck, omap_96m_alwon_fck_parent_names,
503 core_ck_ops);
504
505static struct clk cm_96m_fck;
506
507static const char *cm_96m_fck_parent_names[] = {
508 "omap_96m_alwon_fck",
509};
510
511DEFINE_STRUCT_CLK_HW_OMAP(cm_96m_fck, NULL);
512DEFINE_STRUCT_CLK(cm_96m_fck, cm_96m_fck_parent_names, core_ck_ops);
513
514static const struct clksel_rate clkout2_src_54m_rates[] = {
515 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
516 { .div = 0 }
517};
518
519DEFINE_CLK_DIVIDER(dpll4_m3_ck, "dpll4_ck", &dpll4_ck, 0x0,
520 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
521 OMAP3430_CLKSEL_TV_SHIFT, OMAP3630_CLKSEL_TV_WIDTH,
522 CLK_DIVIDER_ONE_BASED, NULL);
523
524static struct clk dpll4_m3x2_ck;
525
526static const char *dpll4_m3x2_ck_parent_names[] = {
527 "dpll4_m3_ck",
528};
529
530static struct clk_hw_omap dpll4_m3x2_ck_hw = {
531 .hw = {
532 .clk = &dpll4_m3x2_ck,
533 },
534 .ops = &clkhwops_wait,
535 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
536 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
537 .flags = INVERT_ENABLE,
538 .clkdm_name = "dpll4_clkdm",
539};
540
541DEFINE_STRUCT_CLK(dpll4_m3x2_ck, dpll4_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
542
543static struct clk dpll4_m3x2_ck_3630 = {
544 .name = "dpll4_m3x2_ck",
545 .hw = &dpll4_m3x2_ck_hw.hw,
546 .parent_names = dpll4_m3x2_ck_parent_names,
547 .num_parents = ARRAY_SIZE(dpll4_m3x2_ck_parent_names),
548 .ops = &dpll4_m5x2_ck_3630_ops,
549};
550
551static const char *omap_54m_fck_parent_names[] = {
552 "dpll4_m3x2_ck", "sys_altclk",
553};
554
555DEFINE_CLK_MUX(omap_54m_fck, omap_54m_fck_parent_names, NULL, 0x0,
556 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP3430_SOURCE_54M_SHIFT,
557 OMAP3430_SOURCE_54M_WIDTH, 0x0, NULL);
558
559static const struct clksel clkout2_src_clksel[] = {
560 { .parent = &core_ck, .rates = clkout2_src_core_rates },
561 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
562 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
563 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
564 { .parent = NULL },
565};
566
567static const char *clkout2_src_ck_parent_names[] = {
568 "core_ck", "sys_ck", "cm_96m_fck", "omap_54m_fck",
569};
570
571static const struct clk_ops clkout2_src_ck_ops = {
572 .init = &omap2_init_clk_clkdm,
573 .enable = &omap2_dflt_clk_enable,
574 .disable = &omap2_dflt_clk_disable,
575 .is_enabled = &omap2_dflt_clk_is_enabled,
576 .recalc_rate = &omap2_clksel_recalc,
577 .get_parent = &omap2_clksel_find_parent_index,
578 .set_parent = &omap2_clksel_set_parent,
579};
580
581DEFINE_CLK_OMAP_MUX_GATE(clkout2_src_ck, "core_clkdm",
582 clkout2_src_clksel, OMAP3430_CM_CLKOUT_CTRL,
583 OMAP3430_CLKOUT2SOURCE_MASK,
584 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_EN_SHIFT,
585 NULL, clkout2_src_ck_parent_names, clkout2_src_ck_ops);
586
587static const struct clksel_rate omap_48m_cm96m_rates[] = {
588 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
589 { .div = 0 }
590};
591
592static const struct clksel_rate omap_48m_alt_rates[] = {
593 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
594 { .div = 0 }
595};
596
597static const struct clksel omap_48m_clksel[] = {
598 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
599 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
600 { .parent = NULL },
601};
602
603static const char *omap_48m_fck_parent_names[] = {
604 "cm_96m_fck", "sys_altclk",
605};
606
607static struct clk omap_48m_fck;
608
609static const struct clk_ops omap_48m_fck_ops = {
610 .recalc_rate = &omap2_clksel_recalc,
611 .get_parent = &omap2_clksel_find_parent_index,
612 .set_parent = &omap2_clksel_set_parent,
613};
614
615static struct clk_hw_omap omap_48m_fck_hw = {
616 .hw = {
617 .clk = &omap_48m_fck,
618 },
619 .clksel = omap_48m_clksel,
620 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
621 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
622};
623
624DEFINE_STRUCT_CLK(omap_48m_fck, omap_48m_fck_parent_names, omap_48m_fck_ops);
625
626DEFINE_CLK_FIXED_FACTOR(omap_12m_fck, "omap_48m_fck", &omap_48m_fck, 0x0, 1, 4);
627
628static struct clk core_12m_fck;
629
630static const char *core_12m_fck_parent_names[] = {
631 "omap_12m_fck",
632};
633
634DEFINE_STRUCT_CLK_HW_OMAP(core_12m_fck, "core_l4_clkdm");
635DEFINE_STRUCT_CLK(core_12m_fck, core_12m_fck_parent_names, core_l4_ick_ops);
636
637static struct clk core_48m_fck;
638
639static const char *core_48m_fck_parent_names[] = {
640 "omap_48m_fck",
641};
642
643DEFINE_STRUCT_CLK_HW_OMAP(core_48m_fck, "core_l4_clkdm");
644DEFINE_STRUCT_CLK(core_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
645
646static const char *omap_96m_fck_parent_names[] = {
647 "cm_96m_fck", "sys_ck",
648};
649
650DEFINE_CLK_MUX(omap_96m_fck, omap_96m_fck_parent_names, NULL, 0x0,
651 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
652 OMAP3430_SOURCE_96M_SHIFT, OMAP3430_SOURCE_96M_WIDTH, 0x0, NULL);
653
654static struct clk core_96m_fck;
655
656static const char *core_96m_fck_parent_names[] = {
657 "omap_96m_fck",
658};
659
660DEFINE_STRUCT_CLK_HW_OMAP(core_96m_fck, "core_l4_clkdm");
661DEFINE_STRUCT_CLK(core_96m_fck, core_96m_fck_parent_names, core_l4_ick_ops);
662
663static struct clk core_l3_ick;
664
665static const char *core_l3_ick_parent_names[] = {
666 "l3_ick",
667};
668
669DEFINE_STRUCT_CLK_HW_OMAP(core_l3_ick, "core_l3_clkdm");
670DEFINE_STRUCT_CLK(core_l3_ick, core_l3_ick_parent_names, core_l4_ick_ops);
671
672DEFINE_CLK_FIXED_FACTOR(dpll3_m2x2_ck, "dpll3_m2_ck", &dpll3_m2_ck, 0x0, 2, 1);
673
674static struct clk corex2_fck;
675
676static const char *corex2_fck_parent_names[] = {
677 "dpll3_m2x2_ck",
678};
679
680DEFINE_STRUCT_CLK_HW_OMAP(corex2_fck, NULL);
681DEFINE_STRUCT_CLK(corex2_fck, corex2_fck_parent_names, core_ck_ops);
682
683static struct clk cpefuse_fck;
684
685static struct clk_hw_omap cpefuse_fck_hw = {
686 .hw = {
687 .clk = &cpefuse_fck,
688 },
689 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
690 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
691 .clkdm_name = "core_l4_clkdm",
692};
693
694DEFINE_STRUCT_CLK(cpefuse_fck, dpll3_ck_parent_names, aes2_ick_ops);
695
696static struct clk csi2_96m_fck;
697
698static const char *csi2_96m_fck_parent_names[] = {
699 "core_96m_fck",
700};
701
702static struct clk_hw_omap csi2_96m_fck_hw = {
703 .hw = {
704 .clk = &csi2_96m_fck,
705 },
706 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
707 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
708 .clkdm_name = "cam_clkdm",
709};
710
711DEFINE_STRUCT_CLK(csi2_96m_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
712
713static struct clk d2d_26m_fck;
714
715static struct clk_hw_omap d2d_26m_fck_hw = {
716 .hw = {
717 .clk = &d2d_26m_fck,
718 },
719 .ops = &clkhwops_wait,
720 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
721 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
722 .clkdm_name = "d2d_clkdm",
723};
724
725DEFINE_STRUCT_CLK(d2d_26m_fck, dpll3_ck_parent_names, aes2_ick_ops);
726
727static struct clk des1_ick;
728
729static struct clk_hw_omap des1_ick_hw = {
730 .hw = {
731 .clk = &des1_ick,
732 },
733 .ops = &clkhwops_iclk_wait,
734 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
735 .enable_bit = OMAP3430_EN_DES1_SHIFT,
736};
737
738DEFINE_STRUCT_CLK(des1_ick, aes1_ick_parent_names, aes1_ick_ops);
739
740static struct clk des2_ick;
741
742static struct clk_hw_omap des2_ick_hw = {
743 .hw = {
744 .clk = &des2_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
748 .enable_bit = OMAP3430_EN_DES2_SHIFT,
749 .clkdm_name = "core_l4_clkdm",
750};
751
752DEFINE_STRUCT_CLK(des2_ick, aes2_ick_parent_names, aes2_ick_ops);
753
754DEFINE_CLK_DIVIDER(dpll1_fck, "core_ck", &core_ck, 0x0,
755 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
756 OMAP3430_MPU_CLK_SRC_SHIFT, OMAP3430_MPU_CLK_SRC_WIDTH,
757 CLK_DIVIDER_ONE_BASED, NULL);
758
759static struct clk dpll2_fck;
760
761static struct dpll_data dpll2_dd = {
762 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
763 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
764 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
765 .clk_bypass = &dpll2_fck,
766 .clk_ref = &sys_ck,
767 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
768 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
769 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
770 .modes = ((1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
771 (1 << DPLL_LOW_POWER_BYPASS)),
772 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
773 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
774 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
775 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
776 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
777 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
778 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
779 .max_multiplier = OMAP3_MAX_DPLL_MULT,
780 .min_divider = 1,
781 .max_divider = OMAP3_MAX_DPLL_DIV,
782};
783
784static struct clk dpll2_ck;
785
786static struct clk_hw_omap dpll2_ck_hw = {
787 .hw = {
788 .clk = &dpll2_ck,
789 },
790 .ops = &clkhwops_omap3_dpll,
791 .dpll_data = &dpll2_dd,
792 .clkdm_name = "dpll2_clkdm",
793};
794
795DEFINE_STRUCT_CLK(dpll2_ck, dpll3_ck_parent_names, dpll1_ck_ops);
796
797DEFINE_CLK_DIVIDER(dpll2_fck, "core_ck", &core_ck, 0x0,
798 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
799 OMAP3430_IVA2_CLK_SRC_SHIFT, OMAP3430_IVA2_CLK_SRC_WIDTH,
800 CLK_DIVIDER_ONE_BASED, NULL);
801
802DEFINE_CLK_DIVIDER(dpll2_m2_ck, "dpll2_ck", &dpll2_ck, 0x0,
803 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL2_PLL),
804 OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT,
805 OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH,
806 CLK_DIVIDER_ONE_BASED, NULL);
807
808DEFINE_CLK_DIVIDER(dpll3_m3_ck, "dpll3_ck", &dpll3_ck, 0x0,
809 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
810 OMAP3430_DIV_DPLL3_SHIFT, OMAP3430_DIV_DPLL3_WIDTH,
811 CLK_DIVIDER_ONE_BASED, NULL);
812
813static struct clk dpll3_m3x2_ck;
814
815static const char *dpll3_m3x2_ck_parent_names[] = {
816 "dpll3_m3_ck",
817};
818
819static struct clk_hw_omap dpll3_m3x2_ck_hw = {
820 .hw = {
821 .clk = &dpll3_m3x2_ck,
822 },
823 .ops = &clkhwops_wait,
824 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
825 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
826 .flags = INVERT_ENABLE,
827 .clkdm_name = "dpll3_clkdm",
828};
829
830DEFINE_STRUCT_CLK(dpll3_m3x2_ck, dpll3_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
831
832static struct clk dpll3_m3x2_ck_3630 = {
833 .name = "dpll3_m3x2_ck",
834 .hw = &dpll3_m3x2_ck_hw.hw,
835 .parent_names = dpll3_m3x2_ck_parent_names,
836 .num_parents = ARRAY_SIZE(dpll3_m3x2_ck_parent_names),
837 .ops = &dpll4_m5x2_ck_3630_ops,
838};
839
840DEFINE_CLK_FIXED_FACTOR(dpll3_x2_ck, "dpll3_ck", &dpll3_ck, 0x0, 2, 1);
841
842DEFINE_CLK_DIVIDER(dpll4_m4_ck, "dpll4_ck", &dpll4_ck, 0x0,
843 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
844 OMAP3430_CLKSEL_DSS1_SHIFT, OMAP3630_CLKSEL_DSS1_WIDTH,
845 CLK_DIVIDER_ONE_BASED, NULL);
846
847static struct clk dpll4_m4x2_ck;
848
849static const char *dpll4_m4x2_ck_parent_names[] = {
850 "dpll4_m4_ck",
851};
852
853static struct clk_hw_omap dpll4_m4x2_ck_hw = {
854 .hw = {
855 .clk = &dpll4_m4x2_ck,
856 },
857 .ops = &clkhwops_wait,
858 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
859 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
860 .flags = INVERT_ENABLE,
861 .clkdm_name = "dpll4_clkdm",
862};
863
864DEFINE_STRUCT_CLK(dpll4_m4x2_ck, dpll4_m4x2_ck_parent_names, dpll4_m5x2_ck_ops);
865
866static struct clk dpll4_m4x2_ck_3630 = {
867 .name = "dpll4_m4x2_ck",
868 .hw = &dpll4_m4x2_ck_hw.hw,
869 .parent_names = dpll4_m4x2_ck_parent_names,
870 .num_parents = ARRAY_SIZE(dpll4_m4x2_ck_parent_names),
871 .ops = &dpll4_m5x2_ck_3630_ops,
872};
873
874DEFINE_CLK_DIVIDER(dpll4_m6_ck, "dpll4_ck", &dpll4_ck, 0x0,
875 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
876 OMAP3430_DIV_DPLL4_SHIFT, OMAP3630_DIV_DPLL4_WIDTH,
877 CLK_DIVIDER_ONE_BASED, NULL);
878
879static struct clk dpll4_m6x2_ck;
880
881static const char *dpll4_m6x2_ck_parent_names[] = {
882 "dpll4_m6_ck",
883};
884
885static struct clk_hw_omap dpll4_m6x2_ck_hw = {
886 .hw = {
887 .clk = &dpll4_m6x2_ck,
888 },
889 .ops = &clkhwops_wait,
890 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
891 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
892 .flags = INVERT_ENABLE,
893 .clkdm_name = "dpll4_clkdm",
894};
895
896DEFINE_STRUCT_CLK(dpll4_m6x2_ck, dpll4_m6x2_ck_parent_names, dpll4_m5x2_ck_ops);
897
898static struct clk dpll4_m6x2_ck_3630 = {
899 .name = "dpll4_m6x2_ck",
900 .hw = &dpll4_m6x2_ck_hw.hw,
901 .parent_names = dpll4_m6x2_ck_parent_names,
902 .num_parents = ARRAY_SIZE(dpll4_m6x2_ck_parent_names),
903 .ops = &dpll4_m5x2_ck_3630_ops,
904};
905
906DEFINE_CLK_FIXED_FACTOR(dpll4_x2_ck, "dpll4_ck", &dpll4_ck, 0x0, 2, 1);
907
908static struct dpll_data dpll5_dd = {
909 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
910 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
911 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
912 .clk_bypass = &sys_ck,
913 .clk_ref = &sys_ck,
914 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
915 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
916 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
917 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
918 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
919 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
920 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
921 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
922 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
923 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
924 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
925 .max_multiplier = OMAP3_MAX_DPLL_MULT,
926 .min_divider = 1,
927 .max_divider = OMAP3_MAX_DPLL_DIV,
928};
929
930static struct clk dpll5_ck;
931
932static struct clk_hw_omap dpll5_ck_hw = {
933 .hw = {
934 .clk = &dpll5_ck,
935 },
936 .ops = &clkhwops_omap3_dpll,
937 .dpll_data = &dpll5_dd,
938 .clkdm_name = "dpll5_clkdm",
939};
940
941DEFINE_STRUCT_CLK(dpll5_ck, dpll3_ck_parent_names, dpll1_ck_ops);
942
943DEFINE_CLK_DIVIDER(dpll5_m2_ck, "dpll5_ck", &dpll5_ck, 0x0,
944 OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
945 OMAP3430ES2_DIV_120M_SHIFT, OMAP3430ES2_DIV_120M_WIDTH,
946 CLK_DIVIDER_ONE_BASED, NULL);
947
948static struct clk dss1_alwon_fck_3430es1;
949
950static const char *dss1_alwon_fck_3430es1_parent_names[] = {
951 "dpll4_m4x2_ck",
952};
953
954static struct clk_hw_omap dss1_alwon_fck_3430es1_hw = {
955 .hw = {
956 .clk = &dss1_alwon_fck_3430es1,
957 },
958 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
959 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
960 .clkdm_name = "dss_clkdm",
961};
962
963DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es1, dss1_alwon_fck_3430es1_parent_names,
964 aes2_ick_ops);
965
966static struct clk dss1_alwon_fck_3430es2;
967
968static struct clk_hw_omap dss1_alwon_fck_3430es2_hw = {
969 .hw = {
970 .clk = &dss1_alwon_fck_3430es2,
971 },
972 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
973 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
974 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
975 .clkdm_name = "dss_clkdm",
976};
977
978DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es2, dss1_alwon_fck_3430es1_parent_names,
979 aes2_ick_ops);
980
981static struct clk dss2_alwon_fck;
982
983static struct clk_hw_omap dss2_alwon_fck_hw = {
984 .hw = {
985 .clk = &dss2_alwon_fck,
986 },
987 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
988 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
989 .clkdm_name = "dss_clkdm",
990};
991
992DEFINE_STRUCT_CLK(dss2_alwon_fck, dpll3_ck_parent_names, aes2_ick_ops);
993
994static struct clk dss_96m_fck;
995
996static struct clk_hw_omap dss_96m_fck_hw = {
997 .hw = {
998 .clk = &dss_96m_fck,
999 },
1000 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1001 .enable_bit = OMAP3430_EN_TV_SHIFT,
1002 .clkdm_name = "dss_clkdm",
1003};
1004
1005DEFINE_STRUCT_CLK(dss_96m_fck, core_96m_fck_parent_names, aes2_ick_ops);
1006
1007static struct clk dss_ick_3430es1;
1008
1009static struct clk_hw_omap dss_ick_3430es1_hw = {
1010 .hw = {
1011 .clk = &dss_ick_3430es1,
1012 },
1013 .ops = &clkhwops_iclk,
1014 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1015 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1016 .clkdm_name = "dss_clkdm",
1017};
1018
1019DEFINE_STRUCT_CLK(dss_ick_3430es1, security_l4_ick2_parent_names, aes2_ick_ops);
1020
1021static struct clk dss_ick_3430es2;
1022
1023static struct clk_hw_omap dss_ick_3430es2_hw = {
1024 .hw = {
1025 .clk = &dss_ick_3430es2,
1026 },
1027 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
1028 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1029 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1030 .clkdm_name = "dss_clkdm",
1031};
1032
1033DEFINE_STRUCT_CLK(dss_ick_3430es2, security_l4_ick2_parent_names, aes2_ick_ops);
1034
1035static struct clk dss_tv_fck;
1036
1037static const char *dss_tv_fck_parent_names[] = {
1038 "omap_54m_fck",
1039};
1040
1041static struct clk_hw_omap dss_tv_fck_hw = {
1042 .hw = {
1043 .clk = &dss_tv_fck,
1044 },
1045 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1046 .enable_bit = OMAP3430_EN_TV_SHIFT,
1047 .clkdm_name = "dss_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(dss_tv_fck, dss_tv_fck_parent_names, aes2_ick_ops);
1051
1052static struct clk emac_fck;
1053
1054static const char *emac_fck_parent_names[] = {
1055 "rmii_ck",
1056};
1057
1058static struct clk_hw_omap emac_fck_hw = {
1059 .hw = {
1060 .clk = &emac_fck,
1061 },
1062 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1063 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
1064};
1065
1066DEFINE_STRUCT_CLK(emac_fck, emac_fck_parent_names, aes1_ick_ops);
1067
1068static struct clk ipss_ick;
1069
1070static const char *ipss_ick_parent_names[] = {
1071 "core_l3_ick",
1072};
1073
1074static struct clk_hw_omap ipss_ick_hw = {
1075 .hw = {
1076 .clk = &ipss_ick,
1077 },
1078 .ops = &clkhwops_am35xx_ipss_wait,
1079 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1080 .enable_bit = AM35XX_EN_IPSS_SHIFT,
1081 .clkdm_name = "core_l3_clkdm",
1082};
1083
1084DEFINE_STRUCT_CLK(ipss_ick, ipss_ick_parent_names, aes2_ick_ops);
1085
1086static struct clk emac_ick;
1087
1088static const char *emac_ick_parent_names[] = {
1089 "ipss_ick",
1090};
1091
1092static struct clk_hw_omap emac_ick_hw = {
1093 .hw = {
1094 .clk = &emac_ick,
1095 },
1096 .ops = &clkhwops_am35xx_ipss_module_wait,
1097 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1098 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
1099 .clkdm_name = "core_l3_clkdm",
1100};
1101
1102DEFINE_STRUCT_CLK(emac_ick, emac_ick_parent_names, aes2_ick_ops);
1103
1104static struct clk emu_core_alwon_ck;
1105
1106static const char *emu_core_alwon_ck_parent_names[] = {
1107 "dpll3_m3x2_ck",
1108};
1109
1110DEFINE_STRUCT_CLK_HW_OMAP(emu_core_alwon_ck, "dpll3_clkdm");
1111DEFINE_STRUCT_CLK(emu_core_alwon_ck, emu_core_alwon_ck_parent_names,
1112 core_l4_ick_ops);
1113
1114static struct clk emu_mpu_alwon_ck;
1115
1116static const char *emu_mpu_alwon_ck_parent_names[] = {
1117 "mpu_ck",
1118};
1119
1120DEFINE_STRUCT_CLK_HW_OMAP(emu_mpu_alwon_ck, NULL);
1121DEFINE_STRUCT_CLK(emu_mpu_alwon_ck, emu_mpu_alwon_ck_parent_names, core_ck_ops);
1122
1123static struct clk emu_per_alwon_ck;
1124
1125static const char *emu_per_alwon_ck_parent_names[] = {
1126 "dpll4_m6x2_ck",
1127};
1128
1129DEFINE_STRUCT_CLK_HW_OMAP(emu_per_alwon_ck, "dpll4_clkdm");
1130DEFINE_STRUCT_CLK(emu_per_alwon_ck, emu_per_alwon_ck_parent_names,
1131 core_l4_ick_ops);
1132
1133static const char *emu_src_ck_parent_names[] = {
1134 "sys_ck", "emu_core_alwon_ck", "emu_per_alwon_ck", "emu_mpu_alwon_ck",
1135};
1136
1137static const struct clksel_rate emu_src_sys_rates[] = {
1138 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1139 { .div = 0 },
1140};
1141
1142static const struct clksel_rate emu_src_core_rates[] = {
1143 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1144 { .div = 0 },
1145};
1146
1147static const struct clksel_rate emu_src_per_rates[] = {
1148 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
1149 { .div = 0 },
1150};
1151
1152static const struct clksel_rate emu_src_mpu_rates[] = {
1153 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1154 { .div = 0 },
1155};
1156
1157static const struct clksel emu_src_clksel[] = {
1158 { .parent = &sys_ck, .rates = emu_src_sys_rates },
1159 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
1160 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
1161 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
1162 { .parent = NULL },
1163};
1164
1165static const struct clk_ops emu_src_ck_ops = {
1166 .init = &omap2_init_clk_clkdm,
1167 .recalc_rate = &omap2_clksel_recalc,
1168 .get_parent = &omap2_clksel_find_parent_index,
1169 .set_parent = &omap2_clksel_set_parent,
1170};
1171
1172static struct clk emu_src_ck;
1173
1174static struct clk_hw_omap emu_src_ck_hw = {
1175 .hw = {
1176 .clk = &emu_src_ck,
1177 },
1178 .clksel = emu_src_clksel,
1179 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1180 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
1181 .clkdm_name = "emu_clkdm",
1182};
1183
1184DEFINE_STRUCT_CLK(emu_src_ck, emu_src_ck_parent_names, emu_src_ck_ops);
1185
1186DEFINE_CLK_DIVIDER(atclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
1187 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1188 OMAP3430_CLKSEL_ATCLK_SHIFT, OMAP3430_CLKSEL_ATCLK_WIDTH,
1189 CLK_DIVIDER_ONE_BASED, NULL);
1190
1191static struct clk fac_ick;
1192
1193static struct clk_hw_omap fac_ick_hw = {
1194 .hw = {
1195 .clk = &fac_ick,
1196 },
1197 .ops = &clkhwops_iclk_wait,
1198 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1199 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
1200 .clkdm_name = "core_l4_clkdm",
1201};
1202
1203DEFINE_STRUCT_CLK(fac_ick, aes2_ick_parent_names, aes2_ick_ops);
1204
1205static struct clk fshostusb_fck;
1206
1207static const char *fshostusb_fck_parent_names[] = {
1208 "core_48m_fck",
1209};
1210
1211static struct clk_hw_omap fshostusb_fck_hw = {
1212 .hw = {
1213 .clk = &fshostusb_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(fshostusb_fck, fshostusb_fck_parent_names, aes2_ick_ops);
1222
1223static struct clk gfx_l3_ck;
1224
1225static struct clk_hw_omap gfx_l3_ck_hw = {
1226 .hw = {
1227 .clk = &gfx_l3_ck,
1228 },
1229 .ops = &clkhwops_wait,
1230 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1231 .enable_bit = OMAP_EN_GFX_SHIFT,
1232 .clkdm_name = "gfx_3430es1_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(gfx_l3_ck, core_l3_ick_parent_names, aes1_ick_ops);
1236
1237DEFINE_CLK_DIVIDER(gfx_l3_fck, "l3_ick", &l3_ick, 0x0,
1238 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1239 OMAP_CLKSEL_GFX_SHIFT, OMAP_CLKSEL_GFX_WIDTH,
1240 CLK_DIVIDER_ONE_BASED, NULL);
1241
1242static struct clk gfx_cg1_ck;
1243
1244static const char *gfx_cg1_ck_parent_names[] = {
1245 "gfx_l3_fck",
1246};
1247
1248static struct clk_hw_omap gfx_cg1_ck_hw = {
1249 .hw = {
1250 .clk = &gfx_cg1_ck,
1251 },
1252 .ops = &clkhwops_wait,
1253 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1254 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1255 .clkdm_name = "gfx_3430es1_clkdm",
1256};
1257
1258DEFINE_STRUCT_CLK(gfx_cg1_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1259
1260static struct clk gfx_cg2_ck;
1261
1262static struct clk_hw_omap gfx_cg2_ck_hw = {
1263 .hw = {
1264 .clk = &gfx_cg2_ck,
1265 },
1266 .ops = &clkhwops_wait,
1267 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1268 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1269 .clkdm_name = "gfx_3430es1_clkdm",
1270};
1271
1272DEFINE_STRUCT_CLK(gfx_cg2_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1273
1274static struct clk gfx_l3_ick;
1275
1276static const char *gfx_l3_ick_parent_names[] = {
1277 "gfx_l3_ck",
1278};
1279
1280DEFINE_STRUCT_CLK_HW_OMAP(gfx_l3_ick, "gfx_3430es1_clkdm");
1281DEFINE_STRUCT_CLK(gfx_l3_ick, gfx_l3_ick_parent_names, core_l4_ick_ops);
1282
1283static struct clk wkup_32k_fck;
1284
1285static const char *wkup_32k_fck_parent_names[] = {
1286 "omap_32k_fck",
1287};
1288
1289DEFINE_STRUCT_CLK_HW_OMAP(wkup_32k_fck, "wkup_clkdm");
1290DEFINE_STRUCT_CLK(wkup_32k_fck, wkup_32k_fck_parent_names, core_l4_ick_ops);
1291
1292static struct clk gpio1_dbck;
1293
1294static const char *gpio1_dbck_parent_names[] = {
1295 "wkup_32k_fck",
1296};
1297
1298static struct clk_hw_omap gpio1_dbck_hw = {
1299 .hw = {
1300 .clk = &gpio1_dbck,
1301 },
1302 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1303 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1304 .clkdm_name = "wkup_clkdm",
1305};
1306
1307DEFINE_STRUCT_CLK(gpio1_dbck, gpio1_dbck_parent_names, aes2_ick_ops);
1308
1309static struct clk wkup_l4_ick;
1310
1311DEFINE_STRUCT_CLK_HW_OMAP(wkup_l4_ick, "wkup_clkdm");
1312DEFINE_STRUCT_CLK(wkup_l4_ick, dpll3_ck_parent_names, core_l4_ick_ops);
1313
1314static struct clk gpio1_ick;
1315
1316static const char *gpio1_ick_parent_names[] = {
1317 "wkup_l4_ick",
1318};
1319
1320static struct clk_hw_omap gpio1_ick_hw = {
1321 .hw = {
1322 .clk = &gpio1_ick,
1323 },
1324 .ops = &clkhwops_iclk_wait,
1325 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1326 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1327 .clkdm_name = "wkup_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(gpio1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1331
1332static struct clk per_32k_alwon_fck;
1333
1334DEFINE_STRUCT_CLK_HW_OMAP(per_32k_alwon_fck, "per_clkdm");
1335DEFINE_STRUCT_CLK(per_32k_alwon_fck, wkup_32k_fck_parent_names,
1336 core_l4_ick_ops);
1337
1338static struct clk gpio2_dbck;
1339
1340static const char *gpio2_dbck_parent_names[] = {
1341 "per_32k_alwon_fck",
1342};
1343
1344static struct clk_hw_omap gpio2_dbck_hw = {
1345 .hw = {
1346 .clk = &gpio2_dbck,
1347 },
1348 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1349 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1350 .clkdm_name = "per_clkdm",
1351};
1352
1353DEFINE_STRUCT_CLK(gpio2_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1354
1355static struct clk per_l4_ick;
1356
1357DEFINE_STRUCT_CLK_HW_OMAP(per_l4_ick, "per_clkdm");
1358DEFINE_STRUCT_CLK(per_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
1359
1360static struct clk gpio2_ick;
1361
1362static const char *gpio2_ick_parent_names[] = {
1363 "per_l4_ick",
1364};
1365
1366static struct clk_hw_omap gpio2_ick_hw = {
1367 .hw = {
1368 .clk = &gpio2_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1372 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1373 .clkdm_name = "per_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(gpio2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1377
1378static struct clk gpio3_dbck;
1379
1380static struct clk_hw_omap gpio3_dbck_hw = {
1381 .hw = {
1382 .clk = &gpio3_dbck,
1383 },
1384 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1385 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1386 .clkdm_name = "per_clkdm",
1387};
1388
1389DEFINE_STRUCT_CLK(gpio3_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1390
1391static struct clk gpio3_ick;
1392
1393static struct clk_hw_omap gpio3_ick_hw = {
1394 .hw = {
1395 .clk = &gpio3_ick,
1396 },
1397 .ops = &clkhwops_iclk_wait,
1398 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1399 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1400 .clkdm_name = "per_clkdm",
1401};
1402
1403DEFINE_STRUCT_CLK(gpio3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1404
1405static struct clk gpio4_dbck;
1406
1407static struct clk_hw_omap gpio4_dbck_hw = {
1408 .hw = {
1409 .clk = &gpio4_dbck,
1410 },
1411 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1412 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1413 .clkdm_name = "per_clkdm",
1414};
1415
1416DEFINE_STRUCT_CLK(gpio4_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1417
1418static struct clk gpio4_ick;
1419
1420static struct clk_hw_omap gpio4_ick_hw = {
1421 .hw = {
1422 .clk = &gpio4_ick,
1423 },
1424 .ops = &clkhwops_iclk_wait,
1425 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1426 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1427 .clkdm_name = "per_clkdm",
1428};
1429
1430DEFINE_STRUCT_CLK(gpio4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1431
1432static struct clk gpio5_dbck;
1433
1434static struct clk_hw_omap gpio5_dbck_hw = {
1435 .hw = {
1436 .clk = &gpio5_dbck,
1437 },
1438 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1439 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1440 .clkdm_name = "per_clkdm",
1441};
1442
1443DEFINE_STRUCT_CLK(gpio5_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1444
1445static struct clk gpio5_ick;
1446
1447static struct clk_hw_omap gpio5_ick_hw = {
1448 .hw = {
1449 .clk = &gpio5_ick,
1450 },
1451 .ops = &clkhwops_iclk_wait,
1452 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1453 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1454 .clkdm_name = "per_clkdm",
1455};
1456
1457DEFINE_STRUCT_CLK(gpio5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1458
1459static struct clk gpio6_dbck;
1460
1461static struct clk_hw_omap gpio6_dbck_hw = {
1462 .hw = {
1463 .clk = &gpio6_dbck,
1464 },
1465 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1466 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1467 .clkdm_name = "per_clkdm",
1468};
1469
1470DEFINE_STRUCT_CLK(gpio6_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1471
1472static struct clk gpio6_ick;
1473
1474static struct clk_hw_omap gpio6_ick_hw = {
1475 .hw = {
1476 .clk = &gpio6_ick,
1477 },
1478 .ops = &clkhwops_iclk_wait,
1479 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1480 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1481 .clkdm_name = "per_clkdm",
1482};
1483
1484DEFINE_STRUCT_CLK(gpio6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1485
1486static struct clk gpmc_fck;
1487
1488static struct clk_hw_omap gpmc_fck_hw = {
1489 .hw = {
1490 .clk = &gpmc_fck,
1491 },
1492 .flags = ENABLE_ON_INIT,
1493 .clkdm_name = "core_l3_clkdm",
1494};
1495
1496DEFINE_STRUCT_CLK(gpmc_fck, ipss_ick_parent_names, core_l4_ick_ops);
1497
1498static const struct clksel omap343x_gpt_clksel[] = {
1499 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1500 { .parent = &sys_ck, .rates = gpt_sys_rates },
1501 { .parent = NULL },
1502};
1503
1504static const char *gpt10_fck_parent_names[] = {
1505 "omap_32k_fck", "sys_ck",
1506};
1507
1508DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1509 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1510 OMAP3430_CLKSEL_GPT10_MASK,
1511 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1512 OMAP3430_EN_GPT10_SHIFT, &clkhwops_wait,
1513 gpt10_fck_parent_names, clkout2_src_ck_ops);
1514
1515static struct clk gpt10_ick;
1516
1517static struct clk_hw_omap gpt10_ick_hw = {
1518 .hw = {
1519 .clk = &gpt10_ick,
1520 },
1521 .ops = &clkhwops_iclk_wait,
1522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1523 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1524 .clkdm_name = "core_l4_clkdm",
1525};
1526
1527DEFINE_STRUCT_CLK(gpt10_ick, aes2_ick_parent_names, aes2_ick_ops);
1528
1529DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1530 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1531 OMAP3430_CLKSEL_GPT11_MASK,
1532 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1533 OMAP3430_EN_GPT11_SHIFT, &clkhwops_wait,
1534 gpt10_fck_parent_names, clkout2_src_ck_ops);
1535
1536static struct clk gpt11_ick;
1537
1538static struct clk_hw_omap gpt11_ick_hw = {
1539 .hw = {
1540 .clk = &gpt11_ick,
1541 },
1542 .ops = &clkhwops_iclk_wait,
1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1544 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1545 .clkdm_name = "core_l4_clkdm",
1546};
1547
1548DEFINE_STRUCT_CLK(gpt11_ick, aes2_ick_parent_names, aes2_ick_ops);
1549
1550static struct clk gpt12_fck;
1551
1552static const char *gpt12_fck_parent_names[] = {
1553 "secure_32k_fck",
1554};
1555
1556DEFINE_STRUCT_CLK_HW_OMAP(gpt12_fck, "wkup_clkdm");
1557DEFINE_STRUCT_CLK(gpt12_fck, gpt12_fck_parent_names, core_l4_ick_ops);
1558
1559static struct clk gpt12_ick;
1560
1561static struct clk_hw_omap gpt12_ick_hw = {
1562 .hw = {
1563 .clk = &gpt12_ick,
1564 },
1565 .ops = &clkhwops_iclk_wait,
1566 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1567 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
1568 .clkdm_name = "wkup_clkdm",
1569};
1570
1571DEFINE_STRUCT_CLK(gpt12_ick, gpio1_ick_parent_names, aes2_ick_ops);
1572
1573DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "wkup_clkdm", omap343x_gpt_clksel,
1574 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1575 OMAP3430_CLKSEL_GPT1_MASK,
1576 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1577 OMAP3430_EN_GPT1_SHIFT, &clkhwops_wait,
1578 gpt10_fck_parent_names, clkout2_src_ck_ops);
1579
1580static struct clk gpt1_ick;
1581
1582static struct clk_hw_omap gpt1_ick_hw = {
1583 .hw = {
1584 .clk = &gpt1_ick,
1585 },
1586 .ops = &clkhwops_iclk_wait,
1587 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1588 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
1589 .clkdm_name = "wkup_clkdm",
1590};
1591
1592DEFINE_STRUCT_CLK(gpt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1593
1594DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "per_clkdm", omap343x_gpt_clksel,
1595 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1596 OMAP3430_CLKSEL_GPT2_MASK,
1597 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1598 OMAP3430_EN_GPT2_SHIFT, &clkhwops_wait,
1599 gpt10_fck_parent_names, clkout2_src_ck_ops);
1600
1601static struct clk gpt2_ick;
1602
1603static struct clk_hw_omap gpt2_ick_hw = {
1604 .hw = {
1605 .clk = &gpt2_ick,
1606 },
1607 .ops = &clkhwops_iclk_wait,
1608 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1609 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
1610 .clkdm_name = "per_clkdm",
1611};
1612
1613DEFINE_STRUCT_CLK(gpt2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1614
1615DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "per_clkdm", omap343x_gpt_clksel,
1616 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1617 OMAP3430_CLKSEL_GPT3_MASK,
1618 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1619 OMAP3430_EN_GPT3_SHIFT, &clkhwops_wait,
1620 gpt10_fck_parent_names, clkout2_src_ck_ops);
1621
1622static struct clk gpt3_ick;
1623
1624static struct clk_hw_omap gpt3_ick_hw = {
1625 .hw = {
1626 .clk = &gpt3_ick,
1627 },
1628 .ops = &clkhwops_iclk_wait,
1629 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1630 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
1631 .clkdm_name = "per_clkdm",
1632};
1633
1634DEFINE_STRUCT_CLK(gpt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1635
1636DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "per_clkdm", omap343x_gpt_clksel,
1637 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1638 OMAP3430_CLKSEL_GPT4_MASK,
1639 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1640 OMAP3430_EN_GPT4_SHIFT, &clkhwops_wait,
1641 gpt10_fck_parent_names, clkout2_src_ck_ops);
1642
1643static struct clk gpt4_ick;
1644
1645static struct clk_hw_omap gpt4_ick_hw = {
1646 .hw = {
1647 .clk = &gpt4_ick,
1648 },
1649 .ops = &clkhwops_iclk_wait,
1650 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1651 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
1652 .clkdm_name = "per_clkdm",
1653};
1654
1655DEFINE_STRUCT_CLK(gpt4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1656
1657DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "per_clkdm", omap343x_gpt_clksel,
1658 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1659 OMAP3430_CLKSEL_GPT5_MASK,
1660 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1661 OMAP3430_EN_GPT5_SHIFT, &clkhwops_wait,
1662 gpt10_fck_parent_names, clkout2_src_ck_ops);
1663
1664static struct clk gpt5_ick;
1665
1666static struct clk_hw_omap gpt5_ick_hw = {
1667 .hw = {
1668 .clk = &gpt5_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1672 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
1673 .clkdm_name = "per_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(gpt5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1677
1678DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "per_clkdm", omap343x_gpt_clksel,
1679 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1680 OMAP3430_CLKSEL_GPT6_MASK,
1681 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1682 OMAP3430_EN_GPT6_SHIFT, &clkhwops_wait,
1683 gpt10_fck_parent_names, clkout2_src_ck_ops);
1684
1685static struct clk gpt6_ick;
1686
1687static struct clk_hw_omap gpt6_ick_hw = {
1688 .hw = {
1689 .clk = &gpt6_ick,
1690 },
1691 .ops = &clkhwops_iclk_wait,
1692 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1693 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
1694 .clkdm_name = "per_clkdm",
1695};
1696
1697DEFINE_STRUCT_CLK(gpt6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1698
1699DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "per_clkdm", omap343x_gpt_clksel,
1700 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1701 OMAP3430_CLKSEL_GPT7_MASK,
1702 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1703 OMAP3430_EN_GPT7_SHIFT, &clkhwops_wait,
1704 gpt10_fck_parent_names, clkout2_src_ck_ops);
1705
1706static struct clk gpt7_ick;
1707
1708static struct clk_hw_omap gpt7_ick_hw = {
1709 .hw = {
1710 .clk = &gpt7_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1714 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
1715 .clkdm_name = "per_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(gpt7_ick, gpio2_ick_parent_names, aes2_ick_ops);
1719
1720DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "per_clkdm", omap343x_gpt_clksel,
1721 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1722 OMAP3430_CLKSEL_GPT8_MASK,
1723 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1724 OMAP3430_EN_GPT8_SHIFT, &clkhwops_wait,
1725 gpt10_fck_parent_names, clkout2_src_ck_ops);
1726
1727static struct clk gpt8_ick;
1728
1729static struct clk_hw_omap gpt8_ick_hw = {
1730 .hw = {
1731 .clk = &gpt8_ick,
1732 },
1733 .ops = &clkhwops_iclk_wait,
1734 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1735 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
1736 .clkdm_name = "per_clkdm",
1737};
1738
1739DEFINE_STRUCT_CLK(gpt8_ick, gpio2_ick_parent_names, aes2_ick_ops);
1740
1741DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "per_clkdm", omap343x_gpt_clksel,
1742 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1743 OMAP3430_CLKSEL_GPT9_MASK,
1744 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1745 OMAP3430_EN_GPT9_SHIFT, &clkhwops_wait,
1746 gpt10_fck_parent_names, clkout2_src_ck_ops);
1747
1748static struct clk gpt9_ick;
1749
1750static struct clk_hw_omap gpt9_ick_hw = {
1751 .hw = {
1752 .clk = &gpt9_ick,
1753 },
1754 .ops = &clkhwops_iclk_wait,
1755 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1756 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
1757 .clkdm_name = "per_clkdm",
1758};
1759
1760DEFINE_STRUCT_CLK(gpt9_ick, gpio2_ick_parent_names, aes2_ick_ops);
1761
1762static struct clk hdq_fck;
1763
1764static const char *hdq_fck_parent_names[] = {
1765 "core_12m_fck",
1766};
1767
1768static struct clk_hw_omap hdq_fck_hw = {
1769 .hw = {
1770 .clk = &hdq_fck,
1771 },
1772 .ops = &clkhwops_wait,
1773 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1774 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1775 .clkdm_name = "core_l4_clkdm",
1776};
1777
1778DEFINE_STRUCT_CLK(hdq_fck, hdq_fck_parent_names, aes2_ick_ops);
1779
1780static struct clk hdq_ick;
1781
1782static struct clk_hw_omap hdq_ick_hw = {
1783 .hw = {
1784 .clk = &hdq_ick,
1785 },
1786 .ops = &clkhwops_iclk_wait,
1787 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1788 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1789 .clkdm_name = "core_l4_clkdm",
1790};
1791
1792DEFINE_STRUCT_CLK(hdq_ick, aes2_ick_parent_names, aes2_ick_ops);
1793
1794static struct clk hecc_ck;
1795
1796static struct clk_hw_omap hecc_ck_hw = {
1797 .hw = {
1798 .clk = &hecc_ck,
1799 },
1800 .ops = &clkhwops_am35xx_ipss_module_wait,
1801 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1802 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
1803 .clkdm_name = "core_l3_clkdm",
1804};
1805
1806DEFINE_STRUCT_CLK(hecc_ck, dpll3_ck_parent_names, aes2_ick_ops);
1807
1808static struct clk hsotgusb_fck_am35xx;
1809
1810static struct clk_hw_omap hsotgusb_fck_am35xx_hw = {
1811 .hw = {
1812 .clk = &hsotgusb_fck_am35xx,
1813 },
1814 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1815 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
1816 .clkdm_name = "core_l3_clkdm",
1817};
1818
1819DEFINE_STRUCT_CLK(hsotgusb_fck_am35xx, dpll3_ck_parent_names, aes2_ick_ops);
1820
1821static struct clk hsotgusb_ick_3430es1;
1822
1823static struct clk_hw_omap hsotgusb_ick_3430es1_hw = {
1824 .hw = {
1825 .clk = &hsotgusb_ick_3430es1,
1826 },
1827 .ops = &clkhwops_iclk,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1829 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1830 .clkdm_name = "core_l3_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(hsotgusb_ick_3430es1, ipss_ick_parent_names, aes2_ick_ops);
1834
1835static struct clk hsotgusb_ick_3430es2;
1836
1837static struct clk_hw_omap hsotgusb_ick_3430es2_hw = {
1838 .hw = {
1839 .clk = &hsotgusb_ick_3430es2,
1840 },
1841 .ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1844 .clkdm_name = "core_l3_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(hsotgusb_ick_3430es2, ipss_ick_parent_names, aes2_ick_ops);
1848
1849static struct clk hsotgusb_ick_am35xx;
1850
1851static struct clk_hw_omap hsotgusb_ick_am35xx_hw = {
1852 .hw = {
1853 .clk = &hsotgusb_ick_am35xx,
1854 },
1855 .ops = &clkhwops_am35xx_ipss_module_wait,
1856 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1857 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
1858 .clkdm_name = "core_l3_clkdm",
1859};
1860
1861DEFINE_STRUCT_CLK(hsotgusb_ick_am35xx, emac_ick_parent_names, aes2_ick_ops);
1862
1863static struct clk i2c1_fck;
1864
1865static struct clk_hw_omap i2c1_fck_hw = {
1866 .hw = {
1867 .clk = &i2c1_fck,
1868 },
1869 .ops = &clkhwops_wait,
1870 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1871 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1872 .clkdm_name = "core_l4_clkdm",
1873};
1874
1875DEFINE_STRUCT_CLK(i2c1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1876
1877static struct clk i2c1_ick;
1878
1879static struct clk_hw_omap i2c1_ick_hw = {
1880 .hw = {
1881 .clk = &i2c1_ick,
1882 },
1883 .ops = &clkhwops_iclk_wait,
1884 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1885 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1886 .clkdm_name = "core_l4_clkdm",
1887};
1888
1889DEFINE_STRUCT_CLK(i2c1_ick, aes2_ick_parent_names, aes2_ick_ops);
1890
1891static struct clk i2c2_fck;
1892
1893static struct clk_hw_omap i2c2_fck_hw = {
1894 .hw = {
1895 .clk = &i2c2_fck,
1896 },
1897 .ops = &clkhwops_wait,
1898 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1899 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1900 .clkdm_name = "core_l4_clkdm",
1901};
1902
1903DEFINE_STRUCT_CLK(i2c2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1904
1905static struct clk i2c2_ick;
1906
1907static struct clk_hw_omap i2c2_ick_hw = {
1908 .hw = {
1909 .clk = &i2c2_ick,
1910 },
1911 .ops = &clkhwops_iclk_wait,
1912 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1913 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1914 .clkdm_name = "core_l4_clkdm",
1915};
1916
1917DEFINE_STRUCT_CLK(i2c2_ick, aes2_ick_parent_names, aes2_ick_ops);
1918
1919static struct clk i2c3_fck;
1920
1921static struct clk_hw_omap i2c3_fck_hw = {
1922 .hw = {
1923 .clk = &i2c3_fck,
1924 },
1925 .ops = &clkhwops_wait,
1926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1927 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1928 .clkdm_name = "core_l4_clkdm",
1929};
1930
1931DEFINE_STRUCT_CLK(i2c3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1932
1933static struct clk i2c3_ick;
1934
1935static struct clk_hw_omap i2c3_ick_hw = {
1936 .hw = {
1937 .clk = &i2c3_ick,
1938 },
1939 .ops = &clkhwops_iclk_wait,
1940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1941 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1942 .clkdm_name = "core_l4_clkdm",
1943};
1944
1945DEFINE_STRUCT_CLK(i2c3_ick, aes2_ick_parent_names, aes2_ick_ops);
1946
1947static struct clk icr_ick;
1948
1949static struct clk_hw_omap icr_ick_hw = {
1950 .hw = {
1951 .clk = &icr_ick,
1952 },
1953 .ops = &clkhwops_iclk_wait,
1954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1955 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1956 .clkdm_name = "core_l4_clkdm",
1957};
1958
1959DEFINE_STRUCT_CLK(icr_ick, aes2_ick_parent_names, aes2_ick_ops);
1960
1961static struct clk iva2_ck;
1962
1963static const char *iva2_ck_parent_names[] = {
1964 "dpll2_m2_ck",
1965};
1966
1967static struct clk_hw_omap iva2_ck_hw = {
1968 .hw = {
1969 .clk = &iva2_ck,
1970 },
1971 .ops = &clkhwops_wait,
1972 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1973 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1974 .clkdm_name = "iva2_clkdm",
1975};
1976
1977DEFINE_STRUCT_CLK(iva2_ck, iva2_ck_parent_names, aes2_ick_ops);
1978
1979static struct clk mad2d_ick;
1980
1981static struct clk_hw_omap mad2d_ick_hw = {
1982 .hw = {
1983 .clk = &mad2d_ick,
1984 },
1985 .ops = &clkhwops_iclk_wait,
1986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1987 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1988 .clkdm_name = "d2d_clkdm",
1989};
1990
1991DEFINE_STRUCT_CLK(mad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
1992
1993static struct clk mailboxes_ick;
1994
1995static struct clk_hw_omap mailboxes_ick_hw = {
1996 .hw = {
1997 .clk = &mailboxes_ick,
1998 },
1999 .ops = &clkhwops_iclk_wait,
2000 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2001 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2002 .clkdm_name = "core_l4_clkdm",
2003};
2004
2005DEFINE_STRUCT_CLK(mailboxes_ick, aes2_ick_parent_names, aes2_ick_ops);
2006
2007static const struct clksel_rate common_mcbsp_96m_rates[] = {
2008 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2009 { .div = 0 }
2010};
2011
2012static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
2013 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2014 { .div = 0 }
2015};
2016
2017static const struct clksel mcbsp_15_clksel[] = {
2018 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
2019 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2020 { .parent = NULL },
2021};
2022
2023static const char *mcbsp1_fck_parent_names[] = {
2024 "core_96m_fck", "mcbsp_clks",
2025};
2026
2027DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_15_clksel,
2028 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2029 OMAP2_MCBSP1_CLKS_MASK,
2030 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2031 OMAP3430_EN_MCBSP1_SHIFT, &clkhwops_wait,
2032 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2033
2034static struct clk mcbsp1_ick;
2035
2036static struct clk_hw_omap mcbsp1_ick_hw = {
2037 .hw = {
2038 .clk = &mcbsp1_ick,
2039 },
2040 .ops = &clkhwops_iclk_wait,
2041 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2042 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2043 .clkdm_name = "core_l4_clkdm",
2044};
2045
2046DEFINE_STRUCT_CLK(mcbsp1_ick, aes2_ick_parent_names, aes2_ick_ops);
2047
2048static struct clk per_96m_fck;
2049
2050DEFINE_STRUCT_CLK_HW_OMAP(per_96m_fck, "per_clkdm");
2051DEFINE_STRUCT_CLK(per_96m_fck, cm_96m_fck_parent_names, core_l4_ick_ops);
2052
2053static const struct clksel mcbsp_234_clksel[] = {
2054 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2055 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2056 { .parent = NULL },
2057};
2058
2059static const char *mcbsp2_fck_parent_names[] = {
2060 "per_96m_fck", "mcbsp_clks",
2061};
2062
2063DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "per_clkdm", mcbsp_234_clksel,
2064 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2065 OMAP2_MCBSP2_CLKS_MASK,
2066 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2067 OMAP3430_EN_MCBSP2_SHIFT, &clkhwops_wait,
2068 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2069
2070static struct clk mcbsp2_ick;
2071
2072static struct clk_hw_omap mcbsp2_ick_hw = {
2073 .hw = {
2074 .clk = &mcbsp2_ick,
2075 },
2076 .ops = &clkhwops_iclk_wait,
2077 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2078 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2079 .clkdm_name = "per_clkdm",
2080};
2081
2082DEFINE_STRUCT_CLK(mcbsp2_ick, gpio2_ick_parent_names, aes2_ick_ops);
2083
2084DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "per_clkdm", mcbsp_234_clksel,
2085 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2086 OMAP2_MCBSP3_CLKS_MASK,
2087 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2088 OMAP3430_EN_MCBSP3_SHIFT, &clkhwops_wait,
2089 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2090
2091static struct clk mcbsp3_ick;
2092
2093static struct clk_hw_omap mcbsp3_ick_hw = {
2094 .hw = {
2095 .clk = &mcbsp3_ick,
2096 },
2097 .ops = &clkhwops_iclk_wait,
2098 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2099 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2100 .clkdm_name = "per_clkdm",
2101};
2102
2103DEFINE_STRUCT_CLK(mcbsp3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2104
2105DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "per_clkdm", mcbsp_234_clksel,
2106 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2107 OMAP2_MCBSP4_CLKS_MASK,
2108 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2109 OMAP3430_EN_MCBSP4_SHIFT, &clkhwops_wait,
2110 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2111
2112static struct clk mcbsp4_ick;
2113
2114static struct clk_hw_omap mcbsp4_ick_hw = {
2115 .hw = {
2116 .clk = &mcbsp4_ick,
2117 },
2118 .ops = &clkhwops_iclk_wait,
2119 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2120 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2121 .clkdm_name = "per_clkdm",
2122};
2123
2124DEFINE_STRUCT_CLK(mcbsp4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2125
2126DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_15_clksel,
2127 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2128 OMAP2_MCBSP5_CLKS_MASK,
2129 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2130 OMAP3430_EN_MCBSP5_SHIFT, &clkhwops_wait,
2131 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2132
2133static struct clk mcbsp5_ick;
2134
2135static struct clk_hw_omap mcbsp5_ick_hw = {
2136 .hw = {
2137 .clk = &mcbsp5_ick,
2138 },
2139 .ops = &clkhwops_iclk_wait,
2140 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2141 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
2142 .clkdm_name = "core_l4_clkdm",
2143};
2144
2145DEFINE_STRUCT_CLK(mcbsp5_ick, aes2_ick_parent_names, aes2_ick_ops);
2146
2147static struct clk mcspi1_fck;
2148
2149static struct clk_hw_omap mcspi1_fck_hw = {
2150 .hw = {
2151 .clk = &mcspi1_fck,
2152 },
2153 .ops = &clkhwops_wait,
2154 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2155 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2156 .clkdm_name = "core_l4_clkdm",
2157};
2158
2159DEFINE_STRUCT_CLK(mcspi1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2160
2161static struct clk mcspi1_ick;
2162
2163static struct clk_hw_omap mcspi1_ick_hw = {
2164 .hw = {
2165 .clk = &mcspi1_ick,
2166 },
2167 .ops = &clkhwops_iclk_wait,
2168 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2169 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2170 .clkdm_name = "core_l4_clkdm",
2171};
2172
2173DEFINE_STRUCT_CLK(mcspi1_ick, aes2_ick_parent_names, aes2_ick_ops);
2174
2175static struct clk mcspi2_fck;
2176
2177static struct clk_hw_omap mcspi2_fck_hw = {
2178 .hw = {
2179 .clk = &mcspi2_fck,
2180 },
2181 .ops = &clkhwops_wait,
2182 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2183 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2184 .clkdm_name = "core_l4_clkdm",
2185};
2186
2187DEFINE_STRUCT_CLK(mcspi2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2188
2189static struct clk mcspi2_ick;
2190
2191static struct clk_hw_omap mcspi2_ick_hw = {
2192 .hw = {
2193 .clk = &mcspi2_ick,
2194 },
2195 .ops = &clkhwops_iclk_wait,
2196 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2197 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2198 .clkdm_name = "core_l4_clkdm",
2199};
2200
2201DEFINE_STRUCT_CLK(mcspi2_ick, aes2_ick_parent_names, aes2_ick_ops);
2202
2203static struct clk mcspi3_fck;
2204
2205static struct clk_hw_omap mcspi3_fck_hw = {
2206 .hw = {
2207 .clk = &mcspi3_fck,
2208 },
2209 .ops = &clkhwops_wait,
2210 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2211 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2212 .clkdm_name = "core_l4_clkdm",
2213};
2214
2215DEFINE_STRUCT_CLK(mcspi3_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2216
2217static struct clk mcspi3_ick;
2218
2219static struct clk_hw_omap mcspi3_ick_hw = {
2220 .hw = {
2221 .clk = &mcspi3_ick,
2222 },
2223 .ops = &clkhwops_iclk_wait,
2224 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2225 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2226 .clkdm_name = "core_l4_clkdm",
2227};
2228
2229DEFINE_STRUCT_CLK(mcspi3_ick, aes2_ick_parent_names, aes2_ick_ops);
2230
2231static struct clk mcspi4_fck;
2232
2233static struct clk_hw_omap mcspi4_fck_hw = {
2234 .hw = {
2235 .clk = &mcspi4_fck,
2236 },
2237 .ops = &clkhwops_wait,
2238 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2239 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2240 .clkdm_name = "core_l4_clkdm",
2241};
2242
2243DEFINE_STRUCT_CLK(mcspi4_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2244
2245static struct clk mcspi4_ick;
2246
2247static struct clk_hw_omap mcspi4_ick_hw = {
2248 .hw = {
2249 .clk = &mcspi4_ick,
2250 },
2251 .ops = &clkhwops_iclk_wait,
2252 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2253 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2254 .clkdm_name = "core_l4_clkdm",
2255};
2256
2257DEFINE_STRUCT_CLK(mcspi4_ick, aes2_ick_parent_names, aes2_ick_ops);
2258
2259static struct clk mmchs1_fck;
2260
2261static struct clk_hw_omap mmchs1_fck_hw = {
2262 .hw = {
2263 .clk = &mmchs1_fck,
2264 },
2265 .ops = &clkhwops_wait,
2266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2267 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2268 .clkdm_name = "core_l4_clkdm",
2269};
2270
2271DEFINE_STRUCT_CLK(mmchs1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2272
2273static struct clk mmchs1_ick;
2274
2275static struct clk_hw_omap mmchs1_ick_hw = {
2276 .hw = {
2277 .clk = &mmchs1_ick,
2278 },
2279 .ops = &clkhwops_iclk_wait,
2280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2281 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2282 .clkdm_name = "core_l4_clkdm",
2283};
2284
2285DEFINE_STRUCT_CLK(mmchs1_ick, aes2_ick_parent_names, aes2_ick_ops);
2286
2287static struct clk mmchs2_fck;
2288
2289static struct clk_hw_omap mmchs2_fck_hw = {
2290 .hw = {
2291 .clk = &mmchs2_fck,
2292 },
2293 .ops = &clkhwops_wait,
2294 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2295 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2296 .clkdm_name = "core_l4_clkdm",
2297};
2298
2299DEFINE_STRUCT_CLK(mmchs2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2300
2301static struct clk mmchs2_ick;
2302
2303static struct clk_hw_omap mmchs2_ick_hw = {
2304 .hw = {
2305 .clk = &mmchs2_ick,
2306 },
2307 .ops = &clkhwops_iclk_wait,
2308 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2309 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2310 .clkdm_name = "core_l4_clkdm",
2311};
2312
2313DEFINE_STRUCT_CLK(mmchs2_ick, aes2_ick_parent_names, aes2_ick_ops);
2314
2315static struct clk mmchs3_fck;
2316
2317static struct clk_hw_omap mmchs3_fck_hw = {
2318 .hw = {
2319 .clk = &mmchs3_fck,
2320 },
2321 .ops = &clkhwops_wait,
2322 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2323 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2324 .clkdm_name = "core_l4_clkdm",
2325};
2326
2327DEFINE_STRUCT_CLK(mmchs3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2328
2329static struct clk mmchs3_ick;
2330
2331static struct clk_hw_omap mmchs3_ick_hw = {
2332 .hw = {
2333 .clk = &mmchs3_ick,
2334 },
2335 .ops = &clkhwops_iclk_wait,
2336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2337 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2338 .clkdm_name = "core_l4_clkdm",
2339};
2340
2341DEFINE_STRUCT_CLK(mmchs3_ick, aes2_ick_parent_names, aes2_ick_ops);
2342
2343static struct clk modem_fck;
2344
2345static struct clk_hw_omap modem_fck_hw = {
2346 .hw = {
2347 .clk = &modem_fck,
2348 },
2349 .ops = &clkhwops_iclk_wait,
2350 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2351 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
2352 .clkdm_name = "d2d_clkdm",
2353};
2354
2355DEFINE_STRUCT_CLK(modem_fck, dpll3_ck_parent_names, aes2_ick_ops);
2356
2357static struct clk mspro_fck;
2358
2359static struct clk_hw_omap mspro_fck_hw = {
2360 .hw = {
2361 .clk = &mspro_fck,
2362 },
2363 .ops = &clkhwops_wait,
2364 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2365 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2366 .clkdm_name = "core_l4_clkdm",
2367};
2368
2369DEFINE_STRUCT_CLK(mspro_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2370
2371static struct clk mspro_ick;
2372
2373static struct clk_hw_omap mspro_ick_hw = {
2374 .hw = {
2375 .clk = &mspro_ick,
2376 },
2377 .ops = &clkhwops_iclk_wait,
2378 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2379 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2380 .clkdm_name = "core_l4_clkdm",
2381};
2382
2383DEFINE_STRUCT_CLK(mspro_ick, aes2_ick_parent_names, aes2_ick_ops);
2384
2385static struct clk omap_192m_alwon_fck;
2386
2387DEFINE_STRUCT_CLK_HW_OMAP(omap_192m_alwon_fck, NULL);
2388DEFINE_STRUCT_CLK(omap_192m_alwon_fck, omap_96m_alwon_fck_parent_names,
2389 core_ck_ops);
2390
2391static struct clk omap_32ksync_ick;
2392
2393static struct clk_hw_omap omap_32ksync_ick_hw = {
2394 .hw = {
2395 .clk = &omap_32ksync_ick,
2396 },
2397 .ops = &clkhwops_iclk_wait,
2398 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2399 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2400 .clkdm_name = "wkup_clkdm",
2401};
2402
2403DEFINE_STRUCT_CLK(omap_32ksync_ick, gpio1_ick_parent_names, aes2_ick_ops);
2404
2405static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
2406 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
2407 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
2408 { .div = 0 }
2409};
2410
2411static const struct clksel omap_96m_alwon_fck_clksel[] = {
2412 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
2413 { .parent = NULL }
2414};
2415
2416static struct clk omap_96m_alwon_fck_3630;
2417
2418static const char *omap_96m_alwon_fck_3630_parent_names[] = {
2419 "omap_192m_alwon_fck",
2420};
2421
2422static const struct clk_ops omap_96m_alwon_fck_3630_ops = {
2423 .set_rate = &omap2_clksel_set_rate,
2424 .recalc_rate = &omap2_clksel_recalc,
2425 .round_rate = &omap2_clksel_round_rate,
2426};
2427
2428static struct clk_hw_omap omap_96m_alwon_fck_3630_hw = {
2429 .hw = {
2430 .clk = &omap_96m_alwon_fck_3630,
2431 },
2432 .clksel = omap_96m_alwon_fck_clksel,
2433 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2434 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
2435};
2436
2437static struct clk omap_96m_alwon_fck_3630 = {
2438 .name = "omap_96m_alwon_fck",
2439 .hw = &omap_96m_alwon_fck_3630_hw.hw,
2440 .parent_names = omap_96m_alwon_fck_3630_parent_names,
2441 .num_parents = ARRAY_SIZE(omap_96m_alwon_fck_3630_parent_names),
2442 .ops = &omap_96m_alwon_fck_3630_ops,
2443};
2444
2445static struct clk omapctrl_ick;
2446
2447static struct clk_hw_omap omapctrl_ick_hw = {
2448 .hw = {
2449 .clk = &omapctrl_ick,
2450 },
2451 .ops = &clkhwops_iclk_wait,
2452 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2453 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2454 .flags = ENABLE_ON_INIT,
2455 .clkdm_name = "core_l4_clkdm",
2456};
2457
2458DEFINE_STRUCT_CLK(omapctrl_ick, aes2_ick_parent_names, aes2_ick_ops);
2459
2460DEFINE_CLK_DIVIDER(pclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
2461 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2462 OMAP3430_CLKSEL_PCLK_SHIFT, OMAP3430_CLKSEL_PCLK_WIDTH,
2463 CLK_DIVIDER_ONE_BASED, NULL);
2464
2465DEFINE_CLK_DIVIDER(pclkx2_fck, "emu_src_ck", &emu_src_ck, 0x0,
2466 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2467 OMAP3430_CLKSEL_PCLKX2_SHIFT, OMAP3430_CLKSEL_PCLKX2_WIDTH,
2468 CLK_DIVIDER_ONE_BASED, NULL);
2469
2470static struct clk per_48m_fck;
2471
2472DEFINE_STRUCT_CLK_HW_OMAP(per_48m_fck, "per_clkdm");
2473DEFINE_STRUCT_CLK(per_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
2474
2475static struct clk security_l3_ick;
2476
2477DEFINE_STRUCT_CLK_HW_OMAP(security_l3_ick, NULL);
2478DEFINE_STRUCT_CLK(security_l3_ick, core_l3_ick_parent_names, core_ck_ops);
2479
2480static struct clk pka_ick;
2481
2482static const char *pka_ick_parent_names[] = {
2483 "security_l3_ick",
2484};
2485
2486static struct clk_hw_omap pka_ick_hw = {
2487 .hw = {
2488 .clk = &pka_ick,
2489 },
2490 .ops = &clkhwops_iclk_wait,
2491 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2492 .enable_bit = OMAP3430_EN_PKA_SHIFT,
2493};
2494
2495DEFINE_STRUCT_CLK(pka_ick, pka_ick_parent_names, aes1_ick_ops);
2496
2497DEFINE_CLK_DIVIDER(rm_ick, "l4_ick", &l4_ick, 0x0,
2498 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2499 OMAP3430_CLKSEL_RM_SHIFT, OMAP3430_CLKSEL_RM_WIDTH,
2500 CLK_DIVIDER_ONE_BASED, NULL);
2501
2502static struct clk rng_ick;
2503
2504static struct clk_hw_omap rng_ick_hw = {
2505 .hw = {
2506 .clk = &rng_ick,
2507 },
2508 .ops = &clkhwops_iclk_wait,
2509 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2510 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2511};
2512
2513DEFINE_STRUCT_CLK(rng_ick, aes1_ick_parent_names, aes1_ick_ops);
2514
2515static struct clk sad2d_ick;
2516
2517static struct clk_hw_omap sad2d_ick_hw = {
2518 .hw = {
2519 .clk = &sad2d_ick,
2520 },
2521 .ops = &clkhwops_iclk_wait,
2522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2523 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
2524 .clkdm_name = "d2d_clkdm",
2525};
2526
2527DEFINE_STRUCT_CLK(sad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
2528
2529static struct clk sdrc_ick;
2530
2531static struct clk_hw_omap sdrc_ick_hw = {
2532 .hw = {
2533 .clk = &sdrc_ick,
2534 },
2535 .ops = &clkhwops_wait,
2536 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2537 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
2538 .flags = ENABLE_ON_INIT,
2539 .clkdm_name = "core_l3_clkdm",
2540};
2541
2542DEFINE_STRUCT_CLK(sdrc_ick, ipss_ick_parent_names, aes2_ick_ops);
2543
2544static const struct clksel_rate sgx_core_rates[] = {
2545 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
2546 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
2547 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
2548 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
2549 { .div = 0 }
2550};
2551
2552static const struct clksel_rate sgx_96m_rates[] = {
2553 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2554 { .div = 0 }
2555};
2556
2557static const struct clksel_rate sgx_192m_rates[] = {
2558 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
2559 { .div = 0 }
2560};
2561
2562static const struct clksel_rate sgx_corex2_rates[] = {
2563 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
2564 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
2565 { .div = 0 }
2566};
2567
2568static const struct clksel sgx_clksel[] = {
2569 { .parent = &core_ck, .rates = sgx_core_rates },
2570 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
2571 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
2572 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
2573 { .parent = NULL },
2574};
2575
2576static const char *sgx_fck_parent_names[] = {
2577 "core_ck", "cm_96m_fck", "omap_192m_alwon_fck", "corex2_fck",
2578};
2579
2580static struct clk sgx_fck;
2581
2582static const struct clk_ops sgx_fck_ops = {
2583 .init = &omap2_init_clk_clkdm,
2584 .enable = &omap2_dflt_clk_enable,
2585 .disable = &omap2_dflt_clk_disable,
2586 .is_enabled = &omap2_dflt_clk_is_enabled,
2587 .recalc_rate = &omap2_clksel_recalc,
2588 .set_rate = &omap2_clksel_set_rate,
2589 .round_rate = &omap2_clksel_round_rate,
2590 .get_parent = &omap2_clksel_find_parent_index,
2591 .set_parent = &omap2_clksel_set_parent,
2592};
2593
2594DEFINE_CLK_OMAP_MUX_GATE(sgx_fck, "sgx_clkdm", sgx_clksel,
2595 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
2596 OMAP3430ES2_CLKSEL_SGX_MASK,
2597 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
2598 OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
2599 &clkhwops_wait, sgx_fck_parent_names, sgx_fck_ops);
2600
2601static struct clk sgx_ick;
2602
2603static struct clk_hw_omap sgx_ick_hw = {
2604 .hw = {
2605 .clk = &sgx_ick,
2606 },
2607 .ops = &clkhwops_wait,
2608 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
2609 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
2610 .clkdm_name = "sgx_clkdm",
2611};
2612
2613DEFINE_STRUCT_CLK(sgx_ick, core_l3_ick_parent_names, aes2_ick_ops);
2614
2615static struct clk sha11_ick;
2616
2617static struct clk_hw_omap sha11_ick_hw = {
2618 .hw = {
2619 .clk = &sha11_ick,
2620 },
2621 .ops = &clkhwops_iclk_wait,
2622 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2623 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2624};
2625
2626DEFINE_STRUCT_CLK(sha11_ick, aes1_ick_parent_names, aes1_ick_ops);
2627
2628static struct clk sha12_ick;
2629
2630static struct clk_hw_omap sha12_ick_hw = {
2631 .hw = {
2632 .clk = &sha12_ick,
2633 },
2634 .ops = &clkhwops_iclk_wait,
2635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2636 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
2637 .clkdm_name = "core_l4_clkdm",
2638};
2639
2640DEFINE_STRUCT_CLK(sha12_ick, aes2_ick_parent_names, aes2_ick_ops);
2641
2642static struct clk sr1_fck;
2643
2644static struct clk_hw_omap sr1_fck_hw = {
2645 .hw = {
2646 .clk = &sr1_fck,
2647 },
2648 .ops = &clkhwops_wait,
2649 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2650 .enable_bit = OMAP3430_EN_SR1_SHIFT,
2651 .clkdm_name = "wkup_clkdm",
2652};
2653
2654DEFINE_STRUCT_CLK(sr1_fck, dpll3_ck_parent_names, aes2_ick_ops);
2655
2656static struct clk sr2_fck;
2657
2658static struct clk_hw_omap sr2_fck_hw = {
2659 .hw = {
2660 .clk = &sr2_fck,
2661 },
2662 .ops = &clkhwops_wait,
2663 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2664 .enable_bit = OMAP3430_EN_SR2_SHIFT,
2665 .clkdm_name = "wkup_clkdm",
2666};
2667
2668DEFINE_STRUCT_CLK(sr2_fck, dpll3_ck_parent_names, aes2_ick_ops);
2669
2670static struct clk sr_l4_ick;
2671
2672DEFINE_STRUCT_CLK_HW_OMAP(sr_l4_ick, "core_l4_clkdm");
2673DEFINE_STRUCT_CLK(sr_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2674
2675static struct clk ssi_l4_ick;
2676
2677DEFINE_STRUCT_CLK_HW_OMAP(ssi_l4_ick, "core_l4_clkdm");
2678DEFINE_STRUCT_CLK(ssi_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2679
2680static struct clk ssi_ick_3430es1;
2681
2682static const char *ssi_ick_3430es1_parent_names[] = {
2683 "ssi_l4_ick",
2684};
2685
2686static struct clk_hw_omap ssi_ick_3430es1_hw = {
2687 .hw = {
2688 .clk = &ssi_ick_3430es1,
2689 },
2690 .ops = &clkhwops_iclk,
2691 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2692 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2693 .clkdm_name = "core_l4_clkdm",
2694};
2695
2696DEFINE_STRUCT_CLK(ssi_ick_3430es1, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2697
2698static struct clk ssi_ick_3430es2;
2699
2700static struct clk_hw_omap ssi_ick_3430es2_hw = {
2701 .hw = {
2702 .clk = &ssi_ick_3430es2,
2703 },
2704 .ops = &clkhwops_omap3430es2_iclk_ssi_wait,
2705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2706 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2707 .clkdm_name = "core_l4_clkdm",
2708};
2709
2710DEFINE_STRUCT_CLK(ssi_ick_3430es2, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2711
2712static const struct clksel_rate ssi_ssr_corex2_rates[] = {
2713 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2714 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2715 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2716 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2717 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2718 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2719 { .div = 0 }
2720};
2721
2722static const struct clksel ssi_ssr_clksel[] = {
2723 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
2724 { .parent = NULL },
2725};
2726
2727static const char *ssi_ssr_fck_3430es1_parent_names[] = {
2728 "corex2_fck",
2729};
2730
2731static const struct clk_ops ssi_ssr_fck_3430es1_ops = {
2732 .init = &omap2_init_clk_clkdm,
2733 .enable = &omap2_dflt_clk_enable,
2734 .disable = &omap2_dflt_clk_disable,
2735 .is_enabled = &omap2_dflt_clk_is_enabled,
2736 .recalc_rate = &omap2_clksel_recalc,
2737 .set_rate = &omap2_clksel_set_rate,
2738 .round_rate = &omap2_clksel_round_rate,
2739};
2740
2741DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es1, "core_l4_clkdm",
2742 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2743 OMAP3430_CLKSEL_SSI_MASK,
2744 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2745 OMAP3430_EN_SSI_SHIFT,
2746 NULL, ssi_ssr_fck_3430es1_parent_names,
2747 ssi_ssr_fck_3430es1_ops);
2748
2749DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es2, "core_l4_clkdm",
2750 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2751 OMAP3430_CLKSEL_SSI_MASK,
2752 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2753 OMAP3430_EN_SSI_SHIFT,
2754 NULL, ssi_ssr_fck_3430es1_parent_names,
2755 ssi_ssr_fck_3430es1_ops);
2756
2757DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es1, "ssi_ssr_fck_3430es1",
2758 &ssi_ssr_fck_3430es1, 0x0, 1, 2);
2759
2760DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es2, "ssi_ssr_fck_3430es2",
2761 &ssi_ssr_fck_3430es2, 0x0, 1, 2);
2762
2763static struct clk sys_clkout1;
2764
2765static const char *sys_clkout1_parent_names[] = {
2766 "osc_sys_ck",
2767};
2768
2769static struct clk_hw_omap sys_clkout1_hw = {
2770 .hw = {
2771 .clk = &sys_clkout1,
2772 },
2773 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
2774 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
2775};
2776
2777DEFINE_STRUCT_CLK(sys_clkout1, sys_clkout1_parent_names, aes1_ick_ops);
2778
2779DEFINE_CLK_DIVIDER(sys_clkout2, "clkout2_src_ck", &clkout2_src_ck, 0x0,
2780 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_DIV_SHIFT,
2781 OMAP3430_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
2782
2783DEFINE_CLK_MUX(traceclk_src_fck, emu_src_ck_parent_names, NULL, 0x0,
2784 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2785 OMAP3430_TRACE_MUX_CTRL_SHIFT, OMAP3430_TRACE_MUX_CTRL_WIDTH,
2786 0x0, NULL);
2787
2788DEFINE_CLK_DIVIDER(traceclk_fck, "traceclk_src_fck", &traceclk_src_fck, 0x0,
2789 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2790 OMAP3430_CLKSEL_TRACECLK_SHIFT,
2791 OMAP3430_CLKSEL_TRACECLK_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
2792
2793static struct clk ts_fck;
2794
2795static struct clk_hw_omap ts_fck_hw = {
2796 .hw = {
2797 .clk = &ts_fck,
2798 },
2799 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
2800 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
2801 .clkdm_name = "core_l4_clkdm",
2802};
2803
2804DEFINE_STRUCT_CLK(ts_fck, wkup_32k_fck_parent_names, aes2_ick_ops);
2805
2806static struct clk uart1_fck;
2807
2808static struct clk_hw_omap uart1_fck_hw = {
2809 .hw = {
2810 .clk = &uart1_fck,
2811 },
2812 .ops = &clkhwops_wait,
2813 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2814 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2815 .clkdm_name = "core_l4_clkdm",
2816};
2817
2818DEFINE_STRUCT_CLK(uart1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2819
2820static struct clk uart1_ick;
2821
2822static struct clk_hw_omap uart1_ick_hw = {
2823 .hw = {
2824 .clk = &uart1_ick,
2825 },
2826 .ops = &clkhwops_iclk_wait,
2827 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2828 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2829 .clkdm_name = "core_l4_clkdm",
2830};
2831
2832DEFINE_STRUCT_CLK(uart1_ick, aes2_ick_parent_names, aes2_ick_ops);
2833
2834static struct clk uart2_fck;
2835
2836static struct clk_hw_omap uart2_fck_hw = {
2837 .hw = {
2838 .clk = &uart2_fck,
2839 },
2840 .ops = &clkhwops_wait,
2841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2842 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2843 .clkdm_name = "core_l4_clkdm",
2844};
2845
2846DEFINE_STRUCT_CLK(uart2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2847
2848static struct clk uart2_ick;
2849
2850static struct clk_hw_omap uart2_ick_hw = {
2851 .hw = {
2852 .clk = &uart2_ick,
2853 },
2854 .ops = &clkhwops_iclk_wait,
2855 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2856 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2857 .clkdm_name = "core_l4_clkdm",
2858};
2859
2860DEFINE_STRUCT_CLK(uart2_ick, aes2_ick_parent_names, aes2_ick_ops);
2861
2862static struct clk uart3_fck;
2863
2864static const char *uart3_fck_parent_names[] = {
2865 "per_48m_fck",
2866};
2867
2868static struct clk_hw_omap uart3_fck_hw = {
2869 .hw = {
2870 .clk = &uart3_fck,
2871 },
2872 .ops = &clkhwops_wait,
2873 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2874 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2875 .clkdm_name = "per_clkdm",
2876};
2877
2878DEFINE_STRUCT_CLK(uart3_fck, uart3_fck_parent_names, aes2_ick_ops);
2879
2880static struct clk uart3_ick;
2881
2882static struct clk_hw_omap uart3_ick_hw = {
2883 .hw = {
2884 .clk = &uart3_ick,
2885 },
2886 .ops = &clkhwops_iclk_wait,
2887 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2888 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2889 .clkdm_name = "per_clkdm",
2890};
2891
2892DEFINE_STRUCT_CLK(uart3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2893
2894static struct clk uart4_fck;
2895
2896static struct clk_hw_omap uart4_fck_hw = {
2897 .hw = {
2898 .clk = &uart4_fck,
2899 },
2900 .ops = &clkhwops_wait,
2901 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2902 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2903 .clkdm_name = "per_clkdm",
2904};
2905
2906DEFINE_STRUCT_CLK(uart4_fck, uart3_fck_parent_names, aes2_ick_ops);
2907
2908static struct clk uart4_fck_am35xx;
2909
2910static struct clk_hw_omap uart4_fck_am35xx_hw = {
2911 .hw = {
2912 .clk = &uart4_fck_am35xx,
2913 },
2914 .ops = &clkhwops_wait,
2915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2916 .enable_bit = AM35XX_EN_UART4_SHIFT,
2917 .clkdm_name = "core_l4_clkdm",
2918};
2919
2920DEFINE_STRUCT_CLK(uart4_fck_am35xx, fshostusb_fck_parent_names, aes2_ick_ops);
2921
2922static struct clk uart4_ick;
2923
2924static struct clk_hw_omap uart4_ick_hw = {
2925 .hw = {
2926 .clk = &uart4_ick,
2927 },
2928 .ops = &clkhwops_iclk_wait,
2929 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2930 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2931 .clkdm_name = "per_clkdm",
2932};
2933
2934DEFINE_STRUCT_CLK(uart4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2935
2936static struct clk uart4_ick_am35xx;
2937
2938static struct clk_hw_omap uart4_ick_am35xx_hw = {
2939 .hw = {
2940 .clk = &uart4_ick_am35xx,
2941 },
2942 .ops = &clkhwops_iclk_wait,
2943 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2944 .enable_bit = AM35XX_EN_UART4_SHIFT,
2945 .clkdm_name = "core_l4_clkdm",
2946};
2947
2948DEFINE_STRUCT_CLK(uart4_ick_am35xx, aes2_ick_parent_names, aes2_ick_ops);
2949
2950static const struct clksel_rate div2_rates[] = {
2951 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2952 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2953 { .div = 0 }
2954};
2955
2956static const struct clksel usb_l4_clksel[] = {
2957 { .parent = &l4_ick, .rates = div2_rates },
2958 { .parent = NULL },
2959};
2960
2961static const char *usb_l4_ick_parent_names[] = {
2962 "l4_ick",
2963};
2964
2965DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_clksel,
2966 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2967 OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2968 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2969 OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2970 &clkhwops_iclk_wait, usb_l4_ick_parent_names,
2971 ssi_ssr_fck_3430es1_ops);
2972
2973static struct clk usbhost_120m_fck;
2974
2975static const char *usbhost_120m_fck_parent_names[] = {
2976 "dpll5_m2_ck",
2977};
2978
2979static struct clk_hw_omap usbhost_120m_fck_hw = {
2980 .hw = {
2981 .clk = &usbhost_120m_fck,
2982 },
2983 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2984 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2985 .clkdm_name = "usbhost_clkdm",
2986};
2987
2988DEFINE_STRUCT_CLK(usbhost_120m_fck, usbhost_120m_fck_parent_names,
2989 aes2_ick_ops);
2990
2991static struct clk usbhost_48m_fck;
2992
2993static struct clk_hw_omap usbhost_48m_fck_hw = {
2994 .hw = {
2995 .clk = &usbhost_48m_fck,
2996 },
2997 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
2998 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2999 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
3000 .clkdm_name = "usbhost_clkdm",
3001};
3002
3003DEFINE_STRUCT_CLK(usbhost_48m_fck, core_48m_fck_parent_names, aes2_ick_ops);
3004
3005static struct clk usbhost_ick;
3006
3007static struct clk_hw_omap usbhost_ick_hw = {
3008 .hw = {
3009 .clk = &usbhost_ick,
3010 },
3011 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
3012 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
3013 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
3014 .clkdm_name = "usbhost_clkdm",
3015};
3016
3017DEFINE_STRUCT_CLK(usbhost_ick, security_l4_ick2_parent_names, aes2_ick_ops);
3018
3019static struct clk usbtll_fck;
3020
3021static struct clk_hw_omap usbtll_fck_hw = {
3022 .hw = {
3023 .clk = &usbtll_fck,
3024 },
3025 .ops = &clkhwops_wait,
3026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
3027 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3028 .clkdm_name = "core_l4_clkdm",
3029};
3030
3031DEFINE_STRUCT_CLK(usbtll_fck, usbhost_120m_fck_parent_names, aes2_ick_ops);
3032
3033static struct clk usbtll_ick;
3034
3035static struct clk_hw_omap usbtll_ick_hw = {
3036 .hw = {
3037 .clk = &usbtll_ick,
3038 },
3039 .ops = &clkhwops_iclk_wait,
3040 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
3041 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3042 .clkdm_name = "core_l4_clkdm",
3043};
3044
3045DEFINE_STRUCT_CLK(usbtll_ick, aes2_ick_parent_names, aes2_ick_ops);
3046
3047static const struct clksel_rate usim_96m_rates[] = {
3048 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
3049 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3050 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
3051 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
3052 { .div = 0 }
3053};
3054
3055static const struct clksel_rate usim_120m_rates[] = {
3056 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
3057 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
3058 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
3059 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
3060 { .div = 0 }
3061};
3062
3063static const struct clksel usim_clksel[] = {
3064 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
3065 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
3066 { .parent = &sys_ck, .rates = div2_rates },
3067 { .parent = NULL },
3068};
3069
3070static const char *usim_fck_parent_names[] = {
3071 "omap_96m_fck", "dpll5_m2_ck", "sys_ck",
3072};
3073
3074static struct clk usim_fck;
3075
3076static const struct clk_ops usim_fck_ops = {
3077 .enable = &omap2_dflt_clk_enable,
3078 .disable = &omap2_dflt_clk_disable,
3079 .is_enabled = &omap2_dflt_clk_is_enabled,
3080 .recalc_rate = &omap2_clksel_recalc,
3081 .get_parent = &omap2_clksel_find_parent_index,
3082 .set_parent = &omap2_clksel_set_parent,
3083};
3084
3085DEFINE_CLK_OMAP_MUX_GATE(usim_fck, NULL, usim_clksel,
3086 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
3087 OMAP3430ES2_CLKSEL_USIMOCP_MASK,
3088 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3089 OMAP3430ES2_EN_USIMOCP_SHIFT, &clkhwops_wait,
3090 usim_fck_parent_names, usim_fck_ops);
3091
3092static struct clk usim_ick;
3093
3094static struct clk_hw_omap usim_ick_hw = {
3095 .hw = {
3096 .clk = &usim_ick,
3097 },
3098 .ops = &clkhwops_iclk_wait,
3099 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3100 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
3101 .clkdm_name = "wkup_clkdm",
3102};
3103
3104DEFINE_STRUCT_CLK(usim_ick, gpio1_ick_parent_names, aes2_ick_ops);
3105
3106static struct clk vpfe_fck;
3107
3108static const char *vpfe_fck_parent_names[] = {
3109 "pclk_ck",
3110};
3111
3112static struct clk_hw_omap vpfe_fck_hw = {
3113 .hw = {
3114 .clk = &vpfe_fck,
3115 },
3116 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3117 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3118};
3119
3120DEFINE_STRUCT_CLK(vpfe_fck, vpfe_fck_parent_names, aes1_ick_ops);
3121
3122static struct clk vpfe_ick;
3123
3124static struct clk_hw_omap vpfe_ick_hw = {
3125 .hw = {
3126 .clk = &vpfe_ick,
3127 },
3128 .ops = &clkhwops_am35xx_ipss_module_wait,
3129 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3130 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3131 .clkdm_name = "core_l3_clkdm",
3132};
3133
3134DEFINE_STRUCT_CLK(vpfe_ick, emac_ick_parent_names, aes2_ick_ops);
3135
3136static struct clk wdt1_fck;
3137
3138DEFINE_STRUCT_CLK_HW_OMAP(wdt1_fck, "wkup_clkdm");
3139DEFINE_STRUCT_CLK(wdt1_fck, gpt12_fck_parent_names, core_l4_ick_ops);
3140
3141static struct clk wdt1_ick;
3142
3143static struct clk_hw_omap wdt1_ick_hw = {
3144 .hw = {
3145 .clk = &wdt1_ick,
3146 },
3147 .ops = &clkhwops_iclk_wait,
3148 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3149 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
3150 .clkdm_name = "wkup_clkdm",
3151};
3152
3153DEFINE_STRUCT_CLK(wdt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
3154
3155static struct clk wdt2_fck;
3156
3157static struct clk_hw_omap wdt2_fck_hw = {
3158 .hw = {
3159 .clk = &wdt2_fck,
3160 },
3161 .ops = &clkhwops_wait,
3162 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3163 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3164 .clkdm_name = "wkup_clkdm",
3165};
3166
3167DEFINE_STRUCT_CLK(wdt2_fck, gpio1_dbck_parent_names, aes2_ick_ops);
3168
3169static struct clk wdt2_ick;
3170
3171static struct clk_hw_omap wdt2_ick_hw = {
3172 .hw = {
3173 .clk = &wdt2_ick,
3174 },
3175 .ops = &clkhwops_iclk_wait,
3176 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3177 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3178 .clkdm_name = "wkup_clkdm",
3179};
3180
3181DEFINE_STRUCT_CLK(wdt2_ick, gpio1_ick_parent_names, aes2_ick_ops);
3182
3183static struct clk wdt3_fck;
3184
3185static struct clk_hw_omap wdt3_fck_hw = {
3186 .hw = {
3187 .clk = &wdt3_fck,
3188 },
3189 .ops = &clkhwops_wait,
3190 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
3191 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3192 .clkdm_name = "per_clkdm",
3193};
3194
3195DEFINE_STRUCT_CLK(wdt3_fck, gpio2_dbck_parent_names, aes2_ick_ops);
3196
3197static struct clk wdt3_ick;
3198
3199static struct clk_hw_omap wdt3_ick_hw = {
3200 .hw = {
3201 .clk = &wdt3_ick,
3202 },
3203 .ops = &clkhwops_iclk_wait,
3204 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
3205 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3206 .clkdm_name = "per_clkdm",
3207};
3208
3209DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
3210
3211/*
3212 * clkdev
3213 */
3214static struct omap_clk omap3xxx_clks[] = {
3215 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3216 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3217 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3218 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3219 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3220 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3221 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3222 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3223 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3224 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3225 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3226 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3227 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3228 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3229 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3230 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3231 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3232 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3233 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3234 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3235 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3236 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3237 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3238 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3239 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3241 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3242 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3243 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3244 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3245 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3246 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3247 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3248 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3249 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3250 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3251 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3252 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3253 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3254 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3255 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3256 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3257 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3261 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3262 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3263 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3264 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3265 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3266 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3267 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3268 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3269 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3270 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3271 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3272 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3273 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3274 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3275 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3276 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3277 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3278 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3279 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3280 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3281 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3282 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3283 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3284 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3285 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3286 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3287 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3288 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3289 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3292 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3293 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3294 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3295 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3296 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3297 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3298 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3299 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3300 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3301 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3302 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3303 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3304 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3305 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3306 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3307 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3308 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3309 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3310 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3311 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3312 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3313 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3314 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3315 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3316 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3317 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3318 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3319 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3320 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3321 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3322 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3323 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3324 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3325 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3326 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3327 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3328 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3329 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3330 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3331 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3332 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3333 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3334 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3335 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3336 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3337 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3338 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3339 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3340 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3341 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3342 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3343 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3344 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3345 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3346 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3347 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3348 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3349 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3350 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3351 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3352 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3353 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3354 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3355 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3356 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3357 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3358 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3359 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3360 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3361 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3362 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3363 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3364 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3365 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3366 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3367 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3368 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3369 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3370 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3371 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3372 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3373 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3374 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3375 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3376 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3378 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3379 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3380 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3381 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3382 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3383 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3384 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3385 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3386 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3387 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3388 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3389 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3390 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3391 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3392 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3393 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3394 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3396 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3397 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3398 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3399 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3400 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3401 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3402 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3403 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3404 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3407 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3408 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3409 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3410 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3411 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3412 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3413 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3414 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3415 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3416 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3417 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3418 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3419 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3420 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3421 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3422 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3423 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3424 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3425 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3426 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3427 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3428 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3429 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3430 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3431 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3432 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3433 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3434 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3435 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3436 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3437 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3438 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3439 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3440 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3441 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3442 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3443 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3444 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3445 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3446 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3447 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3448 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3449 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3450 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3451 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3452 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3453 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3454 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3455 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3456 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3457 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3458 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3459 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3460 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3461 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3462 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3463 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3464 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3465 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3466 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3467 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3468 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3469 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3470 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3471 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3472 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3473 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3474 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3475 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3476 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3477 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3478 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3479 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3480 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3481 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3482 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3483 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3484 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3485 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3486 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3487 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3488 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3489 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3490 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3491 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3492 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3493 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3494 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3495};
3496
3497static const char *enable_init_clks[] = {
3498 "sdrc_ick",
3499 "gpmc_fck",
3500 "omapctrl_ick",
3501};
3502
3503int __init omap3xxx_clk_init(void)
3504{
3505 struct omap_clk *c;
3506 u32 cpu_clkflg = 0;
3507
3508 /*
3509 * 3505 must be tested before 3517, since 3517 returns true
3510 * for both AM3517 chips and AM3517 family chips, which
3511 * includes 3505. Unfortunately there's no obvious family
3512 * test for 3517/3505 :-(
3513 */
3514 if (soc_is_am35xx()) {
3515 cpu_mask = RATE_IN_34XX;
3516 cpu_clkflg = CK_AM35XX;
3517 } else if (cpu_is_omap3630()) {
3518 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3519 cpu_clkflg = CK_36XX;
3520 } else if (cpu_is_ti816x()) {
3521 cpu_mask = RATE_IN_TI816X;
3522 cpu_clkflg = CK_TI816X;
3523 } else if (soc_is_am33xx()) {
3524 cpu_mask = RATE_IN_AM33XX;
3525 } else if (cpu_is_ti814x()) {
3526 cpu_mask = RATE_IN_TI814X;
3527 } else if (cpu_is_omap34xx()) {
3528 if (omap_rev() == OMAP3430_REV_ES1_0) {
3529 cpu_mask = RATE_IN_3430ES1;
3530 cpu_clkflg = CK_3430ES1;
3531 } else {
3532 /*
3533 * Assume that anything that we haven't matched yet
3534 * has 3430ES2-type clocks.
3535 */
3536 cpu_mask = RATE_IN_3430ES2PLUS;
3537 cpu_clkflg = CK_3430ES2PLUS;
3538 }
3539 } else {
3540 WARN(1, "clock: could not identify OMAP3 variant\n");
3541 }
3542
3543 if (omap3_has_192mhz_clk())
3544 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3545
3546 if (cpu_is_omap3630()) {
3547 dpll3_m3x2_ck = dpll3_m3x2_ck_3630;
3548 dpll4_m2x2_ck = dpll4_m2x2_ck_3630;
3549 dpll4_m3x2_ck = dpll4_m3x2_ck_3630;
3550 dpll4_m4x2_ck = dpll4_m4x2_ck_3630;
3551 dpll4_m5x2_ck = dpll4_m5x2_ck_3630;
3552 dpll4_m6x2_ck = dpll4_m6x2_ck_3630;
3553 }
3554
3555 /*
3556 * XXX This type of dynamic rewriting of the clock tree is
3557 * deprecated and should be revised soon.
3558 */
3559 if (cpu_is_omap3630())
3560 dpll4_dd = dpll4_dd_3630;
3561 else
3562 dpll4_dd = dpll4_dd_34xx;
3563
3564 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3565 c++)
3566 if (c->cpu & cpu_clkflg) {
3567 clkdev_add(&c->lk);
3568 if (!__clk_init(NULL, c->lk.clk))
3569 omap2_init_clk_hw_omap_clocks(c->lk.clk);
3570 }
3571
3572 omap2_clk_disable_autoidle_all();
3573
3574 omap2_clk_enable_init_clocks(enable_init_clks,
3575 ARRAY_SIZE(enable_init_clks));
3576
3577 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3578 (clk_get_rate(&osc_sys_ck) / 1000000),
3579 (clk_get_rate(&osc_sys_ck) / 100000) % 10,
3580 (clk_get_rate(&core_ck) / 1000000),
3581 (clk_get_rate(&arm_fck) / 1000000));
3582
3583 /*
3584 * Lock DPLL5 -- here only until other device init code can
3585 * handle this
3586 */
3587 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3588 omap3_clk_lock_dpll5();
3589
3590 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3591 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3592 arm_fck_p = clk_get(NULL, "arm_fck");
3593
3594 return 0;
3595}
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
new file mode 100644
index 000000000000..aa56c3e5bb34
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -0,0 +1,1987 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2012 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 * Mike Turquette (mturquette@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 version 2 as
14 * published by the Free Software Foundation.
15 *
16 * XXX Some of the ES1 clocks have been removed/changed; once support
17 * is added for discriminating clocks by ES level, these should be added back
18 * in.
19 */
20
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/clk-private.h>
24#include <linux/clkdev.h>
25#include <linux/io.h>
26
27#include "soc.h"
28#include "iomap.h"
29#include "clock.h"
30#include "clock44xx.h"
31#include "cm1_44xx.h"
32#include "cm2_44xx.h"
33#include "cm-regbits-44xx.h"
34#include "prm44xx.h"
35#include "prm-regbits-44xx.h"
36#include "control.h"
37#include "scrm44xx.h"
38
39/* OMAP4 modulemode control */
40#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0
41#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1
42
43/* Root clocks */
44
45DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
46
47DEFINE_CLK_FIXED_RATE(pad_clks_src_ck, CLK_IS_ROOT, 12000000, 0x0);
48
49DEFINE_CLK_GATE(pad_clks_ck, "pad_clks_src_ck", &pad_clks_src_ck, 0x0,
50 OMAP4430_CM_CLKSEL_ABE, OMAP4430_PAD_CLKS_GATE_SHIFT,
51 0x0, NULL);
52
53DEFINE_CLK_FIXED_RATE(pad_slimbus_core_clks_ck, CLK_IS_ROOT, 12000000, 0x0);
54
55DEFINE_CLK_FIXED_RATE(secure_32k_clk_src_ck, CLK_IS_ROOT, 32768, 0x0);
56
57DEFINE_CLK_FIXED_RATE(slimbus_src_clk, CLK_IS_ROOT, 12000000, 0x0);
58
59DEFINE_CLK_GATE(slimbus_clk, "slimbus_src_clk", &slimbus_src_clk, 0x0,
60 OMAP4430_CM_CLKSEL_ABE, OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
61 0x0, NULL);
62
63DEFINE_CLK_FIXED_RATE(sys_32k_ck, CLK_IS_ROOT, 32768, 0x0);
64
65DEFINE_CLK_FIXED_RATE(virt_12000000_ck, CLK_IS_ROOT, 12000000, 0x0);
66
67DEFINE_CLK_FIXED_RATE(virt_13000000_ck, CLK_IS_ROOT, 13000000, 0x0);
68
69DEFINE_CLK_FIXED_RATE(virt_16800000_ck, CLK_IS_ROOT, 16800000, 0x0);
70
71DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
72
73DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
74
75DEFINE_CLK_FIXED_RATE(virt_27000000_ck, CLK_IS_ROOT, 27000000, 0x0);
76
77DEFINE_CLK_FIXED_RATE(virt_38400000_ck, CLK_IS_ROOT, 38400000, 0x0);
78
79static const char *sys_clkin_ck_parents[] = {
80 "virt_12000000_ck", "virt_13000000_ck", "virt_16800000_ck",
81 "virt_19200000_ck", "virt_26000000_ck", "virt_27000000_ck",
82 "virt_38400000_ck",
83};
84
85DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
86 OMAP4430_CM_SYS_CLKSEL, OMAP4430_SYS_CLKSEL_SHIFT,
87 OMAP4430_SYS_CLKSEL_WIDTH, CLK_MUX_INDEX_ONE, NULL);
88
89DEFINE_CLK_FIXED_RATE(tie_low_clock_ck, CLK_IS_ROOT, 0, 0x0);
90
91DEFINE_CLK_FIXED_RATE(utmi_phy_clkout_ck, CLK_IS_ROOT, 60000000, 0x0);
92
93DEFINE_CLK_FIXED_RATE(xclk60mhsp1_ck, CLK_IS_ROOT, 60000000, 0x0);
94
95DEFINE_CLK_FIXED_RATE(xclk60mhsp2_ck, CLK_IS_ROOT, 60000000, 0x0);
96
97DEFINE_CLK_FIXED_RATE(xclk60motg_ck, CLK_IS_ROOT, 60000000, 0x0);
98
99/* Module clocks and DPLL outputs */
100
101static const char *abe_dpll_bypass_clk_mux_ck_parents[] = {
102 "sys_clkin_ck", "sys_32k_ck",
103};
104
105DEFINE_CLK_MUX(abe_dpll_bypass_clk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents,
106 NULL, 0x0, OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_SHIFT,
107 OMAP4430_CLKSEL_WIDTH, 0x0, NULL);
108
109DEFINE_CLK_MUX(abe_dpll_refclk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents, NULL,
110 0x0, OMAP4430_CM_ABE_PLL_REF_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
111 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
112
113/* DPLL_ABE */
114static struct dpll_data dpll_abe_dd = {
115 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
116 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
117 .clk_ref = &abe_dpll_refclk_mux_ck,
118 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
119 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
120 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
121 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
122 .mult_mask = OMAP4430_DPLL_MULT_MASK,
123 .div1_mask = OMAP4430_DPLL_DIV_MASK,
124 .enable_mask = OMAP4430_DPLL_EN_MASK,
125 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
126 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
127 .max_multiplier = 2047,
128 .max_divider = 128,
129 .min_divider = 1,
130};
131
132
133static const char *dpll_abe_ck_parents[] = {
134 "abe_dpll_refclk_mux_ck",
135};
136
137static struct clk dpll_abe_ck;
138
139static const struct clk_ops dpll_abe_ck_ops = {
140 .enable = &omap3_noncore_dpll_enable,
141 .disable = &omap3_noncore_dpll_disable,
142 .recalc_rate = &omap4_dpll_regm4xen_recalc,
143 .round_rate = &omap4_dpll_regm4xen_round_rate,
144 .set_rate = &omap3_noncore_dpll_set_rate,
145 .get_parent = &omap2_init_dpll_parent,
146};
147
148static struct clk_hw_omap dpll_abe_ck_hw = {
149 .hw = {
150 .clk = &dpll_abe_ck,
151 },
152 .dpll_data = &dpll_abe_dd,
153 .ops = &clkhwops_omap3_dpll,
154};
155
156DEFINE_STRUCT_CLK(dpll_abe_ck, dpll_abe_ck_parents, dpll_abe_ck_ops);
157
158static const char *dpll_abe_x2_ck_parents[] = {
159 "dpll_abe_ck",
160};
161
162static struct clk dpll_abe_x2_ck;
163
164static const struct clk_ops dpll_abe_x2_ck_ops = {
165 .recalc_rate = &omap3_clkoutx2_recalc,
166};
167
168static struct clk_hw_omap dpll_abe_x2_ck_hw = {
169 .hw = {
170 .clk = &dpll_abe_x2_ck,
171 },
172 .flags = CLOCK_CLKOUTX2,
173 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
174 .ops = &clkhwops_omap4_dpllmx,
175};
176
177DEFINE_STRUCT_CLK(dpll_abe_x2_ck, dpll_abe_x2_ck_parents, dpll_abe_x2_ck_ops);
178
179static const struct clk_ops omap_hsdivider_ops = {
180 .set_rate = &omap2_clksel_set_rate,
181 .recalc_rate = &omap2_clksel_recalc,
182 .round_rate = &omap2_clksel_round_rate,
183};
184
185DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m2x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
186 0x0, OMAP4430_CM_DIV_M2_DPLL_ABE,
187 OMAP4430_DPLL_CLKOUT_DIV_MASK);
188
189DEFINE_CLK_FIXED_FACTOR(abe_24m_fclk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
190 0x0, 1, 8);
191
192DEFINE_CLK_DIVIDER(abe_clk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, 0x0,
193 OMAP4430_CM_CLKSEL_ABE, OMAP4430_CLKSEL_OPP_SHIFT,
194 OMAP4430_CLKSEL_OPP_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
195
196DEFINE_CLK_DIVIDER(aess_fclk, "abe_clk", &abe_clk, 0x0,
197 OMAP4430_CM1_ABE_AESS_CLKCTRL,
198 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
199 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
200 0x0, NULL);
201
202DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m3x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
203 0x0, OMAP4430_CM_DIV_M3_DPLL_ABE,
204 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK);
205
206static const char *core_hsd_byp_clk_mux_ck_parents[] = {
207 "sys_clkin_ck", "dpll_abe_m3x2_ck",
208};
209
210DEFINE_CLK_MUX(core_hsd_byp_clk_mux_ck, core_hsd_byp_clk_mux_ck_parents, NULL,
211 0x0, OMAP4430_CM_CLKSEL_DPLL_CORE,
212 OMAP4430_DPLL_BYP_CLKSEL_SHIFT, OMAP4430_DPLL_BYP_CLKSEL_WIDTH,
213 0x0, NULL);
214
215/* DPLL_CORE */
216static struct dpll_data dpll_core_dd = {
217 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
218 .clk_bypass = &core_hsd_byp_clk_mux_ck,
219 .clk_ref = &sys_clkin_ck,
220 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
221 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
222 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
223 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
224 .mult_mask = OMAP4430_DPLL_MULT_MASK,
225 .div1_mask = OMAP4430_DPLL_DIV_MASK,
226 .enable_mask = OMAP4430_DPLL_EN_MASK,
227 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
228 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
229 .max_multiplier = 2047,
230 .max_divider = 128,
231 .min_divider = 1,
232};
233
234
235static const char *dpll_core_ck_parents[] = {
236 "sys_clkin_ck",
237};
238
239static struct clk dpll_core_ck;
240
241static const struct clk_ops dpll_core_ck_ops = {
242 .recalc_rate = &omap3_dpll_recalc,
243 .get_parent = &omap2_init_dpll_parent,
244};
245
246static struct clk_hw_omap dpll_core_ck_hw = {
247 .hw = {
248 .clk = &dpll_core_ck,
249 },
250 .dpll_data = &dpll_core_dd,
251 .ops = &clkhwops_omap3_dpll,
252};
253
254DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
255
256static const char *dpll_core_x2_ck_parents[] = {
257 "dpll_core_ck",
258};
259
260static struct clk dpll_core_x2_ck;
261
262static struct clk_hw_omap dpll_core_x2_ck_hw = {
263 .hw = {
264 .clk = &dpll_core_x2_ck,
265 },
266};
267
268DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_abe_x2_ck_ops);
269
270DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m6x2_ck, "dpll_core_x2_ck",
271 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M6_DPLL_CORE,
272 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
273
274DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m2_ck, "dpll_core_ck", &dpll_core_ck, 0x0,
275 OMAP4430_CM_DIV_M2_DPLL_CORE,
276 OMAP4430_DPLL_CLKOUT_DIV_MASK);
277
278DEFINE_CLK_FIXED_FACTOR(ddrphy_ck, "dpll_core_m2_ck", &dpll_core_m2_ck, 0x0, 1,
279 2);
280
281DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m5x2_ck, "dpll_core_x2_ck",
282 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M5_DPLL_CORE,
283 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
284
285DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0,
286 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT,
287 OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL);
288
289DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck",
290 &dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA,
291 OMAP4430_CLKSEL_0_1_MASK);
292
293DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
294 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT,
295 OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
296
297DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m4x2_ck, "dpll_core_x2_ck",
298 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M4_DPLL_CORE,
299 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
300
301DEFINE_CLK_FIXED_FACTOR(dll_clk_div_ck, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck,
302 0x0, 1, 2);
303
304DEFINE_CLK_DIVIDER(dpll_abe_m2_ck, "dpll_abe_ck", &dpll_abe_ck, 0x0,
305 OMAP4430_CM_DIV_M2_DPLL_ABE, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
306 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
307
308static const struct clk_ops dmic_fck_ops = {
309 .enable = &omap2_dflt_clk_enable,
310 .disable = &omap2_dflt_clk_disable,
311 .is_enabled = &omap2_dflt_clk_is_enabled,
312 .recalc_rate = &omap2_clksel_recalc,
313 .get_parent = &omap2_clksel_find_parent_index,
314 .set_parent = &omap2_clksel_set_parent,
315 .init = &omap2_init_clk_clkdm,
316};
317
318static const char *dpll_core_m3x2_ck_parents[] = {
319 "dpll_core_x2_ck",
320};
321
322static const struct clksel dpll_core_m3x2_div[] = {
323 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
324 { .parent = NULL },
325};
326
327/* XXX Missing round_rate, set_rate in ops */
328DEFINE_CLK_OMAP_MUX_GATE(dpll_core_m3x2_ck, NULL, dpll_core_m3x2_div,
329 OMAP4430_CM_DIV_M3_DPLL_CORE,
330 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
331 OMAP4430_CM_DIV_M3_DPLL_CORE,
332 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
333 dpll_core_m3x2_ck_parents, dmic_fck_ops);
334
335DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m7x2_ck, "dpll_core_x2_ck",
336 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M7_DPLL_CORE,
337 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
338
339static const char *iva_hsd_byp_clk_mux_ck_parents[] = {
340 "sys_clkin_ck", "div_iva_hs_clk",
341};
342
343DEFINE_CLK_MUX(iva_hsd_byp_clk_mux_ck, iva_hsd_byp_clk_mux_ck_parents, NULL,
344 0x0, OMAP4430_CM_CLKSEL_DPLL_IVA, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
345 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
346
347/* DPLL_IVA */
348static struct dpll_data dpll_iva_dd = {
349 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
350 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
351 .clk_ref = &sys_clkin_ck,
352 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
353 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
354 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
355 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
356 .mult_mask = OMAP4430_DPLL_MULT_MASK,
357 .div1_mask = OMAP4430_DPLL_DIV_MASK,
358 .enable_mask = OMAP4430_DPLL_EN_MASK,
359 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
360 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
361 .max_multiplier = 2047,
362 .max_divider = 128,
363 .min_divider = 1,
364};
365
366static struct clk dpll_iva_ck;
367
368static struct clk_hw_omap dpll_iva_ck_hw = {
369 .hw = {
370 .clk = &dpll_iva_ck,
371 },
372 .dpll_data = &dpll_iva_dd,
373 .ops = &clkhwops_omap3_dpll,
374};
375
376DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
377
378static const char *dpll_iva_x2_ck_parents[] = {
379 "dpll_iva_ck",
380};
381
382static struct clk dpll_iva_x2_ck;
383
384static struct clk_hw_omap dpll_iva_x2_ck_hw = {
385 .hw = {
386 .clk = &dpll_iva_x2_ck,
387 },
388};
389
390DEFINE_STRUCT_CLK(dpll_iva_x2_ck, dpll_iva_x2_ck_parents, dpll_abe_x2_ck_ops);
391
392DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m4x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
393 0x0, OMAP4430_CM_DIV_M4_DPLL_IVA,
394 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
395
396DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m5x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
397 0x0, OMAP4430_CM_DIV_M5_DPLL_IVA,
398 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
399
400/* DPLL_MPU */
401static struct dpll_data dpll_mpu_dd = {
402 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
403 .clk_bypass = &div_mpu_hs_clk,
404 .clk_ref = &sys_clkin_ck,
405 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
406 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
407 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
408 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
409 .mult_mask = OMAP4430_DPLL_MULT_MASK,
410 .div1_mask = OMAP4430_DPLL_DIV_MASK,
411 .enable_mask = OMAP4430_DPLL_EN_MASK,
412 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
413 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
414 .max_multiplier = 2047,
415 .max_divider = 128,
416 .min_divider = 1,
417};
418
419static struct clk dpll_mpu_ck;
420
421static struct clk_hw_omap dpll_mpu_ck_hw = {
422 .hw = {
423 .clk = &dpll_mpu_ck,
424 },
425 .dpll_data = &dpll_mpu_dd,
426 .ops = &clkhwops_omap3_dpll,
427};
428
429DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
430
431DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2);
432
433DEFINE_CLK_OMAP_HSDIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck, 0x0,
434 OMAP4430_CM_DIV_M2_DPLL_MPU,
435 OMAP4430_DPLL_CLKOUT_DIV_MASK);
436
437DEFINE_CLK_FIXED_FACTOR(per_hs_clk_div_ck, "dpll_abe_m3x2_ck",
438 &dpll_abe_m3x2_ck, 0x0, 1, 2);
439
440static const char *per_hsd_byp_clk_mux_ck_parents[] = {
441 "sys_clkin_ck", "per_hs_clk_div_ck",
442};
443
444DEFINE_CLK_MUX(per_hsd_byp_clk_mux_ck, per_hsd_byp_clk_mux_ck_parents, NULL,
445 0x0, OMAP4430_CM_CLKSEL_DPLL_PER, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
446 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
447
448/* DPLL_PER */
449static struct dpll_data dpll_per_dd = {
450 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
451 .clk_bypass = &per_hsd_byp_clk_mux_ck,
452 .clk_ref = &sys_clkin_ck,
453 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
454 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
455 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
456 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
457 .mult_mask = OMAP4430_DPLL_MULT_MASK,
458 .div1_mask = OMAP4430_DPLL_DIV_MASK,
459 .enable_mask = OMAP4430_DPLL_EN_MASK,
460 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
461 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
462 .max_multiplier = 2047,
463 .max_divider = 128,
464 .min_divider = 1,
465};
466
467
468static struct clk dpll_per_ck;
469
470static struct clk_hw_omap dpll_per_ck_hw = {
471 .hw = {
472 .clk = &dpll_per_ck,
473 },
474 .dpll_data = &dpll_per_dd,
475 .ops = &clkhwops_omap3_dpll,
476};
477
478DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
479
480DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
481 OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
482 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
483
484static const char *dpll_per_x2_ck_parents[] = {
485 "dpll_per_ck",
486};
487
488static struct clk dpll_per_x2_ck;
489
490static struct clk_hw_omap dpll_per_x2_ck_hw = {
491 .hw = {
492 .clk = &dpll_per_x2_ck,
493 },
494 .flags = CLOCK_CLKOUTX2,
495 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
496 .ops = &clkhwops_omap4_dpllmx,
497};
498
499DEFINE_STRUCT_CLK(dpll_per_x2_ck, dpll_per_x2_ck_parents, dpll_abe_x2_ck_ops);
500
501DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m2x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
502 0x0, OMAP4430_CM_DIV_M2_DPLL_PER,
503 OMAP4430_DPLL_CLKOUT_DIV_MASK);
504
505static const char *dpll_per_m3x2_ck_parents[] = {
506 "dpll_per_x2_ck",
507};
508
509static const struct clksel dpll_per_m3x2_div[] = {
510 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
511 { .parent = NULL },
512};
513
514/* XXX Missing round_rate, set_rate in ops */
515DEFINE_CLK_OMAP_MUX_GATE(dpll_per_m3x2_ck, NULL, dpll_per_m3x2_div,
516 OMAP4430_CM_DIV_M3_DPLL_PER,
517 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
518 OMAP4430_CM_DIV_M3_DPLL_PER,
519 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
520 dpll_per_m3x2_ck_parents, dmic_fck_ops);
521
522DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m4x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
523 0x0, OMAP4430_CM_DIV_M4_DPLL_PER,
524 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
525
526DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m5x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
527 0x0, OMAP4430_CM_DIV_M5_DPLL_PER,
528 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
529
530DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m6x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
531 0x0, OMAP4430_CM_DIV_M6_DPLL_PER,
532 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
533
534DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m7x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
535 0x0, OMAP4430_CM_DIV_M7_DPLL_PER,
536 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
537
538DEFINE_CLK_FIXED_FACTOR(usb_hs_clk_div_ck, "dpll_abe_m3x2_ck",
539 &dpll_abe_m3x2_ck, 0x0, 1, 3);
540
541/* DPLL_USB */
542static struct dpll_data dpll_usb_dd = {
543 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
544 .clk_bypass = &usb_hs_clk_div_ck,
545 .flags = DPLL_J_TYPE,
546 .clk_ref = &sys_clkin_ck,
547 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
548 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
549 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
550 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
551 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
552 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
553 .enable_mask = OMAP4430_DPLL_EN_MASK,
554 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
555 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
556 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
557 .max_multiplier = 4095,
558 .max_divider = 256,
559 .min_divider = 1,
560};
561
562static struct clk dpll_usb_ck;
563
564static struct clk_hw_omap dpll_usb_ck_hw = {
565 .hw = {
566 .clk = &dpll_usb_ck,
567 },
568 .dpll_data = &dpll_usb_dd,
569 .ops = &clkhwops_omap3_dpll,
570};
571
572DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
573
574static const char *dpll_usb_clkdcoldo_ck_parents[] = {
575 "dpll_usb_ck",
576};
577
578static struct clk dpll_usb_clkdcoldo_ck;
579
580static const struct clk_ops dpll_usb_clkdcoldo_ck_ops = {
581};
582
583static struct clk_hw_omap dpll_usb_clkdcoldo_ck_hw = {
584 .hw = {
585 .clk = &dpll_usb_clkdcoldo_ck,
586 },
587 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
588 .ops = &clkhwops_omap4_dpllmx,
589};
590
591DEFINE_STRUCT_CLK(dpll_usb_clkdcoldo_ck, dpll_usb_clkdcoldo_ck_parents,
592 dpll_usb_clkdcoldo_ck_ops);
593
594DEFINE_CLK_OMAP_HSDIVIDER(dpll_usb_m2_ck, "dpll_usb_ck", &dpll_usb_ck, 0x0,
595 OMAP4430_CM_DIV_M2_DPLL_USB,
596 OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK);
597
598static const char *ducati_clk_mux_ck_parents[] = {
599 "div_core_ck", "dpll_per_m6x2_ck",
600};
601
602DEFINE_CLK_MUX(ducati_clk_mux_ck, ducati_clk_mux_ck_parents, NULL, 0x0,
603 OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT, OMAP4430_CLKSEL_0_0_SHIFT,
604 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
605
606DEFINE_CLK_FIXED_FACTOR(func_12m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
607 0x0, 1, 16);
608
609DEFINE_CLK_FIXED_FACTOR(func_24m_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0,
610 1, 4);
611
612DEFINE_CLK_FIXED_FACTOR(func_24mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
613 0x0, 1, 8);
614
615static const struct clk_div_table func_48m_fclk_rates[] = {
616 { .div = 4, .val = 0 },
617 { .div = 8, .val = 1 },
618 { .div = 0 },
619};
620DEFINE_CLK_DIVIDER_TABLE(func_48m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
621 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
622 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_48m_fclk_rates,
623 NULL);
624
625DEFINE_CLK_FIXED_FACTOR(func_48mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
626 0x0, 1, 4);
627
628static const struct clk_div_table func_64m_fclk_rates[] = {
629 { .div = 2, .val = 0 },
630 { .div = 4, .val = 1 },
631 { .div = 0 },
632};
633DEFINE_CLK_DIVIDER_TABLE(func_64m_fclk, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck,
634 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
635 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_64m_fclk_rates,
636 NULL);
637
638static const struct clk_div_table func_96m_fclk_rates[] = {
639 { .div = 2, .val = 0 },
640 { .div = 4, .val = 1 },
641 { .div = 0 },
642};
643DEFINE_CLK_DIVIDER_TABLE(func_96m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
644 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
645 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_96m_fclk_rates,
646 NULL);
647
648static const struct clk_div_table init_60m_fclk_rates[] = {
649 { .div = 1, .val = 0 },
650 { .div = 8, .val = 1 },
651 { .div = 0 },
652};
653DEFINE_CLK_DIVIDER_TABLE(init_60m_fclk, "dpll_usb_m2_ck", &dpll_usb_m2_ck,
654 0x0, OMAP4430_CM_CLKSEL_USB_60MHZ,
655 OMAP4430_CLKSEL_0_0_SHIFT, OMAP4430_CLKSEL_0_0_WIDTH,
656 0x0, init_60m_fclk_rates, NULL);
657
658DEFINE_CLK_DIVIDER(l3_div_ck, "div_core_ck", &div_core_ck, 0x0,
659 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L3_SHIFT,
660 OMAP4430_CLKSEL_L3_WIDTH, 0x0, NULL);
661
662DEFINE_CLK_DIVIDER(l4_div_ck, "l3_div_ck", &l3_div_ck, 0x0,
663 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L4_SHIFT,
664 OMAP4430_CLKSEL_L4_WIDTH, 0x0, NULL);
665
666DEFINE_CLK_FIXED_FACTOR(lp_clk_div_ck, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
667 0x0, 1, 16);
668
669static const char *l4_wkup_clk_mux_ck_parents[] = {
670 "sys_clkin_ck", "lp_clk_div_ck",
671};
672
673DEFINE_CLK_MUX(l4_wkup_clk_mux_ck, l4_wkup_clk_mux_ck_parents, NULL, 0x0,
674 OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
675 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
676
677static const struct clk_div_table ocp_abe_iclk_rates[] = {
678 { .div = 2, .val = 0 },
679 { .div = 1, .val = 1 },
680 { .div = 0 },
681};
682DEFINE_CLK_DIVIDER_TABLE(ocp_abe_iclk, "aess_fclk", &aess_fclk, 0x0,
683 OMAP4430_CM1_ABE_AESS_CLKCTRL,
684 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
685 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
686 0x0, ocp_abe_iclk_rates, NULL);
687
688DEFINE_CLK_FIXED_FACTOR(per_abe_24m_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck,
689 0x0, 1, 4);
690
691DEFINE_CLK_DIVIDER(per_abe_nc_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck, 0x0,
692 OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
693 OMAP4430_SCALE_FCLK_WIDTH, 0x0, NULL);
694
695DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
696 OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
697 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
698
699static struct clk dbgclk_mux_ck;
700DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL);
701DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents,
702 dpll_usb_clkdcoldo_ck_ops);
703
704/* Leaf clocks controlled by modules */
705
706DEFINE_CLK_GATE(aes1_fck, "l3_div_ck", &l3_div_ck, 0x0,
707 OMAP4430_CM_L4SEC_AES1_CLKCTRL,
708 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
709
710DEFINE_CLK_GATE(aes2_fck, "l3_div_ck", &l3_div_ck, 0x0,
711 OMAP4430_CM_L4SEC_AES2_CLKCTRL,
712 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
713
714DEFINE_CLK_GATE(aess_fck, "aess_fclk", &aess_fclk, 0x0,
715 OMAP4430_CM1_ABE_AESS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
716 0x0, NULL);
717
718DEFINE_CLK_GATE(bandgap_fclk, "sys_32k_ck", &sys_32k_ck, 0x0,
719 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
720 OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT, 0x0, NULL);
721
722static const struct clk_div_table div_ts_ck_rates[] = {
723 { .div = 8, .val = 0 },
724 { .div = 16, .val = 1 },
725 { .div = 32, .val = 2 },
726 { .div = 0 },
727};
728DEFINE_CLK_DIVIDER_TABLE(div_ts_ck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
729 0x0, OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
730 OMAP4430_CLKSEL_24_25_SHIFT,
731 OMAP4430_CLKSEL_24_25_WIDTH, 0x0, div_ts_ck_rates,
732 NULL);
733
734DEFINE_CLK_GATE(bandgap_ts_fclk, "div_ts_ck", &div_ts_ck, 0x0,
735 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
736 OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
737 0x0, NULL);
738
739DEFINE_CLK_GATE(des3des_fck, "l4_div_ck", &l4_div_ck, 0x0,
740 OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
741 OMAP4430_MODULEMODE_SWCTRL_SHIFT,
742 0x0, NULL);
743
744static const char *dmic_sync_mux_ck_parents[] = {
745 "abe_24m_fclk", "syc_clk_div_ck", "func_24m_clk",
746};
747
748DEFINE_CLK_MUX(dmic_sync_mux_ck, dmic_sync_mux_ck_parents, NULL,
749 0x0, OMAP4430_CM1_ABE_DMIC_CLKCTRL,
750 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
751 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
752
753static const struct clksel func_dmic_abe_gfclk_sel[] = {
754 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
755 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
756 { .parent = &slimbus_clk, .rates = div_1_2_rates },
757 { .parent = NULL },
758};
759
760static const char *dmic_fck_parents[] = {
761 "dmic_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
762};
763
764/* Merged func_dmic_abe_gfclk into dmic */
765static struct clk dmic_fck;
766
767DEFINE_CLK_OMAP_MUX_GATE(dmic_fck, "abe_clkdm", func_dmic_abe_gfclk_sel,
768 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
769 OMAP4430_CLKSEL_SOURCE_MASK,
770 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
771 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
772 dmic_fck_parents, dmic_fck_ops);
773
774DEFINE_CLK_GATE(dsp_fck, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, 0x0,
775 OMAP4430_CM_TESLA_TESLA_CLKCTRL,
776 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
777
778DEFINE_CLK_GATE(dss_sys_clk, "syc_clk_div_ck", &syc_clk_div_ck, 0x0,
779 OMAP4430_CM_DSS_DSS_CLKCTRL,
780 OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT, 0x0, NULL);
781
782DEFINE_CLK_GATE(dss_tv_clk, "extalt_clkin_ck", &extalt_clkin_ck, 0x0,
783 OMAP4430_CM_DSS_DSS_CLKCTRL,
784 OMAP4430_OPTFCLKEN_TV_CLK_SHIFT, 0x0, NULL);
785
786DEFINE_CLK_GATE(dss_dss_clk, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, 0x0,
787 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
788 0x0, NULL);
789
790DEFINE_CLK_GATE(dss_48mhz_clk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
791 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
792 0x0, NULL);
793
794DEFINE_CLK_GATE(dss_fck, "l3_div_ck", &l3_div_ck, 0x0,
795 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
796 0x0, NULL);
797
798DEFINE_CLK_GATE(efuse_ctrl_cust_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
799 OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
800 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
801
802DEFINE_CLK_GATE(emif1_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
803 OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
804 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
805
806DEFINE_CLK_GATE(emif2_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
807 OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
808 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
809
810DEFINE_CLK_DIVIDER(fdif_fck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
811 OMAP4430_CM_CAM_FDIF_CLKCTRL, OMAP4430_CLKSEL_FCLK_SHIFT,
812 OMAP4430_CLKSEL_FCLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
813
814DEFINE_CLK_GATE(fpka_fck, "l4_div_ck", &l4_div_ck, 0x0,
815 OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
816 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
817
818DEFINE_CLK_GATE(gpio1_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
819 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
820 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
821
822DEFINE_CLK_GATE(gpio1_ick, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, 0x0,
823 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
824 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
825
826DEFINE_CLK_GATE(gpio2_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
827 OMAP4430_CM_L4PER_GPIO2_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
828 0x0, NULL);
829
830DEFINE_CLK_GATE(gpio2_ick, "l4_div_ck", &l4_div_ck, 0x0,
831 OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
832 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
833
834DEFINE_CLK_GATE(gpio3_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
835 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
836 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
837
838DEFINE_CLK_GATE(gpio3_ick, "l4_div_ck", &l4_div_ck, 0x0,
839 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
840 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
841
842DEFINE_CLK_GATE(gpio4_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
843 OMAP4430_CM_L4PER_GPIO4_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
844 0x0, NULL);
845
846DEFINE_CLK_GATE(gpio4_ick, "l4_div_ck", &l4_div_ck, 0x0,
847 OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
848 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
849
850DEFINE_CLK_GATE(gpio5_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
851 OMAP4430_CM_L4PER_GPIO5_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
852 0x0, NULL);
853
854DEFINE_CLK_GATE(gpio5_ick, "l4_div_ck", &l4_div_ck, 0x0,
855 OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
856 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
857
858DEFINE_CLK_GATE(gpio6_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
859 OMAP4430_CM_L4PER_GPIO6_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
860 0x0, NULL);
861
862DEFINE_CLK_GATE(gpio6_ick, "l4_div_ck", &l4_div_ck, 0x0,
863 OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
864 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
865
866DEFINE_CLK_GATE(gpmc_ick, "l3_div_ck", &l3_div_ck, 0x0,
867 OMAP4430_CM_L3_2_GPMC_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
868 0x0, NULL);
869
870static const struct clksel sgx_clk_mux_sel[] = {
871 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
872 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
873 { .parent = NULL },
874};
875
876static const char *gpu_fck_parents[] = {
877 "dpll_core_m7x2_ck", "dpll_per_m7x2_ck",
878};
879
880/* Merged sgx_clk_mux into gpu */
881DEFINE_CLK_OMAP_MUX_GATE(gpu_fck, "l3_gfx_clkdm", sgx_clk_mux_sel,
882 OMAP4430_CM_GFX_GFX_CLKCTRL,
883 OMAP4430_CLKSEL_SGX_FCLK_MASK,
884 OMAP4430_CM_GFX_GFX_CLKCTRL,
885 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
886 gpu_fck_parents, dmic_fck_ops);
887
888DEFINE_CLK_GATE(hdq1w_fck, "func_12m_fclk", &func_12m_fclk, 0x0,
889 OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
890 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
891
892DEFINE_CLK_DIVIDER(hsi_fck, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, 0x0,
893 OMAP4430_CM_L3INIT_HSI_CLKCTRL, OMAP4430_CLKSEL_24_25_SHIFT,
894 OMAP4430_CLKSEL_24_25_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
895 NULL);
896
897DEFINE_CLK_GATE(i2c1_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
898 OMAP4430_CM_L4PER_I2C1_CLKCTRL,
899 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
900
901DEFINE_CLK_GATE(i2c2_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
902 OMAP4430_CM_L4PER_I2C2_CLKCTRL,
903 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
904
905DEFINE_CLK_GATE(i2c3_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
906 OMAP4430_CM_L4PER_I2C3_CLKCTRL,
907 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
908
909DEFINE_CLK_GATE(i2c4_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
910 OMAP4430_CM_L4PER_I2C4_CLKCTRL,
911 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
912
913DEFINE_CLK_GATE(ipu_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
914 OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
915 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
916
917DEFINE_CLK_GATE(iss_ctrlclk, "func_96m_fclk", &func_96m_fclk, 0x0,
918 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
919 0x0, NULL);
920
921DEFINE_CLK_GATE(iss_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
922 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
923 0x0, NULL);
924
925DEFINE_CLK_GATE(iva_fck, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
926 OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
927 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
928
929DEFINE_CLK_GATE(kbd_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
930 OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
931 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
932
933static struct clk l3_instr_ick;
934
935static const char *l3_instr_ick_parent_names[] = {
936 "l3_div_ck",
937};
938
939static const struct clk_ops l3_instr_ick_ops = {
940 .enable = &omap2_dflt_clk_enable,
941 .disable = &omap2_dflt_clk_disable,
942 .is_enabled = &omap2_dflt_clk_is_enabled,
943 .init = &omap2_init_clk_clkdm,
944};
945
946static struct clk_hw_omap l3_instr_ick_hw = {
947 .hw = {
948 .clk = &l3_instr_ick,
949 },
950 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
951 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
952 .clkdm_name = "l3_instr_clkdm",
953};
954
955DEFINE_STRUCT_CLK(l3_instr_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
956
957static struct clk l3_main_3_ick;
958static struct clk_hw_omap l3_main_3_ick_hw = {
959 .hw = {
960 .clk = &l3_main_3_ick,
961 },
962 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
963 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
964 .clkdm_name = "l3_instr_clkdm",
965};
966
967DEFINE_STRUCT_CLK(l3_main_3_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
968
969DEFINE_CLK_MUX(mcasp_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
970 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
971 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
972 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
973
974static const struct clksel func_mcasp_abe_gfclk_sel[] = {
975 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
976 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
977 { .parent = &slimbus_clk, .rates = div_1_2_rates },
978 { .parent = NULL },
979};
980
981static const char *mcasp_fck_parents[] = {
982 "mcasp_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
983};
984
985/* Merged func_mcasp_abe_gfclk into mcasp */
986DEFINE_CLK_OMAP_MUX_GATE(mcasp_fck, "abe_clkdm", func_mcasp_abe_gfclk_sel,
987 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
988 OMAP4430_CLKSEL_SOURCE_MASK,
989 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
990 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
991 mcasp_fck_parents, dmic_fck_ops);
992
993DEFINE_CLK_MUX(mcbsp1_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
994 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
995 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
996 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
997
998static const struct clksel func_mcbsp1_gfclk_sel[] = {
999 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1000 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1001 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1002 { .parent = NULL },
1003};
1004
1005static const char *mcbsp1_fck_parents[] = {
1006 "mcbsp1_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1007};
1008
1009/* Merged func_mcbsp1_gfclk into mcbsp1 */
1010DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "abe_clkdm", func_mcbsp1_gfclk_sel,
1011 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1012 OMAP4430_CLKSEL_SOURCE_MASK,
1013 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1014 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1015 mcbsp1_fck_parents, dmic_fck_ops);
1016
1017DEFINE_CLK_MUX(mcbsp2_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1018 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1019 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1020 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1021
1022static const struct clksel func_mcbsp2_gfclk_sel[] = {
1023 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1024 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1025 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1026 { .parent = NULL },
1027};
1028
1029static const char *mcbsp2_fck_parents[] = {
1030 "mcbsp2_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1031};
1032
1033/* Merged func_mcbsp2_gfclk into mcbsp2 */
1034DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "abe_clkdm", func_mcbsp2_gfclk_sel,
1035 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1036 OMAP4430_CLKSEL_SOURCE_MASK,
1037 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1038 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1039 mcbsp2_fck_parents, dmic_fck_ops);
1040
1041DEFINE_CLK_MUX(mcbsp3_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1042 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1043 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1044 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1045
1046static const struct clksel func_mcbsp3_gfclk_sel[] = {
1047 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1048 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1049 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1050 { .parent = NULL },
1051};
1052
1053static const char *mcbsp3_fck_parents[] = {
1054 "mcbsp3_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1055};
1056
1057/* Merged func_mcbsp3_gfclk into mcbsp3 */
1058DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "abe_clkdm", func_mcbsp3_gfclk_sel,
1059 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1060 OMAP4430_CLKSEL_SOURCE_MASK,
1061 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1062 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1063 mcbsp3_fck_parents, dmic_fck_ops);
1064
1065static const char *mcbsp4_sync_mux_ck_parents[] = {
1066 "func_96m_fclk", "per_abe_nc_fclk",
1067};
1068
1069DEFINE_CLK_MUX(mcbsp4_sync_mux_ck, mcbsp4_sync_mux_ck_parents, NULL, 0x0,
1070 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1071 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1072 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1073
1074static const struct clksel per_mcbsp4_gfclk_sel[] = {
1075 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1076 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1077 { .parent = NULL },
1078};
1079
1080static const char *mcbsp4_fck_parents[] = {
1081 "mcbsp4_sync_mux_ck", "pad_clks_ck",
1082};
1083
1084/* Merged per_mcbsp4_gfclk into mcbsp4 */
1085DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "l4_per_clkdm", per_mcbsp4_gfclk_sel,
1086 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1087 OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1088 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1089 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1090 mcbsp4_fck_parents, dmic_fck_ops);
1091
1092DEFINE_CLK_GATE(mcpdm_fck, "pad_clks_ck", &pad_clks_ck, 0x0,
1093 OMAP4430_CM1_ABE_PDM_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1094 0x0, NULL);
1095
1096DEFINE_CLK_GATE(mcspi1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1097 OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1098 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1099
1100DEFINE_CLK_GATE(mcspi2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1101 OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1102 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1103
1104DEFINE_CLK_GATE(mcspi3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1105 OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1106 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1107
1108DEFINE_CLK_GATE(mcspi4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1109 OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1110 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1111
1112static const struct clksel hsmmc1_fclk_sel[] = {
1113 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1114 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1115 { .parent = NULL },
1116};
1117
1118static const char *mmc1_fck_parents[] = {
1119 "func_64m_fclk", "func_96m_fclk",
1120};
1121
1122/* Merged hsmmc1_fclk into mmc1 */
1123DEFINE_CLK_OMAP_MUX_GATE(mmc1_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1124 OMAP4430_CM_L3INIT_MMC1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1125 OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
1126 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1127 mmc1_fck_parents, dmic_fck_ops);
1128
1129/* Merged hsmmc2_fclk into mmc2 */
1130DEFINE_CLK_OMAP_MUX_GATE(mmc2_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1131 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1132 OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
1133 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1134 mmc1_fck_parents, dmic_fck_ops);
1135
1136DEFINE_CLK_GATE(mmc3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1137 OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
1138 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1139
1140DEFINE_CLK_GATE(mmc4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1141 OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
1142 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1143
1144DEFINE_CLK_GATE(mmc5_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1145 OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
1146 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1147
1148DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
1149 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1150 OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
1151
1152DEFINE_CLK_GATE(ocp2scp_usb_phy_ick, "l4_div_ck", &l4_div_ck, 0x0,
1153 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1154 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1155
1156static struct clk ocp_wp_noc_ick;
1157
1158static struct clk_hw_omap ocp_wp_noc_ick_hw = {
1159 .hw = {
1160 .clk = &ocp_wp_noc_ick,
1161 },
1162 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
1163 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1164 .clkdm_name = "l3_instr_clkdm",
1165};
1166
1167DEFINE_STRUCT_CLK(ocp_wp_noc_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
1168
1169DEFINE_CLK_GATE(rng_ick, "l4_div_ck", &l4_div_ck, 0x0,
1170 OMAP4430_CM_L4SEC_RNG_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1171 0x0, NULL);
1172
1173DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
1174 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
1175 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1176
1177DEFINE_CLK_GATE(sl2if_ick, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
1178 OMAP4430_CM_IVAHD_SL2_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1179 0x0, NULL);
1180
1181DEFINE_CLK_GATE(slimbus1_fclk_1, "func_24m_clk", &func_24m_clk, 0x0,
1182 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1183 OMAP4430_OPTFCLKEN_FCLK1_SHIFT, 0x0, NULL);
1184
1185DEFINE_CLK_GATE(slimbus1_fclk_0, "abe_24m_fclk", &abe_24m_fclk, 0x0,
1186 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1187 OMAP4430_OPTFCLKEN_FCLK0_SHIFT, 0x0, NULL);
1188
1189DEFINE_CLK_GATE(slimbus1_fclk_2, "pad_clks_ck", &pad_clks_ck, 0x0,
1190 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1191 OMAP4430_OPTFCLKEN_FCLK2_SHIFT, 0x0, NULL);
1192
1193DEFINE_CLK_GATE(slimbus1_slimbus_clk, "slimbus_clk", &slimbus_clk, 0x0,
1194 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1195 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT, 0x0, NULL);
1196
1197DEFINE_CLK_GATE(slimbus1_fck, "ocp_abe_iclk", &ocp_abe_iclk, 0x0,
1198 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1199 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1200
1201DEFINE_CLK_GATE(slimbus2_fclk_1, "per_abe_24m_fclk", &per_abe_24m_fclk, 0x0,
1202 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1203 OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT, 0x0, NULL);
1204
1205DEFINE_CLK_GATE(slimbus2_fclk_0, "func_24mc_fclk", &func_24mc_fclk, 0x0,
1206 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1207 OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT, 0x0, NULL);
1208
1209DEFINE_CLK_GATE(slimbus2_slimbus_clk, "pad_slimbus_core_clks_ck",
1210 &pad_slimbus_core_clks_ck, 0x0,
1211 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1212 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT, 0x0, NULL);
1213
1214DEFINE_CLK_GATE(slimbus2_fck, "l4_div_ck", &l4_div_ck, 0x0,
1215 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1216 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1217
1218DEFINE_CLK_GATE(smartreflex_core_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1219 0x0, OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
1220 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1221
1222DEFINE_CLK_GATE(smartreflex_iva_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1223 0x0, OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
1224 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1225
1226DEFINE_CLK_GATE(smartreflex_mpu_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1227 0x0, OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
1228 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1229
1230static const struct clksel dmt1_clk_mux_sel[] = {
1231 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1232 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1233 { .parent = NULL },
1234};
1235
1236/* Merged dmt1_clk_mux into timer1 */
1237DEFINE_CLK_OMAP_MUX_GATE(timer1_fck, "l4_wkup_clkdm", dmt1_clk_mux_sel,
1238 OMAP4430_CM_WKUP_TIMER1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1239 OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
1240 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1241 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1242
1243/* Merged cm2_dm10_mux into timer10 */
1244DEFINE_CLK_OMAP_MUX_GATE(timer10_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1245 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1246 OMAP4430_CLKSEL_MASK,
1247 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1248 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1249 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1250
1251/* Merged cm2_dm11_mux into timer11 */
1252DEFINE_CLK_OMAP_MUX_GATE(timer11_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1253 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1254 OMAP4430_CLKSEL_MASK,
1255 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1256 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1257 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1258
1259/* Merged cm2_dm2_mux into timer2 */
1260DEFINE_CLK_OMAP_MUX_GATE(timer2_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1261 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1262 OMAP4430_CLKSEL_MASK,
1263 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1264 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1265 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1266
1267/* Merged cm2_dm3_mux into timer3 */
1268DEFINE_CLK_OMAP_MUX_GATE(timer3_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1269 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1270 OMAP4430_CLKSEL_MASK,
1271 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1272 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1273 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1274
1275/* Merged cm2_dm4_mux into timer4 */
1276DEFINE_CLK_OMAP_MUX_GATE(timer4_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1277 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1278 OMAP4430_CLKSEL_MASK,
1279 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1280 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1281 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1282
1283static const struct clksel timer5_sync_mux_sel[] = {
1284 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
1285 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1286 { .parent = NULL },
1287};
1288
1289static const char *timer5_fck_parents[] = {
1290 "syc_clk_div_ck", "sys_32k_ck",
1291};
1292
1293/* Merged timer5_sync_mux into timer5 */
1294DEFINE_CLK_OMAP_MUX_GATE(timer5_fck, "abe_clkdm", timer5_sync_mux_sel,
1295 OMAP4430_CM1_ABE_TIMER5_CLKCTRL, OMAP4430_CLKSEL_MASK,
1296 OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
1297 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1298 timer5_fck_parents, dmic_fck_ops);
1299
1300/* Merged timer6_sync_mux into timer6 */
1301DEFINE_CLK_OMAP_MUX_GATE(timer6_fck, "abe_clkdm", timer5_sync_mux_sel,
1302 OMAP4430_CM1_ABE_TIMER6_CLKCTRL, OMAP4430_CLKSEL_MASK,
1303 OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
1304 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1305 timer5_fck_parents, dmic_fck_ops);
1306
1307/* Merged timer7_sync_mux into timer7 */
1308DEFINE_CLK_OMAP_MUX_GATE(timer7_fck, "abe_clkdm", timer5_sync_mux_sel,
1309 OMAP4430_CM1_ABE_TIMER7_CLKCTRL, OMAP4430_CLKSEL_MASK,
1310 OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
1311 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1312 timer5_fck_parents, dmic_fck_ops);
1313
1314/* Merged timer8_sync_mux into timer8 */
1315DEFINE_CLK_OMAP_MUX_GATE(timer8_fck, "abe_clkdm", timer5_sync_mux_sel,
1316 OMAP4430_CM1_ABE_TIMER8_CLKCTRL, OMAP4430_CLKSEL_MASK,
1317 OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
1318 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1319 timer5_fck_parents, dmic_fck_ops);
1320
1321/* Merged cm2_dm9_mux into timer9 */
1322DEFINE_CLK_OMAP_MUX_GATE(timer9_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1323 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1324 OMAP4430_CLKSEL_MASK,
1325 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1326 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1327 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1328
1329DEFINE_CLK_GATE(uart1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1330 OMAP4430_CM_L4PER_UART1_CLKCTRL,
1331 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1332
1333DEFINE_CLK_GATE(uart2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1334 OMAP4430_CM_L4PER_UART2_CLKCTRL,
1335 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1336
1337DEFINE_CLK_GATE(uart3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1338 OMAP4430_CM_L4PER_UART3_CLKCTRL,
1339 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1340
1341DEFINE_CLK_GATE(uart4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1342 OMAP4430_CM_L4PER_UART4_CLKCTRL,
1343 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1344
1345static struct clk usb_host_fs_fck;
1346
1347static const char *usb_host_fs_fck_parent_names[] = {
1348 "func_48mc_fclk",
1349};
1350
1351static const struct clk_ops usb_host_fs_fck_ops = {
1352 .enable = &omap2_dflt_clk_enable,
1353 .disable = &omap2_dflt_clk_disable,
1354 .is_enabled = &omap2_dflt_clk_is_enabled,
1355};
1356
1357static struct clk_hw_omap usb_host_fs_fck_hw = {
1358 .hw = {
1359 .clk = &usb_host_fs_fck,
1360 },
1361 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
1362 .enable_bit = OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1363 .clkdm_name = "l3_init_clkdm",
1364};
1365
1366DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
1367 usb_host_fs_fck_ops);
1368
1369static const char *utmi_p1_gfclk_parents[] = {
1370 "init_60m_fclk", "xclk60mhsp1_ck",
1371};
1372
1373DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
1374 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1375 OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
1376 0x0, NULL);
1377
1378DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
1379 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1380 OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
1381
1382static const char *utmi_p2_gfclk_parents[] = {
1383 "init_60m_fclk", "xclk60mhsp2_ck",
1384};
1385
1386DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
1387 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1388 OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
1389 0x0, NULL);
1390
1391DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
1392 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1393 OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
1394
1395DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1396 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1397 OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT, 0x0, NULL);
1398
1399DEFINE_CLK_GATE(usb_host_hs_hsic480m_p1_clk, "dpll_usb_m2_ck",
1400 &dpll_usb_m2_ck, 0x0,
1401 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1402 OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT, 0x0, NULL);
1403
1404DEFINE_CLK_GATE(usb_host_hs_hsic60m_p1_clk, "init_60m_fclk",
1405 &init_60m_fclk, 0x0,
1406 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1407 OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT, 0x0, NULL);
1408
1409DEFINE_CLK_GATE(usb_host_hs_hsic60m_p2_clk, "init_60m_fclk",
1410 &init_60m_fclk, 0x0,
1411 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1412 OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT, 0x0, NULL);
1413
1414DEFINE_CLK_GATE(usb_host_hs_hsic480m_p2_clk, "dpll_usb_m2_ck",
1415 &dpll_usb_m2_ck, 0x0,
1416 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1417 OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT, 0x0, NULL);
1418
1419DEFINE_CLK_GATE(usb_host_hs_func48mclk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
1420 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1421 OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT, 0x0, NULL);
1422
1423DEFINE_CLK_GATE(usb_host_hs_fck, "init_60m_fclk", &init_60m_fclk, 0x0,
1424 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1425 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1426
1427static const char *otg_60m_gfclk_parents[] = {
1428 "utmi_phy_clkout_ck", "xclk60motg_ck",
1429};
1430
1431DEFINE_CLK_MUX(otg_60m_gfclk, otg_60m_gfclk_parents, NULL, 0x0,
1432 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, OMAP4430_CLKSEL_60M_SHIFT,
1433 OMAP4430_CLKSEL_60M_WIDTH, 0x0, NULL);
1434
1435DEFINE_CLK_GATE(usb_otg_hs_xclk, "otg_60m_gfclk", &otg_60m_gfclk, 0x0,
1436 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1437 OMAP4430_OPTFCLKEN_XCLK_SHIFT, 0x0, NULL);
1438
1439DEFINE_CLK_GATE(usb_otg_hs_ick, "l3_div_ck", &l3_div_ck, 0x0,
1440 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1441 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1442
1443DEFINE_CLK_GATE(usb_phy_cm_clk32k, "sys_32k_ck", &sys_32k_ck, 0x0,
1444 OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
1445 OMAP4430_OPTFCLKEN_CLK32K_SHIFT, 0x0, NULL);
1446
1447DEFINE_CLK_GATE(usb_tll_hs_usb_ch2_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1448 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1449 OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT, 0x0, NULL);
1450
1451DEFINE_CLK_GATE(usb_tll_hs_usb_ch0_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1452 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1453 OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT, 0x0, NULL);
1454
1455DEFINE_CLK_GATE(usb_tll_hs_usb_ch1_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1456 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1457 OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT, 0x0, NULL);
1458
1459DEFINE_CLK_GATE(usb_tll_hs_ick, "l4_div_ck", &l4_div_ck, 0x0,
1460 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1461 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1462
1463static const struct clk_div_table usim_ck_rates[] = {
1464 { .div = 14, .val = 0 },
1465 { .div = 18, .val = 1 },
1466 { .div = 0 },
1467};
1468DEFINE_CLK_DIVIDER_TABLE(usim_ck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
1469 OMAP4430_CM_WKUP_USIM_CLKCTRL,
1470 OMAP4430_CLKSEL_DIV_SHIFT, OMAP4430_CLKSEL_DIV_WIDTH,
1471 0x0, usim_ck_rates, NULL);
1472
1473DEFINE_CLK_GATE(usim_fclk, "usim_ck", &usim_ck, 0x0,
1474 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_OPTFCLKEN_FCLK_SHIFT,
1475 0x0, NULL);
1476
1477DEFINE_CLK_GATE(usim_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1478 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1479 0x0, NULL);
1480
1481DEFINE_CLK_GATE(wd_timer2_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1482 OMAP4430_CM_WKUP_WDT2_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1483 0x0, NULL);
1484
1485DEFINE_CLK_GATE(wd_timer3_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1486 OMAP4430_CM1_ABE_WDT3_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1487 0x0, NULL);
1488
1489/* Remaining optional clocks */
1490static const char *pmd_stm_clock_mux_ck_parents[] = {
1491 "sys_clkin_ck", "dpll_core_m6x2_ck", "tie_low_clock_ck",
1492};
1493
1494DEFINE_CLK_MUX(pmd_stm_clock_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1495 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, OMAP4430_PMD_STM_MUX_CTRL_SHIFT,
1496 OMAP4430_PMD_STM_MUX_CTRL_WIDTH, 0x0, NULL);
1497
1498DEFINE_CLK_MUX(pmd_trace_clk_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1499 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1500 OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT,
1501 OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH, 0x0, NULL);
1502
1503DEFINE_CLK_DIVIDER(stm_clk_div_ck, "pmd_stm_clock_mux_ck",
1504 &pmd_stm_clock_mux_ck, 0x0, OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1505 OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT,
1506 OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
1507 NULL);
1508
1509static const char *trace_clk_div_ck_parents[] = {
1510 "pmd_trace_clk_mux_ck",
1511};
1512
1513static const struct clksel trace_clk_div_div[] = {
1514 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
1515 { .parent = NULL },
1516};
1517
1518static struct clk trace_clk_div_ck;
1519
1520static const struct clk_ops trace_clk_div_ck_ops = {
1521 .recalc_rate = &omap2_clksel_recalc,
1522 .set_rate = &omap2_clksel_set_rate,
1523 .round_rate = &omap2_clksel_round_rate,
1524 .init = &omap2_init_clk_clkdm,
1525 .enable = &omap2_clkops_enable_clkdm,
1526 .disable = &omap2_clkops_disable_clkdm,
1527};
1528
1529static struct clk_hw_omap trace_clk_div_ck_hw = {
1530 .hw = {
1531 .clk = &trace_clk_div_ck,
1532 },
1533 .clkdm_name = "emu_sys_clkdm",
1534 .clksel = trace_clk_div_div,
1535 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1536 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
1537};
1538
1539DEFINE_STRUCT_CLK(trace_clk_div_ck, trace_clk_div_ck_parents,
1540 trace_clk_div_ck_ops);
1541
1542/* SCRM aux clk nodes */
1543
1544static const struct clksel auxclk_src_sel[] = {
1545 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1546 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
1547 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
1548 { .parent = NULL },
1549};
1550
1551static const char *auxclk_src_ck_parents[] = {
1552 "sys_clkin_ck", "dpll_core_m3x2_ck", "dpll_per_m3x2_ck",
1553};
1554
1555static const struct clk_ops auxclk_src_ck_ops = {
1556 .enable = &omap2_dflt_clk_enable,
1557 .disable = &omap2_dflt_clk_disable,
1558 .is_enabled = &omap2_dflt_clk_is_enabled,
1559 .recalc_rate = &omap2_clksel_recalc,
1560 .get_parent = &omap2_clksel_find_parent_index,
1561};
1562
1563DEFINE_CLK_OMAP_MUX_GATE(auxclk0_src_ck, NULL, auxclk_src_sel,
1564 OMAP4_SCRM_AUXCLK0, OMAP4_SRCSELECT_MASK,
1565 OMAP4_SCRM_AUXCLK0, OMAP4_ENABLE_SHIFT, NULL,
1566 auxclk_src_ck_parents, auxclk_src_ck_ops);
1567
1568DEFINE_CLK_DIVIDER(auxclk0_ck, "auxclk0_src_ck", &auxclk0_src_ck, 0x0,
1569 OMAP4_SCRM_AUXCLK0, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1570 0x0, NULL);
1571
1572DEFINE_CLK_OMAP_MUX_GATE(auxclk1_src_ck, NULL, auxclk_src_sel,
1573 OMAP4_SCRM_AUXCLK1, OMAP4_SRCSELECT_MASK,
1574 OMAP4_SCRM_AUXCLK1, OMAP4_ENABLE_SHIFT, NULL,
1575 auxclk_src_ck_parents, auxclk_src_ck_ops);
1576
1577DEFINE_CLK_DIVIDER(auxclk1_ck, "auxclk1_src_ck", &auxclk1_src_ck, 0x0,
1578 OMAP4_SCRM_AUXCLK1, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1579 0x0, NULL);
1580
1581DEFINE_CLK_OMAP_MUX_GATE(auxclk2_src_ck, NULL, auxclk_src_sel,
1582 OMAP4_SCRM_AUXCLK2, OMAP4_SRCSELECT_MASK,
1583 OMAP4_SCRM_AUXCLK2, OMAP4_ENABLE_SHIFT, NULL,
1584 auxclk_src_ck_parents, auxclk_src_ck_ops);
1585
1586DEFINE_CLK_DIVIDER(auxclk2_ck, "auxclk2_src_ck", &auxclk2_src_ck, 0x0,
1587 OMAP4_SCRM_AUXCLK2, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1588 0x0, NULL);
1589
1590DEFINE_CLK_OMAP_MUX_GATE(auxclk3_src_ck, NULL, auxclk_src_sel,
1591 OMAP4_SCRM_AUXCLK3, OMAP4_SRCSELECT_MASK,
1592 OMAP4_SCRM_AUXCLK3, OMAP4_ENABLE_SHIFT, NULL,
1593 auxclk_src_ck_parents, auxclk_src_ck_ops);
1594
1595DEFINE_CLK_DIVIDER(auxclk3_ck, "auxclk3_src_ck", &auxclk3_src_ck, 0x0,
1596 OMAP4_SCRM_AUXCLK3, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1597 0x0, NULL);
1598
1599DEFINE_CLK_OMAP_MUX_GATE(auxclk4_src_ck, NULL, auxclk_src_sel,
1600 OMAP4_SCRM_AUXCLK4, OMAP4_SRCSELECT_MASK,
1601 OMAP4_SCRM_AUXCLK4, OMAP4_ENABLE_SHIFT, NULL,
1602 auxclk_src_ck_parents, auxclk_src_ck_ops);
1603
1604DEFINE_CLK_DIVIDER(auxclk4_ck, "auxclk4_src_ck", &auxclk4_src_ck, 0x0,
1605 OMAP4_SCRM_AUXCLK4, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1606 0x0, NULL);
1607
1608DEFINE_CLK_OMAP_MUX_GATE(auxclk5_src_ck, NULL, auxclk_src_sel,
1609 OMAP4_SCRM_AUXCLK5, OMAP4_SRCSELECT_MASK,
1610 OMAP4_SCRM_AUXCLK5, OMAP4_ENABLE_SHIFT, NULL,
1611 auxclk_src_ck_parents, auxclk_src_ck_ops);
1612
1613DEFINE_CLK_DIVIDER(auxclk5_ck, "auxclk5_src_ck", &auxclk5_src_ck, 0x0,
1614 OMAP4_SCRM_AUXCLK5, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1615 0x0, NULL);
1616
1617static const char *auxclkreq_ck_parents[] = {
1618 "auxclk0_ck", "auxclk1_ck", "auxclk2_ck", "auxclk3_ck", "auxclk4_ck",
1619 "auxclk5_ck",
1620};
1621
1622DEFINE_CLK_MUX(auxclkreq0_ck, auxclkreq_ck_parents, NULL, 0x0,
1623 OMAP4_SCRM_AUXCLKREQ0, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1624 0x0, NULL);
1625
1626DEFINE_CLK_MUX(auxclkreq1_ck, auxclkreq_ck_parents, NULL, 0x0,
1627 OMAP4_SCRM_AUXCLKREQ1, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1628 0x0, NULL);
1629
1630DEFINE_CLK_MUX(auxclkreq2_ck, auxclkreq_ck_parents, NULL, 0x0,
1631 OMAP4_SCRM_AUXCLKREQ2, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1632 0x0, NULL);
1633
1634DEFINE_CLK_MUX(auxclkreq3_ck, auxclkreq_ck_parents, NULL, 0x0,
1635 OMAP4_SCRM_AUXCLKREQ3, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1636 0x0, NULL);
1637
1638DEFINE_CLK_MUX(auxclkreq4_ck, auxclkreq_ck_parents, NULL, 0x0,
1639 OMAP4_SCRM_AUXCLKREQ4, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1640 0x0, NULL);
1641
1642DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
1643 OMAP4_SCRM_AUXCLKREQ5, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1644 0x0, NULL);
1645
1646/*
1647 * clkdev
1648 */
1649
1650static struct omap_clk omap44xx_clks[] = {
1651 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
1652 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck, CK_443X),
1653 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
1654 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
1655 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
1656 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk, CK_443X),
1657 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
1658 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
1659 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
1660 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
1661 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
1662 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
1663 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
1664 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
1665 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
1666 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
1667 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
1668 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
1669 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
1670 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
1671 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
1672 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
1673 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
1674 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
1675 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
1676 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
1677 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
1678 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
1679 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
1680 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
1681 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
1682 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
1683 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
1684 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
1685 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
1686 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
1687 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
1688 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
1689 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
1690 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
1691 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
1692 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
1693 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
1694 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
1695 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
1696 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
1697 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
1698 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
1699 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
1700 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
1701 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
1702 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
1703 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
1704 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
1705 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
1706 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
1707 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
1708 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
1709 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
1710 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
1711 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
1712 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
1713 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
1714 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
1715 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
1716 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
1717 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
1718 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
1719 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
1720 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
1721 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
1722 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
1723 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
1724 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
1725 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
1726 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
1727 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
1728 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
1729 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
1730 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
1731 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
1732 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
1733 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
1734 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
1735 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
1736 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
1737 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
1738 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
1739 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
1740 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
1741 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
1742 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
1743 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
1744 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
1745 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
1746 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
1747 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
1748 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
1749 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
1750 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
1751 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
1752 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
1753 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
1754 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
1755 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
1756 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
1757 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
1758 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
1759 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
1760 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
1761 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
1762 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
1763 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
1764 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
1765 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
1766 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
1767 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
1768 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
1769 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
1770 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
1771 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
1772 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
1773 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
1774 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
1775 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
1776 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
1777 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
1778 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
1779 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
1780 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
1781 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
1782 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
1783 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
1784 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
1785 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
1786 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
1787 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
1788 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
1789 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
1790 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
1791 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
1792 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
1793 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
1794 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
1795 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
1796 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
1797 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
1798 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
1799 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
1800 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
1801 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
1802 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
1803 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
1804 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
1805 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
1806 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
1807 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
1808 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
1809 CLK("omap_rng", "ick", &rng_ick, CK_443X),
1810 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
1811 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
1812 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
1813 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
1814 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
1815 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
1816 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
1817 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
1818 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
1819 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
1820 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
1821 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
1822 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
1823 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
1824 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
1825 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
1826 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
1827 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
1828 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
1829 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
1830 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
1831 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
1832 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
1833 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
1834 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
1835 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
1836 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
1837 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
1838 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
1839 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
1840 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
1841 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
1842 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
1843 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
1844 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
1845 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
1846 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
1847 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
1848 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
1849 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
1850 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
1851 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
1852 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
1853 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
1854 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
1855 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
1856 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
1857 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
1858 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
1859 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
1860 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
1861 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
1862 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1863 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1864 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
1865 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
1866 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
1867 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
1868 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
1869 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
1870 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
1871 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
1872 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
1873 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
1874 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
1875 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
1876 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
1877 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
1878 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
1879 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
1880 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
1881 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
1882 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
1883 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
1884 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
1885 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
1886 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
1887 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
1888 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
1889 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
1890 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
1891 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
1892 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
1893 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
1894 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
1895 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
1896 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
1897 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
1898 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
1899 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
1900 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
1901 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
1902 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
1903 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
1904 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
1905 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
1906 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
1907 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
1908 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
1909 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
1910 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
1911 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
1912 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
1913 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
1914 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
1915 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
1916 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
1917 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
1918 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
1919 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
1920 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1921 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1922 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1923 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1924 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1925 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1926 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1927 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1928 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1929 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1930 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1931 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1932 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1933 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1934 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1935 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1936 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1937 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1938 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1939 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1940 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1941 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1942 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
1943};
1944
1945static const char *enable_init_clks[] = {
1946 "emif1_fck",
1947 "emif2_fck",
1948 "gpmc_ick",
1949 "l3_instr_ick",
1950 "l3_main_3_ick",
1951 "ocp_wp_noc_ick",
1952};
1953
1954int __init omap4xxx_clk_init(void)
1955{
1956 u32 cpu_clkflg;
1957 struct omap_clk *c;
1958
1959 if (cpu_is_omap443x()) {
1960 cpu_mask = RATE_IN_4430;
1961 cpu_clkflg = CK_443X;
1962 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
1963 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
1964 cpu_clkflg = CK_446X | CK_443X;
1965
1966 if (cpu_is_omap447x())
1967 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
1968 } else {
1969 return 0;
1970 }
1971
1972 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
1973 c++) {
1974 if (c->cpu & cpu_clkflg) {
1975 clkdev_add(&c->lk);
1976 if (!__clk_init(NULL, c->lk.clk))
1977 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1978 }
1979 }
1980
1981 omap2_clk_disable_autoidle_all();
1982
1983 omap2_clk_enable_init_clocks(enable_init_clks,
1984 ARRAY_SIZE(enable_init_clks));
1985
1986 return 0;
1987}
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index c2d15212d64d..25b1feed480d 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -21,12 +21,10 @@
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>
26 24
27#include "clock.h" 25#include "clock.h"
28#include "clock2xxx.h" 26#include "clock2xxx.h"
29#include "cm2xxx_3xxx.h" 27#include "cm2xxx.h"
30#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
31 29
32/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ 30/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
@@ -38,92 +36,90 @@
38#define APLLS_CLKIN_13MHZ 2 36#define APLLS_CLKIN_13MHZ 2
39#define APLLS_CLKIN_12MHZ 3 37#define APLLS_CLKIN_12MHZ 3
40 38
41void __iomem *cm_idlest_pll;
42
43/* Private functions */ 39/* Private functions */
44 40
45/* Enable an APLL if off */ 41/**
46static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask) 42 * omap2xxx_clk_apll_locked - is the APLL locked?
43 * @hw: struct clk_hw * of the APLL to check
44 *
45 * If the APLL IP block referred to by @hw indicates that it's locked,
46 * return true; otherwise, return false.
47 */
48static bool omap2xxx_clk_apll_locked(struct clk_hw *hw)
47{ 49{
48 u32 cval, apll_mask; 50 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
51 u32 r, apll_mask;
49 52
50 apll_mask = EN_APLL_LOCKED << clk->enable_bit; 53 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
51 54
52 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 55 r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
53
54 if ((cval & apll_mask) == apll_mask)
55 return 0; /* apll already enabled */
56
57 cval &= ~apll_mask;
58 cval |= apll_mask;
59 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
60
61 omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
62 OMAP24XX_CM_IDLEST_VAL, __clk_get_name(clk));
63 56
64 /* 57 return ((r & apll_mask) == apll_mask) ? true : false;
65 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
66 * fails?
67 */
68 return 0;
69} 58}
70 59
71static int omap2_clk_apll96_enable(struct clk *clk) 60int omap2_clk_apll96_enable(struct clk_hw *hw)
72{ 61{
73 return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL_MASK); 62 return omap2xxx_cm_apll96_enable();
74} 63}
75 64
76static int omap2_clk_apll54_enable(struct clk *clk) 65int omap2_clk_apll54_enable(struct clk_hw *hw)
77{ 66{
78 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK); 67 return omap2xxx_cm_apll54_enable();
79} 68}
80 69
81static void _apll96_allow_idle(struct clk *clk) 70static void _apll96_allow_idle(struct clk_hw_omap *clk)
82{ 71{
83 omap2xxx_cm_set_apll96_auto_low_power_stop(); 72 omap2xxx_cm_set_apll96_auto_low_power_stop();
84} 73}
85 74
86static void _apll96_deny_idle(struct clk *clk) 75static void _apll96_deny_idle(struct clk_hw_omap *clk)
87{ 76{
88 omap2xxx_cm_set_apll96_disable_autoidle(); 77 omap2xxx_cm_set_apll96_disable_autoidle();
89} 78}
90 79
91static void _apll54_allow_idle(struct clk *clk) 80static void _apll54_allow_idle(struct clk_hw_omap *clk)
92{ 81{
93 omap2xxx_cm_set_apll54_auto_low_power_stop(); 82 omap2xxx_cm_set_apll54_auto_low_power_stop();
94} 83}
95 84
96static void _apll54_deny_idle(struct clk *clk) 85static void _apll54_deny_idle(struct clk_hw_omap *clk)
97{ 86{
98 omap2xxx_cm_set_apll54_disable_autoidle(); 87 omap2xxx_cm_set_apll54_disable_autoidle();
99} 88}
100 89
101/* Stop APLL */ 90void omap2_clk_apll96_disable(struct clk_hw *hw)
102static void omap2_clk_apll_disable(struct clk *clk)
103{ 91{
104 u32 cval; 92 omap2xxx_cm_apll96_disable();
93}
105 94
106 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 95void omap2_clk_apll54_disable(struct clk_hw *hw)
107 cval &= ~(EN_APLL_LOCKED << clk->enable_bit); 96{
108 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); 97 omap2xxx_cm_apll54_disable();
109} 98}
110 99
111/* Public data */ 100unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
101 unsigned long parent_rate)
102{
103 return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0;
104}
112 105
113const struct clkops clkops_apll96 = { 106unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
114 .enable = omap2_clk_apll96_enable, 107 unsigned long parent_rate)
115 .disable = omap2_clk_apll_disable, 108{
116 .allow_idle = _apll96_allow_idle, 109 return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0;
117 .deny_idle = _apll96_deny_idle, 110}
118};
119 111
120const struct clkops clkops_apll54 = { 112/* Public data */
121 .enable = omap2_clk_apll54_enable, 113const struct clk_hw_omap_ops clkhwops_apll54 = {
122 .disable = omap2_clk_apll_disable,
123 .allow_idle = _apll54_allow_idle, 114 .allow_idle = _apll54_allow_idle,
124 .deny_idle = _apll54_deny_idle, 115 .deny_idle = _apll54_deny_idle,
125}; 116};
126 117
118const struct clk_hw_omap_ops clkhwops_apll96 = {
119 .allow_idle = _apll96_allow_idle,
120 .deny_idle = _apll96_deny_idle,
121};
122
127/* Public functions */ 123/* Public functions */
128 124
129u32 omap2xxx_get_apll_clkin(void) 125u32 omap2xxx_get_apll_clkin(void)
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c
index 1502a7bc20bb..82572e277b97 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c
@@ -14,10 +14,8 @@
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.h"
21#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
22 20
23/* Private functions */ 21/* Private functions */
@@ -31,7 +29,7 @@
31 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1 29 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
32 * instead. Add some mechanism to optionally enter this mode. 30 * instead. Add some mechanism to optionally enter this mode.
33 */ 31 */
34static void _allow_idle(struct clk *clk) 32static void _allow_idle(struct clk_hw_omap *clk)
35{ 33{
36 if (!clk || !clk->dpll_data) 34 if (!clk || !clk->dpll_data)
37 return; 35 return;
@@ -45,7 +43,7 @@ static void _allow_idle(struct clk *clk)
45 * 43 *
46 * Disable DPLL automatic idle control. No return value. 44 * Disable DPLL automatic idle control. No return value.
47 */ 45 */
48static void _deny_idle(struct clk *clk) 46static void _deny_idle(struct clk_hw_omap *clk)
49{ 47{
50 if (!clk || !clk->dpll_data) 48 if (!clk || !clk->dpll_data)
51 return; 49 return;
@@ -55,9 +53,7 @@ static void _deny_idle(struct clk *clk)
55 53
56 54
57/* Public data */ 55/* Public data */
58 56const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
59const struct clkops clkops_omap2xxx_dpll_ops = {
60 .allow_idle = _allow_idle, 57 .allow_idle = _allow_idle,
61 .deny_idle = _deny_idle, 58 .deny_idle = _deny_idle,
62}; 59};
63
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 4ae439222085..a0ae3c09f97a 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -25,21 +25,26 @@
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.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
39/*
40 * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
41 * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
42 * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
43 */
44static struct clk_hw_omap *dpll_core_ck;
45
40/** 46/**
41 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 47 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
42 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
43 * 48 *
44 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate 49 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
45 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz 50 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
@@ -47,12 +52,14 @@
47 * struct clk *dpll_ck, which is a composite clock of dpll_ck and 52 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
48 * core_ck. 53 * core_ck.
49 */ 54 */
50unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) 55unsigned long omap2xxx_clk_get_core_rate(void)
51{ 56{
52 long long core_clk; 57 long long core_clk;
53 u32 v; 58 u32 v;
54 59
55 core_clk = omap2_get_dpll_rate(clk); 60 WARN_ON(!dpll_core_ck);
61
62 core_clk = omap2_get_dpll_rate(dpll_core_ck);
56 63
57 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 64 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
58 v &= OMAP24XX_CORE_CLK_SRC_MASK; 65 v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -98,19 +105,22 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
98 105
99} 106}
100 107
101unsigned long omap2_dpllcore_recalc(struct clk *clk) 108unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
109 unsigned long parent_rate)
102{ 110{
103 return omap2xxx_clk_get_core_rate(clk); 111 return omap2xxx_clk_get_core_rate();
104} 112}
105 113
106int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 114int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
115 unsigned long parent_rate)
107{ 116{
117 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
108 u32 cur_rate, low, mult, div, valid_rate, done_rate; 118 u32 cur_rate, low, mult, div, valid_rate, done_rate;
109 u32 bypass = 0; 119 u32 bypass = 0;
110 struct prcm_config tmpset; 120 struct prcm_config tmpset;
111 const struct dpll_data *dd; 121 const struct dpll_data *dd;
112 122
113 cur_rate = omap2xxx_clk_get_core_rate(dclk); 123 cur_rate = omap2xxx_clk_get_core_rate();
114 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 124 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
115 mult &= OMAP24XX_CORE_CLK_SRC_MASK; 125 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
116 126
@@ -171,3 +181,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
171 return 0; 181 return 0;
172} 182}
173 183
184/**
185 * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
186 * @clk: struct clk *dpll_ck
187 *
188 * Store a local copy of @clk in dpll_core_ck so other code can query
189 * the core rate without having to clk_get(), which can sleep. Must
190 * only be called once. No return value. XXX If the clock
191 * registration process is ever changed such that dpll_ck is no longer
192 * statically defined, this code may need to change to increment some
193 * kind of use count on dpll_ck.
194 */
195void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw)
196{
197 WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
198 dpll_core_ck = to_clk_hw_omap(hw);
199}
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index c3460928b5e0..19f54d433490 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"
@@ -37,7 +35,7 @@
37 * clk_enable/clk_disable()-based usecounting for osc_ck should be 35 * clk_enable/clk_disable()-based usecounting for osc_ck should be
38 * replaced with autoidle-based usecounting. 36 * replaced with autoidle-based usecounting.
39 */ 37 */
40static int omap2_enable_osc_ck(struct clk *clk) 38int omap2_enable_osc_ck(struct clk_hw *clk)
41{ 39{
42 u32 pcc; 40 u32 pcc;
43 41
@@ -55,7 +53,7 @@ static int omap2_enable_osc_ck(struct clk *clk)
55 * clk_enable/clk_disable()-based usecounting for osc_ck should be 53 * clk_enable/clk_disable()-based usecounting for osc_ck should be
56 * replaced with autoidle-based usecounting. 54 * replaced with autoidle-based usecounting.
57 */ 55 */
58static void omap2_disable_osc_ck(struct clk *clk) 56void omap2_disable_osc_ck(struct clk_hw *clk)
59{ 57{
60 u32 pcc; 58 u32 pcc;
61 59
@@ -64,13 +62,8 @@ static void omap2_disable_osc_ck(struct clk *clk)
64 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
65} 63}
66 64
67const struct clkops clkops_oscck = { 65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
68 .enable = omap2_enable_osc_ck, 66 unsigned long parent_rate)
69 .disable = omap2_disable_osc_ck,
70};
71
72unsigned long omap2_osc_clk_recalc(struct clk *clk)
73{ 67{
74 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv(); 68 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();
75} 69}
76
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index 8693cfdac49a..f467d072cd02 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"
@@ -42,9 +40,8 @@ u32 omap2xxx_get_sysclkdiv(void)
42 return div; 40 return div;
43} 41}
44 42
45unsigned long omap2xxx_sys_clk_recalc(struct clk *clk) 43unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
44 unsigned long parent_rate)
46{ 45{
47 return clk->parent->rate / omap2xxx_get_sysclkdiv(); 46 return parent_rate / omap2xxx_get_sysclkdiv();
48} 47}
49
50
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 3524f0e7b6d5..7af224208a25 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2xxx DVFS virtual clock functions 2 * OMAP2xxx DVFS virtual clock functions
3 * 3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc. 4 * Copyright (C) 2005-2008, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation 5 * Copyright (C) 2004-2010 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
@@ -33,27 +33,34 @@
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"
42#include "clock2xxx.h" 40#include "clock2xxx.h"
43#include "opp2xxx.h" 41#include "opp2xxx.h"
44#include "cm2xxx_3xxx.h" 42#include "cm2xxx.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;
49 48
49/*
50 * sys_ck_rate: the rate of the external high-frequency clock
51 * oscillator on the board. Set by the SoC-specific clock init code.
52 * Once set during a boot, will not change.
53 */
54static unsigned long sys_ck_rate;
55
50/** 56/**
51 * omap2_table_mpu_recalc - just return the MPU speed 57 * omap2_table_mpu_recalc - just return the MPU speed
52 * @clk: virt_prcm_set struct clk 58 * @clk: virt_prcm_set struct clk
53 * 59 *
54 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. 60 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
55 */ 61 */
56unsigned long omap2_table_mpu_recalc(struct clk *clk) 62unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
63 unsigned long parent_rate)
57{ 64{
58 return curr_prcm_set->mpu_speed; 65 return curr_prcm_set->mpu_speed;
59} 66}
@@ -65,18 +72,18 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
65 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and 72 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
66 * just uses the ARM rates. 73 * just uses the ARM rates.
67 */ 74 */
68long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) 75long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
76 unsigned long *parent_rate)
69{ 77{
70 const struct prcm_config *ptr; 78 const struct prcm_config *ptr;
71 long highest_rate, sys_clk_rate; 79 long highest_rate;
72 80
73 highest_rate = -EINVAL; 81 highest_rate = -EINVAL;
74 sys_clk_rate = __clk_get_rate(sclk);
75 82
76 for (ptr = rate_table; ptr->mpu_speed; ptr++) { 83 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
77 if (!(ptr->flags & cpu_mask)) 84 if (!(ptr->flags & cpu_mask))
78 continue; 85 continue;
79 if (ptr->xtal_speed != sys_clk_rate) 86 if (ptr->xtal_speed != sys_ck_rate)
80 continue; 87 continue;
81 88
82 highest_rate = ptr->mpu_speed; 89 highest_rate = ptr->mpu_speed;
@@ -89,21 +96,19 @@ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
89} 96}
90 97
91/* Sets basic clocks based on the specified rate */ 98/* Sets basic clocks based on the specified rate */
92int omap2_select_table_rate(struct clk *clk, unsigned long rate) 99int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
100 unsigned long parent_rate)
93{ 101{
94 u32 cur_rate, done_rate, bypass = 0, tmp; 102 u32 cur_rate, done_rate, bypass = 0, tmp;
95 const struct prcm_config *prcm; 103 const struct prcm_config *prcm;
96 unsigned long found_speed = 0; 104 unsigned long found_speed = 0;
97 unsigned long flags; 105 unsigned long flags;
98 long sys_clk_rate;
99
100 sys_clk_rate = __clk_get_rate(sclk);
101 106
102 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 107 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
103 if (!(prcm->flags & cpu_mask)) 108 if (!(prcm->flags & cpu_mask))
104 continue; 109 continue;
105 110
106 if (prcm->xtal_speed != sys_clk_rate) 111 if (prcm->xtal_speed != sys_ck_rate)
107 continue; 112 continue;
108 113
109 if (prcm->mpu_speed <= rate) { 114 if (prcm->mpu_speed <= rate) {
@@ -119,7 +124,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
119 } 124 }
120 125
121 curr_prcm_set = prcm; 126 curr_prcm_set = prcm;
122 cur_rate = omap2xxx_clk_get_core_rate(dclk); 127 cur_rate = omap2xxx_clk_get_core_rate();
123 128
124 if (prcm->dpll_speed == cur_rate / 2) { 129 if (prcm->dpll_speed == cur_rate / 2) {
125 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); 130 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -169,3 +174,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
169 174
170 return 0; 175 return 0;
171} 176}
177
178/**
179 * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate
180 * table sets matches the current CORE DPLL hardware rate
181 *
182 * Check the MPU rate set by bootloader. Sets the 'curr_prcm_set'
183 * global to point to the active rate set when found; otherwise, sets
184 * it to NULL. No return value;
185 */
186void omap2xxx_clkt_vps_check_bootloader_rates(void)
187{
188 const struct prcm_config *prcm = NULL;
189 unsigned long rate;
190
191 rate = omap2xxx_clk_get_core_rate();
192 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
193 if (!(prcm->flags & cpu_mask))
194 continue;
195 if (prcm->xtal_speed != sys_ck_rate)
196 continue;
197 if (prcm->dpll_speed <= rate)
198 break;
199 }
200 curr_prcm_set = prcm;
201}
202
203/**
204 * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate
205 *
206 * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS
207 * code. (The sys_ck rate does not -- or rather, must not -- change
208 * during kernel runtime.) Must be called after we have a valid
209 * sys_ck rate, but before the virt_prcm_set clock rate is
210 * recalculated. No return value.
211 */
212void omap2xxx_clkt_vps_late_init(void)
213{
214 struct clk *c;
215
216 c = clk_get(NULL, "sys_ck");
217 if (IS_ERR(c)) {
218 WARN(1, "could not locate sys_ck\n");
219 } else {
220 sys_ck_rate = clk_get_rate(c);
221 clk_put(c);
222 }
223}
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 7c6da2f731dc..8e48c6d602e7 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"
@@ -47,8 +45,10 @@
47 * Program the DPLL M2 divider with the rounded target rate. Returns 45 * Program the DPLL M2 divider with the rounded target rate. Returns
48 * -EINVAL upon error, or 0 upon success. 46 * -EINVAL upon error, or 0 upon success.
49 */ 47 */
50int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) 48int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
49 unsigned long parent_rate)
51{ 50{
51 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
52 u32 new_div = 0; 52 u32 new_div = 0;
53 u32 unlock_dll = 0; 53 u32 unlock_dll = 0;
54 u32 c; 54 u32 c;
@@ -66,7 +66,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
66 return -EINVAL; 66 return -EINVAL;
67 67
68 sdrcrate = __clk_get_rate(sdrc_ick_p); 68 sdrcrate = __clk_get_rate(sdrc_ick_p);
69 clkrate = __clk_get_rate(clk); 69 clkrate = __clk_get_rate(hw->clk);
70 if (rate > clkrate) 70 if (rate > clkrate)
71 sdrcrate <<= ((rate / clkrate) >> 1); 71 sdrcrate <<= ((rate / clkrate) >> 1);
72 else 72 else
@@ -115,8 +115,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 115 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 116 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
117 0, 0, 0, 0); 117 0, 0, 0, 0);
118 clk->rate = rate;
119
120 return 0; 118 return 0;
121} 119}
122 120
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 3ff22114d702..0ec9f6fdf046 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -41,12 +41,10 @@
41 41
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/errno.h> 43#include <linux/errno.h>
44#include <linux/clk.h> 44#include <linux/clk-provider.h>
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 */
@@ -60,11 +58,14 @@
60 * the element associated with the supplied parent clock address. 58 * the element associated with the supplied parent clock address.
61 * Returns a pointer to the struct clksel on success or NULL on error. 59 * Returns a pointer to the struct clksel on success or NULL on error.
62 */ 60 */
63static const struct clksel *_get_clksel_by_parent(struct clk *clk, 61static const struct clksel *_get_clksel_by_parent(struct clk_hw_omap *clk,
64 struct clk *src_clk) 62 struct clk *src_clk)
65{ 63{
66 const struct clksel *clks; 64 const struct clksel *clks;
67 65
66 if (!src_clk)
67 return NULL;
68
68 for (clks = clk->clksel; clks->parent; clks++) 69 for (clks = clk->clksel; clks->parent; clks++)
69 if (clks->parent == src_clk) 70 if (clks->parent == src_clk)
70 break; /* Found the requested parent */ 71 break; /* Found the requested parent */
@@ -72,7 +73,7 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
72 if (!clks->parent) { 73 if (!clks->parent) {
73 /* This indicates a data problem */ 74 /* This indicates a data problem */
74 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n", 75 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n",
75 __clk_get_name(clk), __clk_get_name(src_clk)); 76 __clk_get_name(clk->hw.clk), __clk_get_name(src_clk));
76 return NULL; 77 return NULL;
77 } 78 }
78 79
@@ -80,64 +81,6 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
80} 81}
81 82
82/** 83/**
83 * _get_div_and_fieldval() - find the new clksel divisor and field value to use
84 * @src_clk: planned new parent struct clk *
85 * @clk: struct clk * that is being reparented
86 * @field_val: pointer to a u32 to contain the register data for the divisor
87 *
88 * Given an intended new parent struct clk * @src_clk, and the struct
89 * clk * @clk to the clock that is being reparented, find the
90 * appropriate rate divisor for the new clock (returned as the return
91 * value), and the corresponding register bitfield data to program to
92 * reach that divisor (returned in the u32 pointed to by @field_val).
93 * Returns 0 on error, or returns the newly-selected divisor upon
94 * success (in this latter case, the corresponding register bitfield
95 * value is passed back in the variable pointed to by @field_val)
96 */
97static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
98 u32 *field_val)
99{
100 const struct clksel *clks;
101 const struct clksel_rate *clkr, *max_clkr = NULL;
102 u8 max_div = 0;
103
104 clks = _get_clksel_by_parent(clk, src_clk);
105 if (!clks)
106 return 0;
107
108 /*
109 * Find the highest divisor (e.g., the one resulting in the
110 * lowest rate) to use as the default. This should avoid
111 * clock rates that are too high for the device. XXX A better
112 * solution here would be to try to determine if there is a
113 * divisor matching the original clock rate before the parent
114 * switch, and if it cannot be found, to fall back to the
115 * highest divisor.
116 */
117 for (clkr = clks->rates; clkr->div; clkr++) {
118 if (!(clkr->flags & cpu_mask))
119 continue;
120
121 if (clkr->div > max_div) {
122 max_div = clkr->div;
123 max_clkr = clkr;
124 }
125 }
126
127 if (max_div == 0) {
128 /* This indicates an error in the clksel data */
129 WARN(1, "clock: %s: could not find divisor for parent %s\n",
130 __clk_get_name(clk),
131 __clk_get_name(__clk_get_parent(src_clk)));
132 return 0;
133 }
134
135 *field_val = max_clkr->val;
136
137 return max_div;
138}
139
140/**
141 * _write_clksel_reg() - program a clock's clksel register in hardware 84 * _write_clksel_reg() - program a clock's clksel register in hardware
142 * @clk: struct clk * to program 85 * @clk: struct clk * to program
143 * @v: clksel bitfield value to program (with LSB at bit 0) 86 * @v: clksel bitfield value to program (with LSB at bit 0)
@@ -150,7 +93,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
150 * take into account any time the hardware might take to switch the 93 * take into account any time the hardware might take to switch the
151 * clock source. 94 * clock source.
152 */ 95 */
153static void _write_clksel_reg(struct clk *clk, u32 field_val) 96static void _write_clksel_reg(struct clk_hw_omap *clk, u32 field_val)
154{ 97{
155 u32 v; 98 u32 v;
156 99
@@ -173,13 +116,14 @@ static void _write_clksel_reg(struct clk *clk, u32 field_val)
173 * before calling. Returns 0 on error or returns the actual integer divisor 116 * before calling. Returns 0 on error or returns the actual integer divisor
174 * upon success. 117 * upon success.
175 */ 118 */
176static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) 119static u32 _clksel_to_divisor(struct clk_hw_omap *clk, u32 field_val)
177{ 120{
178 const struct clksel *clks; 121 const struct clksel *clks;
179 const struct clksel_rate *clkr; 122 const struct clksel_rate *clkr;
180 struct clk *parent; 123 struct clk *parent;
181 124
182 parent = __clk_get_parent(clk); 125 parent = __clk_get_parent(clk->hw.clk);
126
183 clks = _get_clksel_by_parent(clk, parent); 127 clks = _get_clksel_by_parent(clk, parent);
184 if (!clks) 128 if (!clks)
185 return 0; 129 return 0;
@@ -195,7 +139,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
195 if (!clkr->div) { 139 if (!clkr->div) {
196 /* This indicates a data error */ 140 /* This indicates a data error */
197 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n", 141 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n",
198 __clk_get_name(clk), field_val, __clk_get_name(parent)); 142 __clk_get_name(clk->hw.clk), field_val,
143 __clk_get_name(parent));
199 return 0; 144 return 0;
200 } 145 }
201 146
@@ -212,7 +157,7 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
212 * register field value _before_ left-shifting (i.e., LSB is at bit 157 * register field value _before_ left-shifting (i.e., LSB is at bit
213 * 0); or returns 0xFFFFFFFF (~0) upon error. 158 * 0); or returns 0xFFFFFFFF (~0) upon error.
214 */ 159 */
215static u32 _divisor_to_clksel(struct clk *clk, u32 div) 160static u32 _divisor_to_clksel(struct clk_hw_omap *clk, u32 div)
216{ 161{
217 const struct clksel *clks; 162 const struct clksel *clks;
218 const struct clksel_rate *clkr; 163 const struct clksel_rate *clkr;
@@ -221,7 +166,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
221 /* should never happen */ 166 /* should never happen */
222 WARN_ON(div == 0); 167 WARN_ON(div == 0);
223 168
224 parent = __clk_get_parent(clk); 169 parent = __clk_get_parent(clk->hw.clk);
225 clks = _get_clksel_by_parent(clk, parent); 170 clks = _get_clksel_by_parent(clk, parent);
226 if (!clks) 171 if (!clks)
227 return ~0; 172 return ~0;
@@ -236,7 +181,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
236 181
237 if (!clkr->div) { 182 if (!clkr->div) {
238 pr_err("clock: %s: could not find divisor %d for parent %s\n", 183 pr_err("clock: %s: could not find divisor %d for parent %s\n",
239 __clk_get_name(clk), div, __clk_get_name(parent)); 184 __clk_get_name(clk->hw.clk), div,
185 __clk_get_name(parent));
240 return ~0; 186 return ~0;
241 } 187 }
242 188
@@ -251,7 +197,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
251 * into the hardware, convert it into the actual divisor value, and 197 * into the hardware, convert it into the actual divisor value, and
252 * return it; or return 0 on error. 198 * return it; or return 0 on error.
253 */ 199 */
254static u32 _read_divisor(struct clk *clk) 200static u32 _read_divisor(struct clk_hw_omap *clk)
255{ 201{
256 u32 v; 202 u32 v;
257 203
@@ -279,7 +225,8 @@ static u32 _read_divisor(struct clk *clk)
279 * 225 *
280 * Returns the rounded clock rate or returns 0xffffffff on error. 226 * Returns the rounded clock rate or returns 0xffffffff on error.
281 */ 227 */
282u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 228u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
229 unsigned long target_rate,
283 u32 *new_div) 230 u32 *new_div)
284{ 231{
285 unsigned long test_rate; 232 unsigned long test_rate;
@@ -290,9 +237,9 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
290 unsigned long parent_rate; 237 unsigned long parent_rate;
291 const char *clk_name; 238 const char *clk_name;
292 239
293 parent = __clk_get_parent(clk); 240 parent = __clk_get_parent(clk->hw.clk);
241 clk_name = __clk_get_name(clk->hw.clk);
294 parent_rate = __clk_get_rate(parent); 242 parent_rate = __clk_get_rate(parent);
295 clk_name = __clk_get_name(clk);
296 243
297 if (!clk->clksel || !clk->clksel_mask) 244 if (!clk->clksel || !clk->clksel_mask)
298 return ~0; 245 return ~0;
@@ -343,27 +290,35 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
343 */ 290 */
344 291
345/** 292/**
346 * omap2_init_clksel_parent() - set a clksel clk's parent field from the hdwr 293 * omap2_clksel_find_parent_index() - return the array index of the current
347 * @clk: OMAP clock struct ptr to use 294 * hardware parent of @hw
295 * @hw: struct clk_hw * to find the current hardware parent of
348 * 296 *
349 * Given a pointer @clk to a source-selectable struct clk, read the 297 * Given a struct clk_hw pointer @hw to the 'hw' member of a struct
350 * hardware register and determine what its parent is currently set 298 * clk_hw_omap record representing a source-selectable hardware clock,
351 * to. Update @clk's .parent field with the appropriate clk ptr. No 299 * read the hardware register and determine what its parent is
352 * return value. 300 * currently set to. Intended to be called only by the common clock
301 * framework struct clk_hw_ops.get_parent function pointer. Return
302 * the array index of this parent clock upon success -- there is no
303 * way to return an error, so if we encounter an error, just WARN()
304 * and pretend that we know that we're doing.
353 */ 305 */
354void omap2_init_clksel_parent(struct clk *clk) 306u8 omap2_clksel_find_parent_index(struct clk_hw *hw)
355{ 307{
308 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
356 const struct clksel *clks; 309 const struct clksel *clks;
357 const struct clksel_rate *clkr; 310 const struct clksel_rate *clkr;
358 u32 r, found = 0; 311 u32 r, found = 0;
359 struct clk *parent; 312 struct clk *parent;
360 const char *clk_name; 313 const char *clk_name;
314 int ret = 0, f = 0;
361 315
362 if (!clk->clksel || !clk->clksel_mask) 316 parent = __clk_get_parent(hw->clk);
363 return; 317 clk_name = __clk_get_name(hw->clk);
364 318
365 parent = __clk_get_parent(clk); 319 /* XXX should be able to return an error */
366 clk_name = __clk_get_name(clk); 320 WARN((!clk->clksel || !clk->clksel_mask),
321 "clock: %s: attempt to call on a non-clksel clock", clk_name);
367 322
368 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; 323 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
369 r >>= __ffs(clk->clksel_mask); 324 r >>= __ffs(clk->clksel_mask);
@@ -374,27 +329,21 @@ void omap2_init_clksel_parent(struct clk *clk)
374 continue; 329 continue;
375 330
376 if (clkr->val == r) { 331 if (clkr->val == r) {
377 if (parent != clks->parent) {
378 pr_debug("clock: %s: inited parent to %s (was %s)\n",
379 clk_name,
380 __clk_get_name(clks->parent),
381 ((parent) ?
382 __clk_get_name(parent) :
383 "NULL"));
384 clk_reparent(clk, clks->parent);
385 }
386 found = 1; 332 found = 1;
333 ret = f;
387 } 334 }
388 } 335 }
336 f++;
389 } 337 }
390 338
391 /* This indicates a data error */ 339 /* This indicates a data error */
392 WARN(!found, "clock: %s: init parent: could not find regval %0x\n", 340 WARN(!found, "clock: %s: init parent: could not find regval %0x\n",
393 clk_name, r); 341 clk_name, r);
394 342
395 return; 343 return ret;
396} 344}
397 345
346
398/** 347/**
399 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field 348 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field
400 * @clk: struct clk * 349 * @clk: struct clk *
@@ -404,21 +353,23 @@ void omap2_init_clksel_parent(struct clk *clk)
404 * function. Returns the clock's current rate, based on its parent's rate 353 * function. Returns the clock's current rate, based on its parent's rate
405 * and its current divisor setting in the hardware. 354 * and its current divisor setting in the hardware.
406 */ 355 */
407unsigned long omap2_clksel_recalc(struct clk *clk) 356unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate)
408{ 357{
409 unsigned long rate; 358 unsigned long rate;
410 u32 div = 0; 359 u32 div = 0;
411 struct clk *parent; 360 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
412 361
413 div = _read_divisor(clk); 362 if (!parent_rate)
414 if (div == 0) 363 return 0;
415 return __clk_get_rate(clk);
416 364
417 parent = __clk_get_parent(clk); 365 div = _read_divisor(clk);
418 rate = __clk_get_rate(parent) / div; 366 if (!div)
367 rate = parent_rate;
368 else
369 rate = parent_rate / div;
419 370
420 pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n", 371 pr_debug("%s: recalc'd %s's rate to %lu (div %d)\n", __func__,
421 __clk_get_name(clk), rate, div); 372 __clk_get_name(hw->clk), rate, div);
422 373
423 return rate; 374 return rate;
424} 375}
@@ -434,8 +385,10 @@ unsigned long omap2_clksel_recalc(struct clk *clk)
434 * 385 *
435 * Returns the rounded clock rate or returns 0xffffffff on error. 386 * Returns the rounded clock rate or returns 0xffffffff on error.
436 */ 387 */
437long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) 388long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
389 unsigned long *parent_rate)
438{ 390{
391 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
439 u32 new_div; 392 u32 new_div;
440 393
441 return omap2_clksel_round_rate_div(clk, target_rate, &new_div); 394 return omap2_clksel_round_rate_div(clk, target_rate, &new_div);
@@ -456,8 +409,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)
456 * is changed, they will all be affected without any notification. 409 * is changed, they will all be affected without any notification.
457 * Returns -EINVAL upon error, or 0 upon success. 410 * Returns -EINVAL upon error, or 0 upon success.
458 */ 411 */
459int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) 412int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
413 unsigned long parent_rate)
460{ 414{
415 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
461 u32 field_val, validrate, new_div = 0; 416 u32 field_val, validrate, new_div = 0;
462 417
463 if (!clk->clksel || !clk->clksel_mask) 418 if (!clk->clksel || !clk->clksel_mask)
@@ -473,10 +428,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
473 428
474 _write_clksel_reg(clk, field_val); 429 _write_clksel_reg(clk, field_val);
475 430
476 clk->rate = __clk_get_rate(__clk_get_parent(clk)) / new_div; 431 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(hw->clk),
477 432 __clk_get_rate(hw->clk));
478 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(clk),
479 __clk_get_rate(clk));
480 433
481 return 0; 434 return 0;
482} 435}
@@ -501,32 +454,13 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
501 * affected without any notification. Returns -EINVAL upon error, or 454 * affected without any notification. Returns -EINVAL upon error, or
502 * 0 upon success. 455 * 0 upon success.
503 */ 456 */
504int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent) 457int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val)
505{ 458{
506 u32 field_val = 0; 459 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
507 u32 parent_div;
508 460
509 if (!clk->clksel || !clk->clksel_mask) 461 if (!clk->clksel || !clk->clksel_mask)
510 return -EINVAL; 462 return -EINVAL;
511 463
512 parent_div = _get_div_and_fieldval(new_parent, clk, &field_val);
513 if (!parent_div)
514 return -EINVAL;
515
516 _write_clksel_reg(clk, field_val); 464 _write_clksel_reg(clk, field_val);
517
518 clk_reparent(clk, new_parent);
519
520 /* CLKSEL clocks follow their parents' rates, divided by a divisor */
521 clk->rate = __clk_get_rate(new_parent);
522
523 if (parent_div > 0)
524 __clk_get_rate(clk) /= parent_div;
525
526 pr_debug("clock: %s: set parent to %s (new rate %ld)\n",
527 __clk_get_name(clk),
528 __clk_get_name(__clk_get_parent(clk)),
529 __clk_get_rate(clk));
530
531 return 0; 465 return 0;
532} 466}
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 80411142f482..924c230f8948 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -16,13 +16,11 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/clk.h> 19#include <linux/clk-provider.h>
20#include <linux/io.h> 20#include <linux/io.h>
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"
@@ -78,7 +76,7 @@
78 * (assuming that it is counting N upwards), or -2 if the enclosing loop 76 * (assuming that it is counting N upwards), or -2 if the enclosing loop
79 * should skip to the next iteration (again assuming N is increasing). 77 * should skip to the next iteration (again assuming N is increasing).
80 */ 78 */
81static int _dpll_test_fint(struct clk *clk, u8 n) 79static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
82{ 80{
83 struct dpll_data *dd; 81 struct dpll_data *dd;
84 long fint, fint_min, fint_max; 82 long fint, fint_min, fint_max;
@@ -87,7 +85,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
87 dd = clk->dpll_data; 85 dd = clk->dpll_data;
88 86
89 /* DPLL divider must result in a valid jitter correction val */ 87 /* DPLL divider must result in a valid jitter correction val */
90 fint = __clk_get_rate(__clk_get_parent(clk)) / n; 88 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
91 89
92 if (cpu_is_omap24xx()) { 90 if (cpu_is_omap24xx()) {
93 /* Should not be called for OMAP2, so warn if it is called */ 91 /* Should not be called for OMAP2, so warn if it is called */
@@ -188,15 +186,15 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
188} 186}
189 187
190/* Public functions */ 188/* Public functions */
191 189u8 omap2_init_dpll_parent(struct clk_hw *hw)
192void omap2_init_dpll_parent(struct clk *clk)
193{ 190{
191 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
194 u32 v; 192 u32 v;
195 struct dpll_data *dd; 193 struct dpll_data *dd;
196 194
197 dd = clk->dpll_data; 195 dd = clk->dpll_data;
198 if (!dd) 196 if (!dd)
199 return; 197 return -EINVAL;
200 198
201 v = __raw_readl(dd->control_reg); 199 v = __raw_readl(dd->control_reg);
202 v &= dd->enable_mask; 200 v &= dd->enable_mask;
@@ -206,18 +204,18 @@ void omap2_init_dpll_parent(struct clk *clk)
206 if (cpu_is_omap24xx()) { 204 if (cpu_is_omap24xx()) {
207 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 205 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
208 v == OMAP2XXX_EN_DPLL_FRBYPASS) 206 v == OMAP2XXX_EN_DPLL_FRBYPASS)
209 clk_reparent(clk, dd->clk_bypass); 207 return 1;
210 } else if (cpu_is_omap34xx()) { 208 } else if (cpu_is_omap34xx()) {
211 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 209 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
212 v == OMAP3XXX_EN_DPLL_FRBYPASS) 210 v == OMAP3XXX_EN_DPLL_FRBYPASS)
213 clk_reparent(clk, dd->clk_bypass); 211 return 1;
214 } else if (soc_is_am33xx() || cpu_is_omap44xx()) { 212 } else if (soc_is_am33xx() || cpu_is_omap44xx()) {
215 if (v == OMAP4XXX_EN_DPLL_LPBYPASS || 213 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
216 v == OMAP4XXX_EN_DPLL_FRBYPASS || 214 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
217 v == OMAP4XXX_EN_DPLL_MNBYPASS) 215 v == OMAP4XXX_EN_DPLL_MNBYPASS)
218 clk_reparent(clk, dd->clk_bypass); 216 return 1;
219 } 217 }
220 return; 218 return 0;
221} 219}
222 220
223/** 221/**
@@ -234,7 +232,7 @@ void omap2_init_dpll_parent(struct clk *clk)
234 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0 232 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0
235 * if the clock @clk is not a DPLL. 233 * if the clock @clk is not a DPLL.
236 */ 234 */
237u32 omap2_get_dpll_rate(struct clk *clk) 235unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
238{ 236{
239 long long dpll_clk; 237 long long dpll_clk;
240 u32 dpll_mult, dpll_div, v; 238 u32 dpll_mult, dpll_div, v;
@@ -290,8 +288,10 @@ u32 omap2_get_dpll_rate(struct clk *clk)
290 * (expensive) function again. Returns ~0 if the target rate cannot 288 * (expensive) function again. Returns ~0 if the target rate cannot
291 * be rounded, or the rounded rate upon success. 289 * be rounded, or the rounded rate upon success.
292 */ 290 */
293long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) 291long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
292 unsigned long *parent_rate)
294{ 293{
294 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
295 int m, n, r, scaled_max_m; 295 int m, n, r, scaled_max_m;
296 unsigned long scaled_rt_rp; 296 unsigned long scaled_rt_rp;
297 unsigned long new_rate = 0; 297 unsigned long new_rate = 0;
@@ -305,7 +305,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
305 dd = clk->dpll_data; 305 dd = clk->dpll_data;
306 306
307 ref_rate = __clk_get_rate(dd->clk_ref); 307 ref_rate = __clk_get_rate(dd->clk_ref);
308 clk_name = __clk_get_name(clk); 308 clk_name = __clk_get_name(hw->clk);
309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", 309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
310 clk_name, target_rate); 310 clk_name, target_rate);
311 311
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 3d43fba2542f..f10eb03ce3e2 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -11,11 +11,9 @@
11#undef DEBUG 11#undef DEBUG
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/clk.h> 14#include <linux/clk-provider.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/clock.h>
18#include <plat/prcm.h>
19 17
20#include "clock.h" 18#include "clock.h"
21#include "clock2xxx.h" 19#include "clock2xxx.h"
@@ -25,7 +23,7 @@
25/* Private functions */ 23/* Private functions */
26 24
27/* XXX */ 25/* XXX */
28void omap2_clkt_iclk_allow_idle(struct clk *clk) 26void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
29{ 27{
30 u32 v, r; 28 u32 v, r;
31 29
@@ -37,7 +35,7 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk)
37} 35}
38 36
39/* XXX */ 37/* XXX */
40void omap2_clkt_iclk_deny_idle(struct clk *clk) 38void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
41{ 39{
42 u32 v, r; 40 u32 v, r;
43 41
@@ -50,33 +48,17 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk)
50 48
51/* Public data */ 49/* Public data */
52 50
53const struct clkops clkops_omap2_iclk_dflt_wait = { 51const struct clk_hw_omap_ops clkhwops_iclk = {
54 .enable = omap2_dflt_clk_enable,
55 .disable = omap2_dflt_clk_disable,
56 .find_companion = omap2_clk_dflt_find_companion,
57 .find_idlest = omap2_clk_dflt_find_idlest,
58 .allow_idle = omap2_clkt_iclk_allow_idle, 52 .allow_idle = omap2_clkt_iclk_allow_idle,
59 .deny_idle = omap2_clkt_iclk_deny_idle, 53 .deny_idle = omap2_clkt_iclk_deny_idle,
60}; 54};
61 55
62const struct clkops clkops_omap2_iclk_dflt = { 56const struct clk_hw_omap_ops clkhwops_iclk_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .allow_idle = omap2_clkt_iclk_allow_idle, 57 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle, 58 .deny_idle = omap2_clkt_iclk_deny_idle,
59 .find_idlest = omap2_clk_dflt_find_idlest,
60 .find_companion = omap2_clk_dflt_find_companion,
67}; 61};
68 62
69const struct clkops clkops_omap2_iclk_idle_only = {
70 .allow_idle = omap2_clkt_iclk_allow_idle,
71 .deny_idle = omap2_clkt_iclk_deny_idle,
72};
73 63
74const struct clkops clkops_omap2_mdmclk_dflt_wait = {
75 .enable = omap2_dflt_clk_enable,
76 .disable = omap2_dflt_clk_disable,
77 .find_companion = omap2_clk_dflt_find_companion,
78 .find_idlest = omap2_clk_dflt_find_idlest,
79 .allow_idle = omap2_clkt_iclk_allow_idle,
80 .deny_idle = omap2_clkt_iclk_deny_idle,
81};
82 64
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 961ac8f7e13d..e4ec3a69ee2e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -15,27 +15,35 @@
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>
21#include <linux/delay.h> 22#include <linux/delay.h>
22#include <linux/clk.h> 23#include <linux/clk-provider.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/bitops.h> 25#include <linux/bitops.h>
25 26
26#include <asm/cpu.h> 27#include <asm/cpu.h>
27 28
28#include <plat/clock.h>
29#include <plat/prcm.h>
30 29
31#include <trace/events/power.h> 30#include <trace/events/power.h>
32 31
33#include "soc.h" 32#include "soc.h"
34#include "clockdomain.h" 33#include "clockdomain.h"
35#include "clock.h" 34#include "clock.h"
36#include "cm2xxx_3xxx.h" 35#include "cm.h"
36#include "cm2xxx.h"
37#include "cm3xxx.h"
37#include "cm-regbits-24xx.h" 38#include "cm-regbits-24xx.h"
38#include "cm-regbits-34xx.h" 39#include "cm-regbits-34xx.h"
40#include "common.h"
41
42/*
43 * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait
44 * for a module to indicate that it is no longer in idle
45 */
46#define MAX_MODULE_ENABLE_WAIT 100000
39 47
40u16 cpu_mask; 48u16 cpu_mask;
41 49
@@ -47,12 +55,69 @@ u16 cpu_mask;
47 */ 55 */
48static bool clkdm_control = true; 56static bool clkdm_control = true;
49 57
58static LIST_HEAD(clk_hw_omap_clocks);
59
60/*
61 * Used for clocks that have the same value as the parent clock,
62 * divided by some factor
63 */
64unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
65 unsigned long parent_rate)
66{
67 struct clk_hw_omap *oclk;
68
69 if (!hw) {
70 pr_warn("%s: hw is NULL\n", __func__);
71 return -EINVAL;
72 }
73
74 oclk = to_clk_hw_omap(hw);
75
76 WARN_ON(!oclk->fixed_div);
77
78 return parent_rate / oclk->fixed_div;
79}
80
50/* 81/*
51 * OMAP2+ specific clock functions 82 * OMAP2+ specific clock functions
52 */ 83 */
53 84
54/* Private functions */ 85/* Private functions */
55 86
87
88/**
89 * _wait_idlest_generic - wait for a module to leave the idle state
90 * @reg: virtual address of module IDLEST register
91 * @mask: value to mask against to determine if the module is active
92 * @idlest: idle state indicator (0 or 1) for the clock
93 * @name: name of the clock (for printk)
94 *
95 * Wait for a module to leave idle, where its idle-status register is
96 * not inside the CM module. Returns 1 if the module left idle
97 * promptly, or 0 if the module did not leave idle before the timeout
98 * elapsed. XXX Deprecated - should be moved into drivers for the
99 * individual IP block that the IDLEST register exists in.
100 */
101static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
102 const char *name)
103{
104 int i = 0, ena = 0;
105
106 ena = (idlest) ? 0 : mask;
107
108 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
109 MAX_MODULE_ENABLE_WAIT, i);
110
111 if (i < MAX_MODULE_ENABLE_WAIT)
112 pr_debug("omap clock: module associated with clock %s ready after %d loops\n",
113 name, i);
114 else
115 pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n",
116 name, MAX_MODULE_ENABLE_WAIT);
117
118 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
119};
120
56/** 121/**
57 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE 122 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE
58 * @clk: struct clk * belonging to the module 123 * @clk: struct clk * belonging to the module
@@ -63,10 +128,12 @@ static bool clkdm_control = true;
63 * belong in the clock code and will be moved in the medium term to 128 * belong in the clock code and will be moved in the medium term to
64 * module-dependent code. No return value. 129 * module-dependent code. No return value.
65 */ 130 */
66static void _omap2_module_wait_ready(struct clk *clk) 131static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
67{ 132{
68 void __iomem *companion_reg, *idlest_reg; 133 void __iomem *companion_reg, *idlest_reg;
69 u8 other_bit, idlest_bit, idlest_val; 134 u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
135 s16 prcm_mod;
136 int r;
70 137
71 /* Not all modules have multiple clocks that their IDLEST depends on */ 138 /* Not all modules have multiple clocks that their IDLEST depends on */
72 if (clk->ops->find_companion) { 139 if (clk->ops->find_companion) {
@@ -76,9 +143,14 @@ static void _omap2_module_wait_ready(struct clk *clk)
76 } 143 }
77 144
78 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); 145 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
79 146 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
80 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, 147 if (r) {
81 __clk_get_name(clk)); 148 /* IDLEST register not in the CM module */
149 _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
150 __clk_get_name(clk->hw.clk));
151 } else {
152 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
153 };
82} 154}
83 155
84/* Public functions */ 156/* Public functions */
@@ -91,15 +163,16 @@ static void _omap2_module_wait_ready(struct clk *clk)
91 * clockdomain pointer, and save it into the struct clk. Intended to be 163 * clockdomain pointer, and save it into the struct clk. Intended to be
92 * called during clk_register(). No return value. 164 * called during clk_register(). No return value.
93 */ 165 */
94void omap2_init_clk_clkdm(struct clk *clk) 166void omap2_init_clk_clkdm(struct clk_hw *hw)
95{ 167{
168 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
96 struct clockdomain *clkdm; 169 struct clockdomain *clkdm;
97 const char *clk_name; 170 const char *clk_name;
98 171
99 if (!clk->clkdm_name) 172 if (!clk->clkdm_name)
100 return; 173 return;
101 174
102 clk_name = __clk_get_name(clk); 175 clk_name = __clk_get_name(hw->clk);
103 176
104 clkdm = clkdm_lookup(clk->clkdm_name); 177 clkdm = clkdm_lookup(clk->clkdm_name);
105 if (clkdm) { 178 if (clkdm) {
@@ -146,8 +219,8 @@ void __init omap2_clk_disable_clkdm_control(void)
146 * associate this type of code with per-module data structures to 219 * associate this type of code with per-module data structures to
147 * avoid this issue, and remove the casts. No return value. 220 * avoid this issue, and remove the casts. No return value.
148 */ 221 */
149void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, 222void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
150 u8 *other_bit) 223 void __iomem **other_reg, u8 *other_bit)
151{ 224{
152 u32 r; 225 u32 r;
153 226
@@ -175,8 +248,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
175 * register address ID (e.g., that CM_FCLKEN2 corresponds to 248 * register address ID (e.g., that CM_FCLKEN2 corresponds to
176 * CM_IDLEST2). This is not true for all modules. No return value. 249 * CM_IDLEST2). This is not true for all modules. No return value.
177 */ 250 */
178void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 251void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
179 u8 *idlest_bit, u8 *idlest_val) 252 void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val)
180{ 253{
181 u32 r; 254 u32 r;
182 255
@@ -198,16 +271,44 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
198 271
199} 272}
200 273
201int omap2_dflt_clk_enable(struct clk *clk) 274/**
275 * omap2_dflt_clk_enable - enable a clock in the hardware
276 * @hw: struct clk_hw * of the clock to enable
277 *
278 * Enable the clock @hw in the hardware. We first call into the OMAP
279 * clockdomain code to "enable" the corresponding clockdomain if this
280 * is the first enabled user of the clockdomain. Then program the
281 * hardware to enable the clock. Then wait for the IP block that uses
282 * this clock to leave idle (if applicable). Returns the error value
283 * from clkdm_clk_enable() if it terminated with an error, or -EINVAL
284 * if @hw has a null clock enable_reg, or zero upon success.
285 */
286int omap2_dflt_clk_enable(struct clk_hw *hw)
202{ 287{
288 struct clk_hw_omap *clk;
203 u32 v; 289 u32 v;
290 int ret = 0;
291
292 clk = to_clk_hw_omap(hw);
293
294 if (clkdm_control && clk->clkdm) {
295 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
296 if (ret) {
297 WARN(1, "%s: could not enable %s's clockdomain %s: %d\n",
298 __func__, __clk_get_name(hw->clk),
299 clk->clkdm->name, ret);
300 return ret;
301 }
302 }
204 303
205 if (unlikely(clk->enable_reg == NULL)) { 304 if (unlikely(clk->enable_reg == NULL)) {
206 pr_err("clock.c: Enable for %s without enable code\n", 305 pr_err("%s: %s missing enable_reg\n", __func__,
207 clk->name); 306 __clk_get_name(hw->clk));
208 return 0; /* REVISIT: -EINVAL */ 307 ret = -EINVAL;
308 goto err;
209 } 309 }
210 310
311 /* FIXME should not have INVERT_ENABLE bit here */
211 v = __raw_readl(clk->enable_reg); 312 v = __raw_readl(clk->enable_reg);
212 if (clk->flags & INVERT_ENABLE) 313 if (clk->flags & INVERT_ENABLE)
213 v &= ~(1 << clk->enable_bit); 314 v &= ~(1 << clk->enable_bit);
@@ -216,22 +317,39 @@ int omap2_dflt_clk_enable(struct clk *clk)
216 __raw_writel(v, clk->enable_reg); 317 __raw_writel(v, clk->enable_reg);
217 v = __raw_readl(clk->enable_reg); /* OCP barrier */ 318 v = __raw_readl(clk->enable_reg); /* OCP barrier */
218 319
219 if (clk->ops->find_idlest) 320 if (clk->ops && clk->ops->find_idlest)
220 _omap2_module_wait_ready(clk); 321 _omap2_module_wait_ready(clk);
221 322
222 return 0; 323 return 0;
324
325err:
326 if (clkdm_control && clk->clkdm)
327 clkdm_clk_disable(clk->clkdm, hw->clk);
328 return ret;
223} 329}
224 330
225void omap2_dflt_clk_disable(struct clk *clk) 331/**
332 * omap2_dflt_clk_disable - disable a clock in the hardware
333 * @hw: struct clk_hw * of the clock to disable
334 *
335 * Disable the clock @hw in the hardware, and call into the OMAP
336 * clockdomain code to "disable" the corresponding clockdomain if all
337 * clocks/hwmods in that clockdomain are now disabled. No return
338 * value.
339 */
340void omap2_dflt_clk_disable(struct clk_hw *hw)
226{ 341{
342 struct clk_hw_omap *clk;
227 u32 v; 343 u32 v;
228 344
345 clk = to_clk_hw_omap(hw);
229 if (!clk->enable_reg) { 346 if (!clk->enable_reg) {
230 /* 347 /*
231 * 'Independent' here refers to a clock which is not 348 * 'independent' here refers to a clock which is not
232 * controlled by its parent. 349 * controlled by its parent.
233 */ 350 */
234 pr_err("clock: clk_disable called on independent clock %s which has no enable_reg\n", clk->name); 351 pr_err("%s: independent clock %s has no enable_reg\n",
352 __func__, __clk_get_name(hw->clk));
235 return; 353 return;
236 } 354 }
237 355
@@ -242,191 +360,213 @@ void omap2_dflt_clk_disable(struct clk *clk)
242 v &= ~(1 << clk->enable_bit); 360 v &= ~(1 << clk->enable_bit);
243 __raw_writel(v, clk->enable_reg); 361 __raw_writel(v, clk->enable_reg);
244 /* No OCP barrier needed here since it is a disable operation */ 362 /* No OCP barrier needed here since it is a disable operation */
245}
246
247const struct clkops clkops_omap2_dflt_wait = {
248 .enable = omap2_dflt_clk_enable,
249 .disable = omap2_dflt_clk_disable,
250 .find_companion = omap2_clk_dflt_find_companion,
251 .find_idlest = omap2_clk_dflt_find_idlest,
252};
253 363
254const struct clkops clkops_omap2_dflt = { 364 if (clkdm_control && clk->clkdm)
255 .enable = omap2_dflt_clk_enable, 365 clkdm_clk_disable(clk->clkdm, hw->clk);
256 .disable = omap2_dflt_clk_disable, 366}
257};
258 367
259/** 368/**
260 * omap2_clk_disable - disable a clock, if the system is not using it 369 * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
261 * @clk: struct clk * to disable 370 * @hw: struct clk_hw * of the clock being enabled
262 * 371 *
263 * Decrements the usecount on struct clk @clk. If there are no users 372 * Increment the usecount of the clockdomain of the clock pointed to
264 * left, call the clkops-specific clock disable function to disable it 373 * by @hw; if the usecount is 1, the clockdomain will be "enabled."
265 * in hardware. If the clock is part of a clockdomain (which they all 374 * Only needed for clocks that don't use omap2_dflt_clk_enable() as
266 * should be), request that the clockdomain be disabled. (It too has 375 * their enable function pointer. Passes along the return value of
267 * a usecount, and so will not be disabled in the hardware until it no 376 * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
268 * longer has any users.) If the clock has a parent clock (most of 377 * clockdomain, or 0 if clock framework-based clockdomain control is
269 * them do), then call ourselves, recursing on the parent clock. This 378 * not implemented.
270 * can cause an entire branch of the clock tree to be powered off by
271 * simply disabling one clock. Intended to be called with the clockfw_lock
272 * spinlock held. No return value.
273 */ 379 */
274void omap2_clk_disable(struct clk *clk) 380int omap2_clkops_enable_clkdm(struct clk_hw *hw)
275{ 381{
276 if (clk->usecount == 0) { 382 struct clk_hw_omap *clk;
277 WARN(1, "clock: %s: omap2_clk_disable() called, but usecount already 0?", clk->name); 383 int ret = 0;
278 return;
279 }
280 384
281 pr_debug("clock: %s: decrementing usecount\n", clk->name); 385 clk = to_clk_hw_omap(hw);
282 386
283 clk->usecount--; 387 if (unlikely(!clk->clkdm)) {
284 388 pr_err("%s: %s: no clkdm set ?!\n", __func__,
285 if (clk->usecount > 0) 389 __clk_get_name(hw->clk));
286 return; 390 return -EINVAL;
391 }
287 392
288 pr_debug("clock: %s: disabling in hardware\n", clk->name); 393 if (unlikely(clk->enable_reg))
394 pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
395 __clk_get_name(hw->clk));
289 396
290 if (clk->ops && clk->ops->disable) { 397 if (!clkdm_control) {
291 trace_clock_disable(clk->name, 0, smp_processor_id()); 398 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
292 clk->ops->disable(clk); 399 __func__, __clk_get_name(hw->clk));
400 return 0;
293 } 401 }
294 402
295 if (clkdm_control && clk->clkdm) 403 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
296 clkdm_clk_disable(clk->clkdm, clk); 404 WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
405 __func__, __clk_get_name(hw->clk), clk->clkdm->name, ret);
297 406
298 if (clk->parent) 407 return ret;
299 omap2_clk_disable(clk->parent);
300} 408}
301 409
302/** 410/**
303 * omap2_clk_enable - request that the system enable a clock 411 * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
304 * @clk: struct clk * to enable 412 * @hw: struct clk_hw * of the clock being disabled
305 * 413 *
306 * Increments the usecount on struct clk @clk. If there were no users 414 * Decrement the usecount of the clockdomain of the clock pointed to
307 * previously, then recurse up the clock tree, enabling all of the 415 * by @hw; if the usecount is 0, the clockdomain will be "disabled."
308 * clock's parents and all of the parent clockdomains, and finally, 416 * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
309 * enabling @clk's clockdomain, and @clk itself. Intended to be 417 * disable function pointer. No return value.
310 * called with the clockfw_lock spinlock held. Returns 0 upon success
311 * or a negative error code upon failure.
312 */ 418 */
313int omap2_clk_enable(struct clk *clk) 419void omap2_clkops_disable_clkdm(struct clk_hw *hw)
314{ 420{
315 int ret; 421 struct clk_hw_omap *clk;
316
317 pr_debug("clock: %s: incrementing usecount\n", clk->name);
318
319 clk->usecount++;
320
321 if (clk->usecount > 1)
322 return 0;
323 422
324 pr_debug("clock: %s: enabling in hardware\n", clk->name); 423 clk = to_clk_hw_omap(hw);
325 424
326 if (clk->parent) { 425 if (unlikely(!clk->clkdm)) {
327 ret = omap2_clk_enable(clk->parent); 426 pr_err("%s: %s: no clkdm set ?!\n", __func__,
328 if (ret) { 427 __clk_get_name(hw->clk));
329 WARN(1, "clock: %s: could not enable parent %s: %d\n", 428 return;
330 clk->name, clk->parent->name, ret);
331 goto oce_err1;
332 }
333 } 429 }
334 430
335 if (clkdm_control && clk->clkdm) { 431 if (unlikely(clk->enable_reg))
336 ret = clkdm_clk_enable(clk->clkdm, clk); 432 pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
337 if (ret) { 433 __clk_get_name(hw->clk));
338 WARN(1, "clock: %s: could not enable clockdomain %s: %d\n",
339 clk->name, clk->clkdm->name, ret);
340 goto oce_err2;
341 }
342 }
343 434
344 if (clk->ops && clk->ops->enable) { 435 if (!clkdm_control) {
345 trace_clock_enable(clk->name, 1, smp_processor_id()); 436 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
346 ret = clk->ops->enable(clk); 437 __func__, __clk_get_name(hw->clk));
347 if (ret) { 438 return;
348 WARN(1, "clock: %s: could not enable: %d\n",
349 clk->name, ret);
350 goto oce_err3;
351 }
352 } 439 }
353 440
354 return 0; 441 clkdm_clk_disable(clk->clkdm, hw->clk);
355
356oce_err3:
357 if (clkdm_control && clk->clkdm)
358 clkdm_clk_disable(clk->clkdm, clk);
359oce_err2:
360 if (clk->parent)
361 omap2_clk_disable(clk->parent);
362oce_err1:
363 clk->usecount--;
364
365 return ret;
366} 442}
367 443
368/* Given a clock and a rate apply a clock specific rounding function */ 444/**
369long omap2_clk_round_rate(struct clk *clk, unsigned long rate) 445 * omap2_dflt_clk_is_enabled - is clock enabled in the hardware?
446 * @hw: struct clk_hw * to check
447 *
448 * Return 1 if the clock represented by @hw is enabled in the
449 * hardware, or 0 otherwise. Intended for use in the struct
450 * clk_ops.is_enabled function pointer.
451 */
452int omap2_dflt_clk_is_enabled(struct clk_hw *hw)
370{ 453{
371 if (clk->round_rate) 454 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
372 return clk->round_rate(clk, rate); 455 u32 v;
456
457 v = __raw_readl(clk->enable_reg);
458
459 if (clk->flags & INVERT_ENABLE)
460 v ^= BIT(clk->enable_bit);
461
462 v &= BIT(clk->enable_bit);
373 463
374 return clk->rate; 464 return v ? 1 : 0;
375} 465}
376 466
377/* Set the clock rate for a clock source */ 467static int __initdata mpurate;
378int omap2_clk_set_rate(struct clk *clk, unsigned long rate) 468
469/*
470 * By default we use the rate set by the bootloader.
471 * You can override this with mpurate= cmdline option.
472 */
473static int __init omap_clk_setup(char *str)
379{ 474{
380 int ret = -EINVAL; 475 get_option(&str, &mpurate);
381 476
382 pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate); 477 if (!mpurate)
478 return 1;
383 479
384 /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ 480 if (mpurate < 1000)
385 if (clk->set_rate) { 481 mpurate *= 1000000;
386 trace_clock_set_rate(clk->name, rate, smp_processor_id());
387 ret = clk->set_rate(clk, rate);
388 }
389 482
390 return ret; 483 return 1;
391} 484}
485__setup("mpurate=", omap_clk_setup);
392 486
393int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) 487/**
488 * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
489 * @clk: struct clk * to initialize
490 *
491 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used
492 * temporarily for autoidle handling, until this support can be
493 * integrated into the common clock framework code in some way. No
494 * return value.
495 */
496void omap2_init_clk_hw_omap_clocks(struct clk *clk)
394{ 497{
395 if (!clk->clksel) 498 struct clk_hw_omap *c;
396 return -EINVAL;
397 499
398 if (clk->parent == new_parent) 500 if (__clk_get_flags(clk) & CLK_IS_BASIC)
399 return 0; 501 return;
400 502
401 return omap2_clksel_set_parent(clk, new_parent); 503 c = to_clk_hw_omap(__clk_get_hw(clk));
504 list_add(&c->node, &clk_hw_omap_clocks);
402} 505}
403 506
404/* 507/**
405 * OMAP2+ clock reset and init functions 508 * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
509 * support it
510 *
511 * Enable clock autoidle on all OMAP clocks that have allow_idle
512 * function pointers associated with them. This function is intended
513 * to be temporary until support for this is added to the common clock
514 * code. Returns 0.
406 */ 515 */
516int omap2_clk_enable_autoidle_all(void)
517{
518 struct clk_hw_omap *c;
519
520 list_for_each_entry(c, &clk_hw_omap_clocks, node)
521 if (c->ops && c->ops->allow_idle)
522 c->ops->allow_idle(c);
523 return 0;
524}
407 525
408#ifdef CONFIG_OMAP_RESET_CLOCKS 526/**
409void omap2_clk_disable_unused(struct clk *clk) 527 * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
528 * support it
529 *
530 * Disable clock autoidle on all OMAP clocks that have allow_idle
531 * function pointers associated with them. This function is intended
532 * to be temporary until support for this is added to the common clock
533 * code. Returns 0.
534 */
535int omap2_clk_disable_autoidle_all(void)
410{ 536{
411 u32 regval32, v; 537 struct clk_hw_omap *c;
412 538
413 v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0; 539 list_for_each_entry(c, &clk_hw_omap_clocks, node)
540 if (c->ops && c->ops->deny_idle)
541 c->ops->deny_idle(c);
542 return 0;
543}
414 544
415 regval32 = __raw_readl(clk->enable_reg); 545/**
416 if ((regval32 & (1 << clk->enable_bit)) == v) 546 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
417 return; 547 * @clk_names: ptr to an array of strings of clock names to enable
548 * @num_clocks: number of clock names in @clk_names
549 *
550 * Prepare and enable a list of clocks, named by @clk_names. No
551 * return value. XXX Deprecated; only needed until these clocks are
552 * properly claimed and enabled by the drivers or core code that uses
553 * them. XXX What code disables & calls clk_put on these clocks?
554 */
555void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
556{
557 struct clk *init_clk;
558 int i;
418 559
419 pr_debug("Disabling unused clock \"%s\"\n", clk->name); 560 for (i = 0; i < num_clocks; i++) {
420 if (cpu_is_omap34xx()) { 561 init_clk = clk_get(NULL, clk_names[i]);
421 omap2_clk_enable(clk); 562 clk_prepare_enable(init_clk);
422 omap2_clk_disable(clk);
423 } else {
424 clk->ops->disable(clk);
425 } 563 }
426 if (clk->clkdm != NULL)
427 pwrdm_state_switch(clk->clkdm->pwrdm.ptr);
428} 564}
429#endif 565
566const struct clk_hw_omap_ops clkhwops_wait = {
567 .find_idlest = omap2_clk_dflt_find_idlest,
568 .find_companion = omap2_clk_dflt_find_companion,
569};
430 570
431/** 571/**
432 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument 572 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
@@ -458,14 +598,12 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
458 r = clk_set_rate(mpurate_ck, mpurate); 598 r = clk_set_rate(mpurate_ck, mpurate);
459 if (IS_ERR_VALUE(r)) { 599 if (IS_ERR_VALUE(r)) {
460 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", 600 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
461 mpurate_ck->name, mpurate, r); 601 mpurate_ck_name, mpurate, r);
462 clk_put(mpurate_ck); 602 clk_put(mpurate_ck);
463 return -EINVAL; 603 return -EINVAL;
464 } 604 }
465 605
466 calibrate_delay(); 606 calibrate_delay();
467 recalculate_root_clocks();
468
469 clk_put(mpurate_ck); 607 clk_put(mpurate_ck);
470 608
471 return 0; 609 return 0;
@@ -509,15 +647,3 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
509 (clk_get_rate(core_ck) / 1000000), 647 (clk_get_rate(core_ck) / 1000000),
510 (clk_get_rate(mpu_ck) / 1000000)); 648 (clk_get_rate(mpu_ck) / 1000000));
511} 649}
512
513/* Common data */
514
515struct clk_functions omap2_clk_functions = {
516 .clk_enable = omap2_clk_enable,
517 .clk_disable = omap2_clk_disable,
518 .clk_round_rate = omap2_clk_round_rate,
519 .clk_set_rate = omap2_clk_set_rate,
520 .clk_set_parent = omap2_clk_set_parent,
521 .clk_disable_unused = omap2_clk_disable_unused,
522};
523
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 35ec5f3d9a73..9917f793c3b6 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -17,8 +17,311 @@
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>
20 21
21#include <plat/clock.h> 22#include <linux/clkdev.h>
23#include <linux/clk-provider.h>
24
25struct omap_clk {
26 u16 cpu;
27 struct clk_lookup lk;
28};
29
30#define CLK(dev, con, ck, cp) \
31 { \
32 .cpu = cp, \
33 .lk = { \
34 .dev_id = dev, \
35 .con_id = con, \
36 .clk = ck, \
37 }, \
38 }
39
40/* Platform flags for the clkdev-OMAP integration code */
41#define CK_242X (1 << 0)
42#define CK_243X (1 << 1) /* 243x, 253x */
43#define CK_3430ES1 (1 << 2) /* 34xxES1 only */
44#define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
45#define CK_AM35XX (1 << 4) /* Sitara AM35xx */
46#define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
47#define CK_443X (1 << 6)
48#define CK_TI816X (1 << 7)
49#define CK_446X (1 << 8)
50#define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
51
52
53#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
54#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
55
56struct clockdomain;
57#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
58
59#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
60 static struct clk _name = { \
61 .name = #_name, \
62 .hw = &_name##_hw.hw, \
63 .parent_names = _parent_array_name, \
64 .num_parents = ARRAY_SIZE(_parent_array_name), \
65 .ops = &_clkops_name, \
66 };
67
68#define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \
69 static struct clk_hw_omap _name##_hw = { \
70 .hw = { \
71 .clk = &_name, \
72 }, \
73 .clkdm_name = _clkdm_name, \
74 };
75
76#define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \
77 _clksel_reg, _clksel_mask, \
78 _parent_names, _ops) \
79 static struct clk _name; \
80 static struct clk_hw_omap _name##_hw = { \
81 .hw = { \
82 .clk = &_name, \
83 }, \
84 .clksel = _clksel, \
85 .clksel_reg = _clksel_reg, \
86 .clksel_mask = _clksel_mask, \
87 .clkdm_name = _clkdm_name, \
88 }; \
89 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
90
91#define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \
92 _clksel_reg, _clksel_mask, \
93 _enable_reg, _enable_bit, \
94 _hwops, _parent_names, _ops) \
95 static struct clk _name; \
96 static struct clk_hw_omap _name##_hw = { \
97 .hw = { \
98 .clk = &_name, \
99 }, \
100 .ops = _hwops, \
101 .enable_reg = _enable_reg, \
102 .enable_bit = _enable_bit, \
103 .clksel = _clksel, \
104 .clksel_reg = _clksel_reg, \
105 .clksel_mask = _clksel_mask, \
106 .clkdm_name = _clkdm_name, \
107 }; \
108 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
109
110#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
111 _parent_ptr, _flags, \
112 _clksel_reg, _clksel_mask) \
113 static const struct clksel _name##_div[] = { \
114 { \
115 .parent = _parent_ptr, \
116 .rates = div31_1to31_rates \
117 }, \
118 { .parent = NULL }, \
119 }; \
120 static struct clk _name; \
121 static const char *_name##_parent_names[] = { \
122 _parent_name, \
123 }; \
124 static struct clk_hw_omap _name##_hw = { \
125 .hw = { \
126 .clk = &_name, \
127 }, \
128 .clksel = _name##_div, \
129 .clksel_reg = _clksel_reg, \
130 .clksel_mask = _clksel_mask, \
131 .ops = &clkhwops_omap4_dpllmx, \
132 }; \
133 DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
134
135/* struct clksel_rate.flags possibilities */
136#define RATE_IN_242X (1 << 0)
137#define RATE_IN_243X (1 << 1)
138#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
139#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
140#define RATE_IN_36XX (1 << 4)
141#define RATE_IN_4430 (1 << 5)
142#define RATE_IN_TI816X (1 << 6)
143#define RATE_IN_4460 (1 << 7)
144#define RATE_IN_AM33XX (1 << 8)
145#define RATE_IN_TI814X (1 << 9)
146
147#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
148#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
149#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
150#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
151
152/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
153#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
154
155
156/**
157 * struct clksel_rate - register bitfield values corresponding to clk divisors
158 * @val: register bitfield value (shifted to bit 0)
159 * @div: clock divisor corresponding to @val
160 * @flags: (see "struct clksel_rate.flags possibilities" above)
161 *
162 * @val should match the value of a read from struct clk.clksel_reg
163 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
164 *
165 * @div is the divisor that should be applied to the parent clock's rate
166 * to produce the current clock's rate.
167 */
168struct clksel_rate {
169 u32 val;
170 u8 div;
171 u16 flags;
172};
173
174/**
175 * struct clksel - available parent clocks, and a pointer to their divisors
176 * @parent: struct clk * to a possible parent clock
177 * @rates: available divisors for this parent clock
178 *
179 * A struct clksel is always associated with one or more struct clks
180 * and one or more struct clksel_rates.
181 */
182struct clksel {
183 struct clk *parent;
184 const struct clksel_rate *rates;
185};
186
187/**
188 * struct dpll_data - DPLL registers and integration data
189 * @mult_div1_reg: register containing the DPLL M and N bitfields
190 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
191 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
192 * @clk_bypass: struct clk pointer to the clock's bypass clock input
193 * @clk_ref: struct clk pointer to the clock's reference clock input
194 * @control_reg: register containing the DPLL mode bitfield
195 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
196 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
197 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
198 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
199 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
200 * @min_divider: minimum valid non-bypass divider value (actual)
201 * @max_divider: maximum valid non-bypass divider value (actual)
202 * @modes: possible values of @enable_mask
203 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
204 * @idlest_reg: register containing the DPLL idle status bitfield
205 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
206 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
207 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
208 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
209 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
210 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
211 * @flags: DPLL type/features (see below)
212 *
213 * Possible values for @flags:
214 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
215 *
216 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
217 *
218 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
219 * correct to only have one @clk_bypass pointer.
220 *
221 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
222 * @last_rounded_n) should be separated from the runtime-fixed fields
223 * and placed into a different structure, so that the runtime-fixed data
224 * can be placed into read-only space.
225 */
226struct dpll_data {
227 void __iomem *mult_div1_reg;
228 u32 mult_mask;
229 u32 div1_mask;
230 struct clk *clk_bypass;
231 struct clk *clk_ref;
232 void __iomem *control_reg;
233 u32 enable_mask;
234 unsigned long last_rounded_rate;
235 u16 last_rounded_m;
236 u16 max_multiplier;
237 u8 last_rounded_n;
238 u8 min_divider;
239 u16 max_divider;
240 u8 modes;
241 void __iomem *autoidle_reg;
242 void __iomem *idlest_reg;
243 u32 autoidle_mask;
244 u32 freqsel_mask;
245 u32 idlest_mask;
246 u32 dco_mask;
247 u32 sddiv_mask;
248 u8 auto_recal_bit;
249 u8 recal_en_bit;
250 u8 recal_st_bit;
251 u8 flags;
252};
253
254/*
255 * struct clk.flags possibilities
256 *
257 * XXX document the rest of the clock flags here
258 *
259 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
260 * bits share the same register. This flag allows the
261 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
262 * should be used. This is a temporary solution - a better approach
263 * would be to associate clock type-specific data with the clock,
264 * similar to the struct dpll_data approach.
265 */
266#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
267#define CLOCK_IDLE_CONTROL (1 << 1)
268#define CLOCK_NO_IDLE_PARENT (1 << 2)
269#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
270#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
271#define CLOCK_CLKOUTX2 (1 << 5)
272
273/**
274 * struct clk_hw_omap - OMAP struct clk
275 * @node: list_head connecting this clock into the full clock list
276 * @enable_reg: register to write to enable the clock (see @enable_bit)
277 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
278 * @flags: see "struct clk.flags possibilities" above
279 * @clksel_reg: for clksel clks, register va containing src/divisor select
280 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
281 * @clksel: for clksel clks, pointer to struct clksel for this clock
282 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
283 * @clkdm_name: clockdomain name that this clock is contained in
284 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
285 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
286 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
287 *
288 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
289 * clock code converted to use clksel.
290 *
291 */
292
293struct clk_hw_omap_ops;
294
295struct clk_hw_omap {
296 struct clk_hw hw;
297 struct list_head node;
298 unsigned long fixed_rate;
299 u8 fixed_div;
300 void __iomem *enable_reg;
301 u8 enable_bit;
302 u8 flags;
303 void __iomem *clksel_reg;
304 u32 clksel_mask;
305 const struct clksel *clksel;
306 struct dpll_data *dpll_data;
307 const char *clkdm_name;
308 struct clockdomain *clkdm;
309 const struct clk_hw_omap_ops *ops;
310};
311
312struct clk_hw_omap_ops {
313 void (*find_idlest)(struct clk_hw_omap *oclk,
314 void __iomem **idlest_reg,
315 u8 *idlest_bit, u8 *idlest_val);
316 void (*find_companion)(struct clk_hw_omap *oclk,
317 void __iomem **other_reg,
318 u8 *other_bit);
319 void (*allow_idle)(struct clk_hw_omap *oclk);
320 void (*deny_idle)(struct clk_hw_omap *oclk);
321};
322
323unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
324 unsigned long parent_rate);
22 325
23/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 326/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
24#define CORE_CLK_SRC_32K 0x0 327#define CORE_CLK_SRC_32K 0x0
@@ -49,84 +352,62 @@
49/* DPLL Type and DCO Selection Flags */ 352/* DPLL Type and DCO Selection Flags */
50#define DPLL_J_TYPE 0x1 353#define DPLL_J_TYPE 0x1
51 354
52int omap2_clk_enable(struct clk *clk); 355long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
53void omap2_clk_disable(struct clk *clk); 356 unsigned long *parent_rate);
54long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 357unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
55int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 358int omap3_noncore_dpll_enable(struct clk_hw *hw);
56int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 359void omap3_noncore_dpll_disable(struct clk_hw *hw);
57long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); 360int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
58unsigned long omap3_dpll_recalc(struct clk *clk); 361 unsigned long parent_rate);
59unsigned long omap3_clkoutx2_recalc(struct clk *clk); 362u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk);
60void omap3_dpll_allow_idle(struct clk *clk); 363void omap3_dpll_allow_idle(struct clk_hw_omap *clk);
61void omap3_dpll_deny_idle(struct clk *clk); 364void omap3_dpll_deny_idle(struct clk_hw_omap *clk);
62u32 omap3_dpll_autoidle_read(struct clk *clk); 365unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
63int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); 366 unsigned long parent_rate);
64int omap3_noncore_dpll_enable(struct clk *clk); 367int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk);
65void omap3_noncore_dpll_disable(struct clk *clk); 368void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk);
66int omap4_dpllmx_gatectrl_read(struct clk *clk); 369void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk);
67void omap4_dpllmx_allow_gatectrl(struct clk *clk); 370unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
68void omap4_dpllmx_deny_gatectrl(struct clk *clk); 371 unsigned long parent_rate);
69long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate); 372long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
70unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk); 373 unsigned long target_rate,
71 374 unsigned long *parent_rate);
72#ifdef CONFIG_OMAP_RESET_CLOCKS
73void omap2_clk_disable_unused(struct clk *clk);
74#else
75#define omap2_clk_disable_unused NULL
76#endif
77 375
78void omap2_init_clk_clkdm(struct clk *clk); 376void omap2_init_clk_clkdm(struct clk_hw *clk);
79void __init omap2_clk_disable_clkdm_control(void); 377void __init omap2_clk_disable_clkdm_control(void);
80 378
81/* clkt_clksel.c public functions */ 379/* clkt_clksel.c public functions */
82u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 380u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
381 unsigned long target_rate,
83 u32 *new_div); 382 u32 *new_div);
84void omap2_init_clksel_parent(struct clk *clk); 383u8 omap2_clksel_find_parent_index(struct clk_hw *hw);
85unsigned long omap2_clksel_recalc(struct clk *clk); 384unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate);
86long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); 385long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
87int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 386 unsigned long *parent_rate);
88int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); 387int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
388 unsigned long parent_rate);
389int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val);
89 390
90/* clkt_iclk.c public functions */ 391/* clkt_iclk.c public functions */
91extern void omap2_clkt_iclk_allow_idle(struct clk *clk); 392extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
92extern void omap2_clkt_iclk_deny_idle(struct clk *clk); 393extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
93
94u32 omap2_get_dpll_rate(struct clk *clk);
95void omap2_init_dpll_parent(struct clk *clk);
96 394
97int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 395u8 omap2_init_dpll_parent(struct clk_hw *hw);
98 396unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk);
99
100#ifdef CONFIG_ARCH_OMAP2
101void omap2xxx_clk_prepare_for_reboot(void);
102#else
103static inline void omap2xxx_clk_prepare_for_reboot(void)
104{
105}
106#endif
107 397
108#ifdef CONFIG_ARCH_OMAP3 398int omap2_dflt_clk_enable(struct clk_hw *hw);
109void omap3_clk_prepare_for_reboot(void); 399void omap2_dflt_clk_disable(struct clk_hw *hw);
110#else 400int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
111static inline void omap3_clk_prepare_for_reboot(void) 401void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
112{ 402 void __iomem **other_reg,
113}
114#endif
115
116#ifdef CONFIG_ARCH_OMAP4
117void omap4_clk_prepare_for_reboot(void);
118#else
119static inline void omap4_clk_prepare_for_reboot(void)
120{
121}
122#endif
123
124int omap2_dflt_clk_enable(struct clk *clk);
125void omap2_dflt_clk_disable(struct clk *clk);
126void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
127 u8 *other_bit); 403 u8 *other_bit);
128void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 404void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
405 void __iomem **idlest_reg,
129 u8 *idlest_bit, u8 *idlest_val); 406 u8 *idlest_bit, u8 *idlest_val);
407void omap2_init_clk_hw_omap_clocks(struct clk *clk);
408int omap2_clk_enable_autoidle_all(void);
409int omap2_clk_disable_autoidle_all(void);
410void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
130int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 411int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
131void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 412void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
132 const char *core_ck_name, 413 const char *core_ck_name,
@@ -139,34 +420,43 @@ extern const struct clkops clkops_dummy;
139extern const struct clkops clkops_omap2_dflt; 420extern const struct clkops clkops_omap2_dflt;
140 421
141extern struct clk_functions omap2_clk_functions; 422extern struct clk_functions omap2_clk_functions;
142extern struct clk *vclk, *sclk;
143 423
144extern const struct clksel_rate gpt_32k_rates[]; 424extern const struct clksel_rate gpt_32k_rates[];
145extern const struct clksel_rate gpt_sys_rates[]; 425extern const struct clksel_rate gpt_sys_rates[];
146extern const struct clksel_rate gfx_l3_rates[]; 426extern const struct clksel_rate gfx_l3_rates[];
147extern const struct clksel_rate dsp_ick_rates[]; 427extern const struct clksel_rate dsp_ick_rates[];
428extern struct clk dummy_ck;
148 429
149extern const struct clkops clkops_omap2_iclk_dflt_wait; 430extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
150extern const struct clkops clkops_omap2_iclk_dflt; 431extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
151extern const struct clkops clkops_omap2_iclk_idle_only; 432extern const struct clk_hw_omap_ops clkhwops_wait;
152extern const struct clkops clkops_omap2_mdmclk_dflt_wait; 433extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
153extern const struct clkops clkops_omap2xxx_dpll_ops; 434extern const struct clk_hw_omap_ops clkhwops_iclk;
154extern const struct clkops clkops_omap3_noncore_dpll_ops; 435extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
155extern const struct clkops clkops_omap3_core_dpll_ops; 436extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
156extern const struct clkops clkops_omap4_dpllmx_ops; 437extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
438extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
439extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
440extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
441extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
442extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
443extern const struct clk_hw_omap_ops clkhwops_apll54;
444extern const struct clk_hw_omap_ops clkhwops_apll96;
445extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
446extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
157 447
158/* clksel_rate blocks shared between OMAP44xx and AM33xx */ 448/* clksel_rate blocks shared between OMAP44xx and AM33xx */
159extern const struct clksel_rate div_1_0_rates[]; 449extern const struct clksel_rate div_1_0_rates[];
450extern const struct clksel_rate div3_1to4_rates[];
160extern const struct clksel_rate div_1_1_rates[]; 451extern const struct clksel_rate div_1_1_rates[];
161extern const struct clksel_rate div_1_2_rates[]; 452extern const struct clksel_rate div_1_2_rates[];
162extern const struct clksel_rate div_1_3_rates[]; 453extern const struct clksel_rate div_1_3_rates[];
163extern const struct clksel_rate div_1_4_rates[]; 454extern const struct clksel_rate div_1_4_rates[];
164extern const struct clksel_rate div31_1to31_rates[]; 455extern const struct clksel_rate div31_1to31_rates[];
165 456
166/* clocks shared between various OMAP SoCs */
167extern struct clk virt_19200000_ck;
168extern struct clk virt_26000000_ck;
169
170extern int am33xx_clk_init(void); 457extern int am33xx_clk_init(void);
171 458
459extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
460extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
461
172#endif 462#endif
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
deleted file mode 100644
index c3cde1a2b6de..000000000000
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ /dev/null
@@ -1,1990 +0,0 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/clk.h>
19#include <linux/list.h>
20
21#include <plat/clkdev_omap.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm2xxx_3xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54/* Base external input clocks */
55static struct clk func_32k_ck = {
56 .name = "func_32k_ck",
57 .ops = &clkops_null,
58 .rate = 32768,
59 .clkdm_name = "wkup_clkdm",
60};
61
62static struct clk secure_32k_ck = {
63 .name = "secure_32k_ck",
64 .ops = &clkops_null,
65 .rate = 32768,
66 .clkdm_name = "wkup_clkdm",
67};
68
69/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
70static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
71 .name = "osc_ck",
72 .ops = &clkops_oscck,
73 .clkdm_name = "wkup_clkdm",
74 .recalc = &omap2_osc_clk_recalc,
75};
76
77/* Without modem likely 12MHz, with modem likely 13MHz */
78static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
79 .name = "sys_ck", /* ~ ref_clk also */
80 .ops = &clkops_null,
81 .parent = &osc_ck,
82 .clkdm_name = "wkup_clkdm",
83 .recalc = &omap2xxx_sys_clk_recalc,
84};
85
86static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
87 .name = "alt_ck",
88 .ops = &clkops_null,
89 .rate = 54000000,
90 .clkdm_name = "wkup_clkdm",
91};
92
93/* Optional external clock input for McBSP CLKS */
94static struct clk mcbsp_clks = {
95 .name = "mcbsp_clks",
96 .ops = &clkops_null,
97};
98
99/*
100 * Analog domain root source clocks
101 */
102
103/* dpll_ck, is broken out in to special cases through clksel */
104/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
105 * deal with this
106 */
107
108static struct dpll_data dpll_dd = {
109 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
110 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
111 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
112 .clk_bypass = &sys_ck,
113 .clk_ref = &sys_ck,
114 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
115 .enable_mask = OMAP24XX_EN_DPLL_MASK,
116 .max_multiplier = 1023,
117 .min_divider = 1,
118 .max_divider = 16,
119};
120
121/*
122 * XXX Cannot add round_rate here yet, as this is still a composite clock,
123 * not just a DPLL
124 */
125static struct clk dpll_ck = {
126 .name = "dpll_ck",
127 .ops = &clkops_omap2xxx_dpll_ops,
128 .parent = &sys_ck, /* Can be func_32k also */
129 .dpll_data = &dpll_dd,
130 .clkdm_name = "wkup_clkdm",
131 .recalc = &omap2_dpllcore_recalc,
132 .set_rate = &omap2_reprogram_dpllcore,
133};
134
135static struct clk apll96_ck = {
136 .name = "apll96_ck",
137 .ops = &clkops_apll96,
138 .parent = &sys_ck,
139 .rate = 96000000,
140 .flags = ENABLE_ON_INIT,
141 .clkdm_name = "wkup_clkdm",
142 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
143 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
144};
145
146static struct clk apll54_ck = {
147 .name = "apll54_ck",
148 .ops = &clkops_apll54,
149 .parent = &sys_ck,
150 .rate = 54000000,
151 .flags = ENABLE_ON_INIT,
152 .clkdm_name = "wkup_clkdm",
153 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
154 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
155};
156
157/*
158 * PRCM digital base sources
159 */
160
161/* func_54m_ck */
162
163static const struct clksel_rate func_54m_apll54_rates[] = {
164 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
165 { .div = 0 },
166};
167
168static const struct clksel_rate func_54m_alt_rates[] = {
169 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
170 { .div = 0 },
171};
172
173static const struct clksel func_54m_clksel[] = {
174 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
175 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
176 { .parent = NULL },
177};
178
179static struct clk func_54m_ck = {
180 .name = "func_54m_ck",
181 .ops = &clkops_null,
182 .parent = &apll54_ck, /* can also be alt_clk */
183 .clkdm_name = "wkup_clkdm",
184 .init = &omap2_init_clksel_parent,
185 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
186 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
187 .clksel = func_54m_clksel,
188 .recalc = &omap2_clksel_recalc,
189};
190
191static struct clk core_ck = {
192 .name = "core_ck",
193 .ops = &clkops_null,
194 .parent = &dpll_ck, /* can also be 32k */
195 .clkdm_name = "wkup_clkdm",
196 .recalc = &followparent_recalc,
197};
198
199static struct clk func_96m_ck = {
200 .name = "func_96m_ck",
201 .ops = &clkops_null,
202 .parent = &apll96_ck,
203 .clkdm_name = "wkup_clkdm",
204 .recalc = &followparent_recalc,
205};
206
207/* func_48m_ck */
208
209static const struct clksel_rate func_48m_apll96_rates[] = {
210 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
211 { .div = 0 },
212};
213
214static const struct clksel_rate func_48m_alt_rates[] = {
215 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
216 { .div = 0 },
217};
218
219static const struct clksel func_48m_clksel[] = {
220 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
221 { .parent = &alt_ck, .rates = func_48m_alt_rates },
222 { .parent = NULL }
223};
224
225static struct clk func_48m_ck = {
226 .name = "func_48m_ck",
227 .ops = &clkops_null,
228 .parent = &apll96_ck, /* 96M or Alt */
229 .clkdm_name = "wkup_clkdm",
230 .init = &omap2_init_clksel_parent,
231 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
232 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
233 .clksel = func_48m_clksel,
234 .recalc = &omap2_clksel_recalc,
235 .round_rate = &omap2_clksel_round_rate,
236 .set_rate = &omap2_clksel_set_rate
237};
238
239static struct clk func_12m_ck = {
240 .name = "func_12m_ck",
241 .ops = &clkops_null,
242 .parent = &func_48m_ck,
243 .fixed_div = 4,
244 .clkdm_name = "wkup_clkdm",
245 .recalc = &omap_fixed_divisor_recalc,
246};
247
248/* Secure timer, only available in secure mode */
249static struct clk wdt1_osc_ck = {
250 .name = "ck_wdt1_osc",
251 .ops = &clkops_null, /* RMK: missing? */
252 .parent = &osc_ck,
253 .recalc = &followparent_recalc,
254};
255
256/*
257 * The common_clkout* clksel_rate structs are common to
258 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
259 * sys_clkout2_* are 2420-only, so the
260 * clksel_rate flags fields are inaccurate for those clocks. This is
261 * harmless since access to those clocks are gated by the struct clk
262 * flags fields, which mark them as 2420-only.
263 */
264static const struct clksel_rate common_clkout_src_core_rates[] = {
265 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
266 { .div = 0 }
267};
268
269static const struct clksel_rate common_clkout_src_sys_rates[] = {
270 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
271 { .div = 0 }
272};
273
274static const struct clksel_rate common_clkout_src_96m_rates[] = {
275 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
276 { .div = 0 }
277};
278
279static const struct clksel_rate common_clkout_src_54m_rates[] = {
280 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
281 { .div = 0 }
282};
283
284static const struct clksel common_clkout_src_clksel[] = {
285 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
286 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
287 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
288 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
289 { .parent = NULL }
290};
291
292static struct clk sys_clkout_src = {
293 .name = "sys_clkout_src",
294 .ops = &clkops_omap2_dflt,
295 .parent = &func_54m_ck,
296 .clkdm_name = "wkup_clkdm",
297 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
298 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
299 .init = &omap2_init_clksel_parent,
300 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
301 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
302 .clksel = common_clkout_src_clksel,
303 .recalc = &omap2_clksel_recalc,
304 .round_rate = &omap2_clksel_round_rate,
305 .set_rate = &omap2_clksel_set_rate
306};
307
308static const struct clksel_rate common_clkout_rates[] = {
309 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
310 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
311 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
312 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
313 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
314 { .div = 0 },
315};
316
317static const struct clksel sys_clkout_clksel[] = {
318 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
319 { .parent = NULL }
320};
321
322static struct clk sys_clkout = {
323 .name = "sys_clkout",
324 .ops = &clkops_null,
325 .parent = &sys_clkout_src,
326 .clkdm_name = "wkup_clkdm",
327 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
328 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
329 .clksel = sys_clkout_clksel,
330 .recalc = &omap2_clksel_recalc,
331 .round_rate = &omap2_clksel_round_rate,
332 .set_rate = &omap2_clksel_set_rate
333};
334
335/* In 2430, new in 2420 ES2 */
336static struct clk sys_clkout2_src = {
337 .name = "sys_clkout2_src",
338 .ops = &clkops_omap2_dflt,
339 .parent = &func_54m_ck,
340 .clkdm_name = "wkup_clkdm",
341 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
342 .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT,
343 .init = &omap2_init_clksel_parent,
344 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
345 .clksel_mask = OMAP2420_CLKOUT2_SOURCE_MASK,
346 .clksel = common_clkout_src_clksel,
347 .recalc = &omap2_clksel_recalc,
348 .round_rate = &omap2_clksel_round_rate,
349 .set_rate = &omap2_clksel_set_rate
350};
351
352static const struct clksel sys_clkout2_clksel[] = {
353 { .parent = &sys_clkout2_src, .rates = common_clkout_rates },
354 { .parent = NULL }
355};
356
357/* In 2430, new in 2420 ES2 */
358static struct clk sys_clkout2 = {
359 .name = "sys_clkout2",
360 .ops = &clkops_null,
361 .parent = &sys_clkout2_src,
362 .clkdm_name = "wkup_clkdm",
363 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
364 .clksel_mask = OMAP2420_CLKOUT2_DIV_MASK,
365 .clksel = sys_clkout2_clksel,
366 .recalc = &omap2_clksel_recalc,
367 .round_rate = &omap2_clksel_round_rate,
368 .set_rate = &omap2_clksel_set_rate
369};
370
371static struct clk emul_ck = {
372 .name = "emul_ck",
373 .ops = &clkops_omap2_dflt,
374 .parent = &func_54m_ck,
375 .clkdm_name = "wkup_clkdm",
376 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
377 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
378 .recalc = &followparent_recalc,
379
380};
381
382/*
383 * MPU clock domain
384 * Clocks:
385 * MPU_FCLK, MPU_ICLK
386 * INT_M_FCLK, INT_M_I_CLK
387 *
388 * - Individual clocks are hardware managed.
389 * - Base divider comes from: CM_CLKSEL_MPU
390 *
391 */
392static const struct clksel_rate mpu_core_rates[] = {
393 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
394 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
395 { .div = 4, .val = 4, .flags = RATE_IN_242X },
396 { .div = 6, .val = 6, .flags = RATE_IN_242X },
397 { .div = 8, .val = 8, .flags = RATE_IN_242X },
398 { .div = 0 },
399};
400
401static const struct clksel mpu_clksel[] = {
402 { .parent = &core_ck, .rates = mpu_core_rates },
403 { .parent = NULL }
404};
405
406static struct clk mpu_ck = { /* Control cpu */
407 .name = "mpu_ck",
408 .ops = &clkops_null,
409 .parent = &core_ck,
410 .clkdm_name = "mpu_clkdm",
411 .init = &omap2_init_clksel_parent,
412 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
413 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
414 .clksel = mpu_clksel,
415 .recalc = &omap2_clksel_recalc,
416};
417
418/*
419 * DSP (2420-UMA+IVA1) clock domain
420 * Clocks:
421 * 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
422 *
423 * Won't be too specific here. The core clock comes into this block
424 * it is divided then tee'ed. One branch goes directly to xyz enable
425 * controls. The other branch gets further divided by 2 then possibly
426 * routed into a synchronizer and out of clocks abc.
427 */
428static const struct clksel_rate dsp_fck_core_rates[] = {
429 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
430 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
431 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
432 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
433 { .div = 6, .val = 6, .flags = RATE_IN_242X },
434 { .div = 8, .val = 8, .flags = RATE_IN_242X },
435 { .div = 12, .val = 12, .flags = RATE_IN_242X },
436 { .div = 0 },
437};
438
439static const struct clksel dsp_fck_clksel[] = {
440 { .parent = &core_ck, .rates = dsp_fck_core_rates },
441 { .parent = NULL }
442};
443
444static struct clk dsp_fck = {
445 .name = "dsp_fck",
446 .ops = &clkops_omap2_dflt_wait,
447 .parent = &core_ck,
448 .clkdm_name = "dsp_clkdm",
449 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
450 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
451 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
452 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
453 .clksel = dsp_fck_clksel,
454 .recalc = &omap2_clksel_recalc,
455};
456
457static const struct clksel dsp_ick_clksel[] = {
458 { .parent = &dsp_fck, .rates = dsp_ick_rates },
459 { .parent = NULL }
460};
461
462static struct clk dsp_ick = {
463 .name = "dsp_ick", /* apparently ipi and isp */
464 .ops = &clkops_omap2_iclk_dflt_wait,
465 .parent = &dsp_fck,
466 .clkdm_name = "dsp_clkdm",
467 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
468 .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */
469 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
470 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
471 .clksel = dsp_ick_clksel,
472 .recalc = &omap2_clksel_recalc,
473};
474
475/*
476 * The IVA1 is an ARM7 core on the 2420 that has nothing to do with
477 * the C54x, but which is contained in the DSP powerdomain. Does not
478 * exist on later OMAPs.
479 */
480static struct clk iva1_ifck = {
481 .name = "iva1_ifck",
482 .ops = &clkops_omap2_dflt_wait,
483 .parent = &core_ck,
484 .clkdm_name = "iva1_clkdm",
485 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
486 .enable_bit = OMAP2420_EN_IVA_COP_SHIFT,
487 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
488 .clksel_mask = OMAP2420_CLKSEL_IVA_MASK,
489 .clksel = dsp_fck_clksel,
490 .recalc = &omap2_clksel_recalc,
491};
492
493/* IVA1 mpu/int/i/f clocks are /2 of parent */
494static struct clk iva1_mpu_int_ifck = {
495 .name = "iva1_mpu_int_ifck",
496 .ops = &clkops_omap2_dflt_wait,
497 .parent = &iva1_ifck,
498 .clkdm_name = "iva1_clkdm",
499 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
500 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
501 .fixed_div = 2,
502 .recalc = &omap_fixed_divisor_recalc,
503};
504
505/*
506 * L3 clock domain
507 * L3 clocks are used for both interface and functional clocks to
508 * multiple entities. Some of these clocks are completely managed
509 * by hardware, and some others allow software control. Hardware
510 * managed ones general are based on directly CLK_REQ signals and
511 * various auto idle settings. The functional spec sets many of these
512 * as 'tie-high' for their enables.
513 *
514 * I-CLOCKS:
515 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
516 * CAM, HS-USB.
517 * F-CLOCK
518 * SSI.
519 *
520 * GPMC memories and SDRC have timing and clock sensitive registers which
521 * may very well need notification when the clock changes. Currently for low
522 * operating points, these are taken care of in sleep.S.
523 */
524static const struct clksel_rate core_l3_core_rates[] = {
525 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
526 { .div = 2, .val = 2, .flags = RATE_IN_242X },
527 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
528 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
529 { .div = 8, .val = 8, .flags = RATE_IN_242X },
530 { .div = 12, .val = 12, .flags = RATE_IN_242X },
531 { .div = 16, .val = 16, .flags = RATE_IN_242X },
532 { .div = 0 }
533};
534
535static const struct clksel core_l3_clksel[] = {
536 { .parent = &core_ck, .rates = core_l3_core_rates },
537 { .parent = NULL }
538};
539
540static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
541 .name = "core_l3_ck",
542 .ops = &clkops_null,
543 .parent = &core_ck,
544 .clkdm_name = "core_l3_clkdm",
545 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
546 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
547 .clksel = core_l3_clksel,
548 .recalc = &omap2_clksel_recalc,
549};
550
551/* usb_l4_ick */
552static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
553 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
554 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
555 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
556 { .div = 0 }
557};
558
559static const struct clksel usb_l4_ick_clksel[] = {
560 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
561 { .parent = NULL },
562};
563
564/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
565static struct clk usb_l4_ick = { /* FS-USB interface clock */
566 .name = "usb_l4_ick",
567 .ops = &clkops_omap2_iclk_dflt_wait,
568 .parent = &core_l3_ck,
569 .clkdm_name = "core_l4_clkdm",
570 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
571 .enable_bit = OMAP24XX_EN_USB_SHIFT,
572 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
573 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
574 .clksel = usb_l4_ick_clksel,
575 .recalc = &omap2_clksel_recalc,
576};
577
578/*
579 * L4 clock management domain
580 *
581 * This domain contains lots of interface clocks from the L4 interface, some
582 * functional clocks. Fixed APLL functional source clocks are managed in
583 * this domain.
584 */
585static const struct clksel_rate l4_core_l3_rates[] = {
586 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
587 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
588 { .div = 0 }
589};
590
591static const struct clksel l4_clksel[] = {
592 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
593 { .parent = NULL }
594};
595
596static struct clk l4_ck = { /* used both as an ick and fck */
597 .name = "l4_ck",
598 .ops = &clkops_null,
599 .parent = &core_l3_ck,
600 .clkdm_name = "core_l4_clkdm",
601 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
602 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
603 .clksel = l4_clksel,
604 .recalc = &omap2_clksel_recalc,
605};
606
607/*
608 * SSI is in L3 management domain, its direct parent is core not l3,
609 * many core power domain entities are grouped into the L3 clock
610 * domain.
611 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
612 *
613 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
614 */
615static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
616 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
617 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
618 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
619 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
620 { .div = 6, .val = 6, .flags = RATE_IN_242X },
621 { .div = 8, .val = 8, .flags = RATE_IN_242X },
622 { .div = 0 }
623};
624
625static const struct clksel ssi_ssr_sst_fck_clksel[] = {
626 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
627 { .parent = NULL }
628};
629
630static struct clk ssi_ssr_sst_fck = {
631 .name = "ssi_fck",
632 .ops = &clkops_omap2_dflt_wait,
633 .parent = &core_ck,
634 .clkdm_name = "core_l3_clkdm",
635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
636 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
637 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
638 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
639 .clksel = ssi_ssr_sst_fck_clksel,
640 .recalc = &omap2_clksel_recalc,
641};
642
643/*
644 * Presumably this is the same as SSI_ICLK.
645 * TRM contradicts itself on what clockdomain SSI_ICLK is in
646 */
647static struct clk ssi_l4_ick = {
648 .name = "ssi_l4_ick",
649 .ops = &clkops_omap2_iclk_dflt_wait,
650 .parent = &l4_ck,
651 .clkdm_name = "core_l4_clkdm",
652 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
653 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
654 .recalc = &followparent_recalc,
655};
656
657
658/*
659 * GFX clock domain
660 * Clocks:
661 * GFX_FCLK, GFX_ICLK
662 * GFX_CG1(2d), GFX_CG2(3d)
663 *
664 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
665 * The 2d and 3d clocks run at a hardware determined
666 * divided value of fclk.
667 *
668 */
669
670/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
671static const struct clksel gfx_fck_clksel[] = {
672 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
673 { .parent = NULL },
674};
675
676static struct clk gfx_3d_fck = {
677 .name = "gfx_3d_fck",
678 .ops = &clkops_omap2_dflt_wait,
679 .parent = &core_l3_ck,
680 .clkdm_name = "gfx_clkdm",
681 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
682 .enable_bit = OMAP24XX_EN_3D_SHIFT,
683 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
684 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
685 .clksel = gfx_fck_clksel,
686 .recalc = &omap2_clksel_recalc,
687 .round_rate = &omap2_clksel_round_rate,
688 .set_rate = &omap2_clksel_set_rate
689};
690
691static struct clk gfx_2d_fck = {
692 .name = "gfx_2d_fck",
693 .ops = &clkops_omap2_dflt_wait,
694 .parent = &core_l3_ck,
695 .clkdm_name = "gfx_clkdm",
696 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
697 .enable_bit = OMAP24XX_EN_2D_SHIFT,
698 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
699 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
700 .clksel = gfx_fck_clksel,
701 .recalc = &omap2_clksel_recalc,
702};
703
704/* This interface clock does not have a CM_AUTOIDLE bit */
705static struct clk gfx_ick = {
706 .name = "gfx_ick", /* From l3 */
707 .ops = &clkops_omap2_dflt_wait,
708 .parent = &core_l3_ck,
709 .clkdm_name = "gfx_clkdm",
710 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
711 .enable_bit = OMAP_EN_GFX_SHIFT,
712 .recalc = &followparent_recalc,
713};
714
715/*
716 * DSS clock domain
717 * CLOCKs:
718 * DSS_L4_ICLK, DSS_L3_ICLK,
719 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
720 *
721 * DSS is both initiator and target.
722 */
723/* XXX Add RATE_NOT_VALIDATED */
724
725static const struct clksel_rate dss1_fck_sys_rates[] = {
726 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
727 { .div = 0 }
728};
729
730static const struct clksel_rate dss1_fck_core_rates[] = {
731 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
732 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
733 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
734 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
735 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
736 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
737 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
738 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
739 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
740 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
741 { .div = 0 }
742};
743
744static const struct clksel dss1_fck_clksel[] = {
745 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
746 { .parent = &core_ck, .rates = dss1_fck_core_rates },
747 { .parent = NULL },
748};
749
750static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
751 .name = "dss_ick",
752 .ops = &clkops_omap2_iclk_dflt,
753 .parent = &l4_ck, /* really both l3 and l4 */
754 .clkdm_name = "dss_clkdm",
755 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
756 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
757 .recalc = &followparent_recalc,
758};
759
760static struct clk dss1_fck = {
761 .name = "dss1_fck",
762 .ops = &clkops_omap2_dflt,
763 .parent = &core_ck, /* Core or sys */
764 .clkdm_name = "dss_clkdm",
765 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
766 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
767 .init = &omap2_init_clksel_parent,
768 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
769 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
770 .clksel = dss1_fck_clksel,
771 .recalc = &omap2_clksel_recalc,
772};
773
774static const struct clksel_rate dss2_fck_sys_rates[] = {
775 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
776 { .div = 0 }
777};
778
779static const struct clksel_rate dss2_fck_48m_rates[] = {
780 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
781 { .div = 0 }
782};
783
784static const struct clksel dss2_fck_clksel[] = {
785 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
786 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
787 { .parent = NULL }
788};
789
790static struct clk dss2_fck = { /* Alt clk used in power management */
791 .name = "dss2_fck",
792 .ops = &clkops_omap2_dflt,
793 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
794 .clkdm_name = "dss_clkdm",
795 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
796 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
797 .init = &omap2_init_clksel_parent,
798 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
799 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
800 .clksel = dss2_fck_clksel,
801 .recalc = &omap2_clksel_recalc,
802};
803
804static struct clk dss_54m_fck = { /* Alt clk used in power management */
805 .name = "dss_54m_fck", /* 54m tv clk */
806 .ops = &clkops_omap2_dflt_wait,
807 .parent = &func_54m_ck,
808 .clkdm_name = "dss_clkdm",
809 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
810 .enable_bit = OMAP24XX_EN_TV_SHIFT,
811 .recalc = &followparent_recalc,
812};
813
814static struct clk wu_l4_ick = {
815 .name = "wu_l4_ick",
816 .ops = &clkops_null,
817 .parent = &sys_ck,
818 .clkdm_name = "wkup_clkdm",
819 .recalc = &followparent_recalc,
820};
821
822/*
823 * CORE power domain ICLK & FCLK defines.
824 * Many of the these can have more than one possible parent. Entries
825 * here will likely have an L4 interface parent, and may have multiple
826 * functional clock parents.
827 */
828static const struct clksel_rate gpt_alt_rates[] = {
829 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
830 { .div = 0 }
831};
832
833static const struct clksel omap24xx_gpt_clksel[] = {
834 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
835 { .parent = &sys_ck, .rates = gpt_sys_rates },
836 { .parent = &alt_ck, .rates = gpt_alt_rates },
837 { .parent = NULL },
838};
839
840static struct clk gpt1_ick = {
841 .name = "gpt1_ick",
842 .ops = &clkops_omap2_iclk_dflt_wait,
843 .parent = &wu_l4_ick,
844 .clkdm_name = "wkup_clkdm",
845 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
846 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
847 .recalc = &followparent_recalc,
848};
849
850static struct clk gpt1_fck = {
851 .name = "gpt1_fck",
852 .ops = &clkops_omap2_dflt_wait,
853 .parent = &func_32k_ck,
854 .clkdm_name = "core_l4_clkdm",
855 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
856 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
857 .init = &omap2_init_clksel_parent,
858 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
859 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
860 .clksel = omap24xx_gpt_clksel,
861 .recalc = &omap2_clksel_recalc,
862 .round_rate = &omap2_clksel_round_rate,
863 .set_rate = &omap2_clksel_set_rate
864};
865
866static struct clk gpt2_ick = {
867 .name = "gpt2_ick",
868 .ops = &clkops_omap2_iclk_dflt_wait,
869 .parent = &l4_ck,
870 .clkdm_name = "core_l4_clkdm",
871 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
872 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
873 .recalc = &followparent_recalc,
874};
875
876static struct clk gpt2_fck = {
877 .name = "gpt2_fck",
878 .ops = &clkops_omap2_dflt_wait,
879 .parent = &func_32k_ck,
880 .clkdm_name = "core_l4_clkdm",
881 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
882 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
883 .init = &omap2_init_clksel_parent,
884 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
885 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
886 .clksel = omap24xx_gpt_clksel,
887 .recalc = &omap2_clksel_recalc,
888};
889
890static struct clk gpt3_ick = {
891 .name = "gpt3_ick",
892 .ops = &clkops_omap2_iclk_dflt_wait,
893 .parent = &l4_ck,
894 .clkdm_name = "core_l4_clkdm",
895 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
896 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
897 .recalc = &followparent_recalc,
898};
899
900static struct clk gpt3_fck = {
901 .name = "gpt3_fck",
902 .ops = &clkops_omap2_dflt_wait,
903 .parent = &func_32k_ck,
904 .clkdm_name = "core_l4_clkdm",
905 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
906 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
907 .init = &omap2_init_clksel_parent,
908 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
909 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
910 .clksel = omap24xx_gpt_clksel,
911 .recalc = &omap2_clksel_recalc,
912};
913
914static struct clk gpt4_ick = {
915 .name = "gpt4_ick",
916 .ops = &clkops_omap2_iclk_dflt_wait,
917 .parent = &l4_ck,
918 .clkdm_name = "core_l4_clkdm",
919 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
920 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
921 .recalc = &followparent_recalc,
922};
923
924static struct clk gpt4_fck = {
925 .name = "gpt4_fck",
926 .ops = &clkops_omap2_dflt_wait,
927 .parent = &func_32k_ck,
928 .clkdm_name = "core_l4_clkdm",
929 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
930 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
931 .init = &omap2_init_clksel_parent,
932 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
933 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
934 .clksel = omap24xx_gpt_clksel,
935 .recalc = &omap2_clksel_recalc,
936};
937
938static struct clk gpt5_ick = {
939 .name = "gpt5_ick",
940 .ops = &clkops_omap2_iclk_dflt_wait,
941 .parent = &l4_ck,
942 .clkdm_name = "core_l4_clkdm",
943 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
944 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
945 .recalc = &followparent_recalc,
946};
947
948static struct clk gpt5_fck = {
949 .name = "gpt5_fck",
950 .ops = &clkops_omap2_dflt_wait,
951 .parent = &func_32k_ck,
952 .clkdm_name = "core_l4_clkdm",
953 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
954 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
955 .init = &omap2_init_clksel_parent,
956 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
957 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
958 .clksel = omap24xx_gpt_clksel,
959 .recalc = &omap2_clksel_recalc,
960};
961
962static struct clk gpt6_ick = {
963 .name = "gpt6_ick",
964 .ops = &clkops_omap2_iclk_dflt_wait,
965 .parent = &l4_ck,
966 .clkdm_name = "core_l4_clkdm",
967 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
968 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
969 .recalc = &followparent_recalc,
970};
971
972static struct clk gpt6_fck = {
973 .name = "gpt6_fck",
974 .ops = &clkops_omap2_dflt_wait,
975 .parent = &func_32k_ck,
976 .clkdm_name = "core_l4_clkdm",
977 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
978 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
979 .init = &omap2_init_clksel_parent,
980 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
981 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
982 .clksel = omap24xx_gpt_clksel,
983 .recalc = &omap2_clksel_recalc,
984};
985
986static struct clk gpt7_ick = {
987 .name = "gpt7_ick",
988 .ops = &clkops_omap2_iclk_dflt_wait,
989 .parent = &l4_ck,
990 .clkdm_name = "core_l4_clkdm",
991 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
992 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
993 .recalc = &followparent_recalc,
994};
995
996static struct clk gpt7_fck = {
997 .name = "gpt7_fck",
998 .ops = &clkops_omap2_dflt_wait,
999 .parent = &func_32k_ck,
1000 .clkdm_name = "core_l4_clkdm",
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1002 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
1003 .init = &omap2_init_clksel_parent,
1004 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1005 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
1006 .clksel = omap24xx_gpt_clksel,
1007 .recalc = &omap2_clksel_recalc,
1008};
1009
1010static struct clk gpt8_ick = {
1011 .name = "gpt8_ick",
1012 .ops = &clkops_omap2_iclk_dflt_wait,
1013 .parent = &l4_ck,
1014 .clkdm_name = "core_l4_clkdm",
1015 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1016 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1017 .recalc = &followparent_recalc,
1018};
1019
1020static struct clk gpt8_fck = {
1021 .name = "gpt8_fck",
1022 .ops = &clkops_omap2_dflt_wait,
1023 .parent = &func_32k_ck,
1024 .clkdm_name = "core_l4_clkdm",
1025 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1026 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1027 .init = &omap2_init_clksel_parent,
1028 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1029 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1030 .clksel = omap24xx_gpt_clksel,
1031 .recalc = &omap2_clksel_recalc,
1032};
1033
1034static struct clk gpt9_ick = {
1035 .name = "gpt9_ick",
1036 .ops = &clkops_omap2_iclk_dflt_wait,
1037 .parent = &l4_ck,
1038 .clkdm_name = "core_l4_clkdm",
1039 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1040 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1041 .recalc = &followparent_recalc,
1042};
1043
1044static struct clk gpt9_fck = {
1045 .name = "gpt9_fck",
1046 .ops = &clkops_omap2_dflt_wait,
1047 .parent = &func_32k_ck,
1048 .clkdm_name = "core_l4_clkdm",
1049 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1050 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1051 .init = &omap2_init_clksel_parent,
1052 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1053 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1054 .clksel = omap24xx_gpt_clksel,
1055 .recalc = &omap2_clksel_recalc,
1056};
1057
1058static struct clk gpt10_ick = {
1059 .name = "gpt10_ick",
1060 .ops = &clkops_omap2_iclk_dflt_wait,
1061 .parent = &l4_ck,
1062 .clkdm_name = "core_l4_clkdm",
1063 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1064 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1065 .recalc = &followparent_recalc,
1066};
1067
1068static struct clk gpt10_fck = {
1069 .name = "gpt10_fck",
1070 .ops = &clkops_omap2_dflt_wait,
1071 .parent = &func_32k_ck,
1072 .clkdm_name = "core_l4_clkdm",
1073 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1074 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1075 .init = &omap2_init_clksel_parent,
1076 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1077 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1078 .clksel = omap24xx_gpt_clksel,
1079 .recalc = &omap2_clksel_recalc,
1080};
1081
1082static struct clk gpt11_ick = {
1083 .name = "gpt11_ick",
1084 .ops = &clkops_omap2_iclk_dflt_wait,
1085 .parent = &l4_ck,
1086 .clkdm_name = "core_l4_clkdm",
1087 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1088 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1089 .recalc = &followparent_recalc,
1090};
1091
1092static struct clk gpt11_fck = {
1093 .name = "gpt11_fck",
1094 .ops = &clkops_omap2_dflt_wait,
1095 .parent = &func_32k_ck,
1096 .clkdm_name = "core_l4_clkdm",
1097 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1098 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1099 .init = &omap2_init_clksel_parent,
1100 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1101 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1102 .clksel = omap24xx_gpt_clksel,
1103 .recalc = &omap2_clksel_recalc,
1104};
1105
1106static struct clk gpt12_ick = {
1107 .name = "gpt12_ick",
1108 .ops = &clkops_omap2_iclk_dflt_wait,
1109 .parent = &l4_ck,
1110 .clkdm_name = "core_l4_clkdm",
1111 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1112 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1113 .recalc = &followparent_recalc,
1114};
1115
1116static struct clk gpt12_fck = {
1117 .name = "gpt12_fck",
1118 .ops = &clkops_omap2_dflt_wait,
1119 .parent = &secure_32k_ck,
1120 .clkdm_name = "core_l4_clkdm",
1121 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1122 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1123 .init = &omap2_init_clksel_parent,
1124 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1125 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1126 .clksel = omap24xx_gpt_clksel,
1127 .recalc = &omap2_clksel_recalc,
1128};
1129
1130static struct clk mcbsp1_ick = {
1131 .name = "mcbsp1_ick",
1132 .ops = &clkops_omap2_iclk_dflt_wait,
1133 .parent = &l4_ck,
1134 .clkdm_name = "core_l4_clkdm",
1135 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1136 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1137 .recalc = &followparent_recalc,
1138};
1139
1140static const struct clksel_rate common_mcbsp_96m_rates[] = {
1141 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1142 { .div = 0 }
1143};
1144
1145static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1146 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1147 { .div = 0 }
1148};
1149
1150static const struct clksel mcbsp_fck_clksel[] = {
1151 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1152 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1153 { .parent = NULL }
1154};
1155
1156static struct clk mcbsp1_fck = {
1157 .name = "mcbsp1_fck",
1158 .ops = &clkops_omap2_dflt_wait,
1159 .parent = &func_96m_ck,
1160 .init = &omap2_init_clksel_parent,
1161 .clkdm_name = "core_l4_clkdm",
1162 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1163 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1164 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1165 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1166 .clksel = mcbsp_fck_clksel,
1167 .recalc = &omap2_clksel_recalc,
1168};
1169
1170static struct clk mcbsp2_ick = {
1171 .name = "mcbsp2_ick",
1172 .ops = &clkops_omap2_iclk_dflt_wait,
1173 .parent = &l4_ck,
1174 .clkdm_name = "core_l4_clkdm",
1175 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1176 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1177 .recalc = &followparent_recalc,
1178};
1179
1180static struct clk mcbsp2_fck = {
1181 .name = "mcbsp2_fck",
1182 .ops = &clkops_omap2_dflt_wait,
1183 .parent = &func_96m_ck,
1184 .init = &omap2_init_clksel_parent,
1185 .clkdm_name = "core_l4_clkdm",
1186 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1187 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1188 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1189 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1190 .clksel = mcbsp_fck_clksel,
1191 .recalc = &omap2_clksel_recalc,
1192};
1193
1194static struct clk mcspi1_ick = {
1195 .name = "mcspi1_ick",
1196 .ops = &clkops_omap2_iclk_dflt_wait,
1197 .parent = &l4_ck,
1198 .clkdm_name = "core_l4_clkdm",
1199 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1200 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1201 .recalc = &followparent_recalc,
1202};
1203
1204static struct clk mcspi1_fck = {
1205 .name = "mcspi1_fck",
1206 .ops = &clkops_omap2_dflt_wait,
1207 .parent = &func_48m_ck,
1208 .clkdm_name = "core_l4_clkdm",
1209 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1210 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1211 .recalc = &followparent_recalc,
1212};
1213
1214static struct clk mcspi2_ick = {
1215 .name = "mcspi2_ick",
1216 .ops = &clkops_omap2_iclk_dflt_wait,
1217 .parent = &l4_ck,
1218 .clkdm_name = "core_l4_clkdm",
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1220 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1221 .recalc = &followparent_recalc,
1222};
1223
1224static struct clk mcspi2_fck = {
1225 .name = "mcspi2_fck",
1226 .ops = &clkops_omap2_dflt_wait,
1227 .parent = &func_48m_ck,
1228 .clkdm_name = "core_l4_clkdm",
1229 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1230 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1231 .recalc = &followparent_recalc,
1232};
1233
1234static struct clk uart1_ick = {
1235 .name = "uart1_ick",
1236 .ops = &clkops_omap2_iclk_dflt_wait,
1237 .parent = &l4_ck,
1238 .clkdm_name = "core_l4_clkdm",
1239 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1240 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1241 .recalc = &followparent_recalc,
1242};
1243
1244static struct clk uart1_fck = {
1245 .name = "uart1_fck",
1246 .ops = &clkops_omap2_dflt_wait,
1247 .parent = &func_48m_ck,
1248 .clkdm_name = "core_l4_clkdm",
1249 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1250 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1251 .recalc = &followparent_recalc,
1252};
1253
1254static struct clk uart2_ick = {
1255 .name = "uart2_ick",
1256 .ops = &clkops_omap2_iclk_dflt_wait,
1257 .parent = &l4_ck,
1258 .clkdm_name = "core_l4_clkdm",
1259 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1260 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1261 .recalc = &followparent_recalc,
1262};
1263
1264static struct clk uart2_fck = {
1265 .name = "uart2_fck",
1266 .ops = &clkops_omap2_dflt_wait,
1267 .parent = &func_48m_ck,
1268 .clkdm_name = "core_l4_clkdm",
1269 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1270 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1271 .recalc = &followparent_recalc,
1272};
1273
1274static struct clk uart3_ick = {
1275 .name = "uart3_ick",
1276 .ops = &clkops_omap2_iclk_dflt_wait,
1277 .parent = &l4_ck,
1278 .clkdm_name = "core_l4_clkdm",
1279 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1280 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1281 .recalc = &followparent_recalc,
1282};
1283
1284static struct clk uart3_fck = {
1285 .name = "uart3_fck",
1286 .ops = &clkops_omap2_dflt_wait,
1287 .parent = &func_48m_ck,
1288 .clkdm_name = "core_l4_clkdm",
1289 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1290 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1291 .recalc = &followparent_recalc,
1292};
1293
1294static struct clk gpios_ick = {
1295 .name = "gpios_ick",
1296 .ops = &clkops_omap2_iclk_dflt_wait,
1297 .parent = &wu_l4_ick,
1298 .clkdm_name = "wkup_clkdm",
1299 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1300 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1301 .recalc = &followparent_recalc,
1302};
1303
1304static struct clk gpios_fck = {
1305 .name = "gpios_fck",
1306 .ops = &clkops_omap2_dflt_wait,
1307 .parent = &func_32k_ck,
1308 .clkdm_name = "wkup_clkdm",
1309 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1310 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1311 .recalc = &followparent_recalc,
1312};
1313
1314static struct clk mpu_wdt_ick = {
1315 .name = "mpu_wdt_ick",
1316 .ops = &clkops_omap2_iclk_dflt_wait,
1317 .parent = &wu_l4_ick,
1318 .clkdm_name = "wkup_clkdm",
1319 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1320 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1321 .recalc = &followparent_recalc,
1322};
1323
1324static struct clk mpu_wdt_fck = {
1325 .name = "mpu_wdt_fck",
1326 .ops = &clkops_omap2_dflt_wait,
1327 .parent = &func_32k_ck,
1328 .clkdm_name = "wkup_clkdm",
1329 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1330 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1331 .recalc = &followparent_recalc,
1332};
1333
1334static struct clk sync_32k_ick = {
1335 .name = "sync_32k_ick",
1336 .ops = &clkops_omap2_iclk_dflt_wait,
1337 .parent = &wu_l4_ick,
1338 .clkdm_name = "wkup_clkdm",
1339 .flags = ENABLE_ON_INIT,
1340 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1341 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1342 .recalc = &followparent_recalc,
1343};
1344
1345static struct clk wdt1_ick = {
1346 .name = "wdt1_ick",
1347 .ops = &clkops_omap2_iclk_dflt_wait,
1348 .parent = &wu_l4_ick,
1349 .clkdm_name = "wkup_clkdm",
1350 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1351 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1352 .recalc = &followparent_recalc,
1353};
1354
1355static struct clk omapctrl_ick = {
1356 .name = "omapctrl_ick",
1357 .ops = &clkops_omap2_iclk_dflt_wait,
1358 .parent = &wu_l4_ick,
1359 .clkdm_name = "wkup_clkdm",
1360 .flags = ENABLE_ON_INIT,
1361 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1362 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1363 .recalc = &followparent_recalc,
1364};
1365
1366static struct clk cam_ick = {
1367 .name = "cam_ick",
1368 .ops = &clkops_omap2_iclk_dflt,
1369 .parent = &l4_ck,
1370 .clkdm_name = "core_l4_clkdm",
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1372 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1373 .recalc = &followparent_recalc,
1374};
1375
1376/*
1377 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1378 * split into two separate clocks, since the parent clocks are different
1379 * and the clockdomains are also different.
1380 */
1381static struct clk cam_fck = {
1382 .name = "cam_fck",
1383 .ops = &clkops_omap2_dflt,
1384 .parent = &func_96m_ck,
1385 .clkdm_name = "core_l3_clkdm",
1386 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1387 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk mailboxes_ick = {
1392 .name = "mailboxes_ick",
1393 .ops = &clkops_omap2_iclk_dflt_wait,
1394 .parent = &l4_ck,
1395 .clkdm_name = "core_l4_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1397 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk wdt4_ick = {
1402 .name = "wdt4_ick",
1403 .ops = &clkops_omap2_iclk_dflt_wait,
1404 .parent = &l4_ck,
1405 .clkdm_name = "core_l4_clkdm",
1406 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1407 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1408 .recalc = &followparent_recalc,
1409};
1410
1411static struct clk wdt4_fck = {
1412 .name = "wdt4_fck",
1413 .ops = &clkops_omap2_dflt_wait,
1414 .parent = &func_32k_ck,
1415 .clkdm_name = "core_l4_clkdm",
1416 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1417 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1418 .recalc = &followparent_recalc,
1419};
1420
1421static struct clk wdt3_ick = {
1422 .name = "wdt3_ick",
1423 .ops = &clkops_omap2_iclk_dflt_wait,
1424 .parent = &l4_ck,
1425 .clkdm_name = "core_l4_clkdm",
1426 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1427 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1428 .recalc = &followparent_recalc,
1429};
1430
1431static struct clk wdt3_fck = {
1432 .name = "wdt3_fck",
1433 .ops = &clkops_omap2_dflt_wait,
1434 .parent = &func_32k_ck,
1435 .clkdm_name = "core_l4_clkdm",
1436 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1437 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1438 .recalc = &followparent_recalc,
1439};
1440
1441static struct clk mspro_ick = {
1442 .name = "mspro_ick",
1443 .ops = &clkops_omap2_iclk_dflt_wait,
1444 .parent = &l4_ck,
1445 .clkdm_name = "core_l4_clkdm",
1446 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1447 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1448 .recalc = &followparent_recalc,
1449};
1450
1451static struct clk mspro_fck = {
1452 .name = "mspro_fck",
1453 .ops = &clkops_omap2_dflt_wait,
1454 .parent = &func_96m_ck,
1455 .clkdm_name = "core_l4_clkdm",
1456 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1457 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1458 .recalc = &followparent_recalc,
1459};
1460
1461static struct clk mmc_ick = {
1462 .name = "mmc_ick",
1463 .ops = &clkops_omap2_iclk_dflt_wait,
1464 .parent = &l4_ck,
1465 .clkdm_name = "core_l4_clkdm",
1466 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1467 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1468 .recalc = &followparent_recalc,
1469};
1470
1471static struct clk mmc_fck = {
1472 .name = "mmc_fck",
1473 .ops = &clkops_omap2_dflt_wait,
1474 .parent = &func_96m_ck,
1475 .clkdm_name = "core_l4_clkdm",
1476 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1477 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1478 .recalc = &followparent_recalc,
1479};
1480
1481static struct clk fac_ick = {
1482 .name = "fac_ick",
1483 .ops = &clkops_omap2_iclk_dflt_wait,
1484 .parent = &l4_ck,
1485 .clkdm_name = "core_l4_clkdm",
1486 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1487 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1488 .recalc = &followparent_recalc,
1489};
1490
1491static struct clk fac_fck = {
1492 .name = "fac_fck",
1493 .ops = &clkops_omap2_dflt_wait,
1494 .parent = &func_12m_ck,
1495 .clkdm_name = "core_l4_clkdm",
1496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1498 .recalc = &followparent_recalc,
1499};
1500
1501static struct clk eac_ick = {
1502 .name = "eac_ick",
1503 .ops = &clkops_omap2_iclk_dflt_wait,
1504 .parent = &l4_ck,
1505 .clkdm_name = "core_l4_clkdm",
1506 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1507 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1508 .recalc = &followparent_recalc,
1509};
1510
1511static struct clk eac_fck = {
1512 .name = "eac_fck",
1513 .ops = &clkops_omap2_dflt_wait,
1514 .parent = &func_96m_ck,
1515 .clkdm_name = "core_l4_clkdm",
1516 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1517 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1518 .recalc = &followparent_recalc,
1519};
1520
1521static struct clk hdq_ick = {
1522 .name = "hdq_ick",
1523 .ops = &clkops_omap2_iclk_dflt_wait,
1524 .parent = &l4_ck,
1525 .clkdm_name = "core_l4_clkdm",
1526 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1527 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1528 .recalc = &followparent_recalc,
1529};
1530
1531static struct clk hdq_fck = {
1532 .name = "hdq_fck",
1533 .ops = &clkops_omap2_dflt_wait,
1534 .parent = &func_12m_ck,
1535 .clkdm_name = "core_l4_clkdm",
1536 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1537 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1538 .recalc = &followparent_recalc,
1539};
1540
1541static struct clk i2c2_ick = {
1542 .name = "i2c2_ick",
1543 .ops = &clkops_omap2_iclk_dflt_wait,
1544 .parent = &l4_ck,
1545 .clkdm_name = "core_l4_clkdm",
1546 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1547 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1548 .recalc = &followparent_recalc,
1549};
1550
1551static struct clk i2c2_fck = {
1552 .name = "i2c2_fck",
1553 .ops = &clkops_omap2_dflt_wait,
1554 .parent = &func_12m_ck,
1555 .clkdm_name = "core_l4_clkdm",
1556 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1557 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1558 .recalc = &followparent_recalc,
1559};
1560
1561static struct clk i2c1_ick = {
1562 .name = "i2c1_ick",
1563 .ops = &clkops_omap2_iclk_dflt_wait,
1564 .parent = &l4_ck,
1565 .clkdm_name = "core_l4_clkdm",
1566 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1567 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1568 .recalc = &followparent_recalc,
1569};
1570
1571static struct clk i2c1_fck = {
1572 .name = "i2c1_fck",
1573 .ops = &clkops_omap2_dflt_wait,
1574 .parent = &func_12m_ck,
1575 .clkdm_name = "core_l4_clkdm",
1576 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1577 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1578 .recalc = &followparent_recalc,
1579};
1580
1581/*
1582 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1583 * accesses derived from this data.
1584 */
1585static struct clk gpmc_fck = {
1586 .name = "gpmc_fck",
1587 .ops = &clkops_omap2_iclk_idle_only,
1588 .parent = &core_l3_ck,
1589 .flags = ENABLE_ON_INIT,
1590 .clkdm_name = "core_l3_clkdm",
1591 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1592 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1593 .recalc = &followparent_recalc,
1594};
1595
1596static struct clk sdma_fck = {
1597 .name = "sdma_fck",
1598 .ops = &clkops_null, /* RMK: missing? */
1599 .parent = &core_l3_ck,
1600 .clkdm_name = "core_l3_clkdm",
1601 .recalc = &followparent_recalc,
1602};
1603
1604/*
1605 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1606 * accesses derived from this data.
1607 */
1608static struct clk sdma_ick = {
1609 .name = "sdma_ick",
1610 .ops = &clkops_omap2_iclk_idle_only,
1611 .parent = &core_l3_ck,
1612 .clkdm_name = "core_l3_clkdm",
1613 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1614 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1615 .recalc = &followparent_recalc,
1616};
1617
1618/*
1619 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1620 * accesses derived from this data.
1621 */
1622static struct clk sdrc_ick = {
1623 .name = "sdrc_ick",
1624 .ops = &clkops_omap2_iclk_idle_only,
1625 .parent = &core_l3_ck,
1626 .flags = ENABLE_ON_INIT,
1627 .clkdm_name = "core_l3_clkdm",
1628 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1629 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1630 .recalc = &followparent_recalc,
1631};
1632
1633static struct clk vlynq_ick = {
1634 .name = "vlynq_ick",
1635 .ops = &clkops_omap2_iclk_dflt_wait,
1636 .parent = &core_l3_ck,
1637 .clkdm_name = "core_l3_clkdm",
1638 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1639 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1640 .recalc = &followparent_recalc,
1641};
1642
1643static const struct clksel_rate vlynq_fck_96m_rates[] = {
1644 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1645 { .div = 0 }
1646};
1647
1648static const struct clksel_rate vlynq_fck_core_rates[] = {
1649 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1650 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1651 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1652 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1653 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1654 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1655 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1656 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1657 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1658 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1659 { .div = 0 }
1660};
1661
1662static const struct clksel vlynq_fck_clksel[] = {
1663 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1664 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1665 { .parent = NULL }
1666};
1667
1668static struct clk vlynq_fck = {
1669 .name = "vlynq_fck",
1670 .ops = &clkops_omap2_dflt_wait,
1671 .parent = &func_96m_ck,
1672 .clkdm_name = "core_l3_clkdm",
1673 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1674 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1675 .init = &omap2_init_clksel_parent,
1676 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1677 .clksel_mask = OMAP2420_CLKSEL_VLYNQ_MASK,
1678 .clksel = vlynq_fck_clksel,
1679 .recalc = &omap2_clksel_recalc,
1680};
1681
1682static struct clk des_ick = {
1683 .name = "des_ick",
1684 .ops = &clkops_omap2_iclk_dflt_wait,
1685 .parent = &l4_ck,
1686 .clkdm_name = "core_l4_clkdm",
1687 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1688 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1689 .recalc = &followparent_recalc,
1690};
1691
1692static struct clk sha_ick = {
1693 .name = "sha_ick",
1694 .ops = &clkops_omap2_iclk_dflt_wait,
1695 .parent = &l4_ck,
1696 .clkdm_name = "core_l4_clkdm",
1697 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1698 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1699 .recalc = &followparent_recalc,
1700};
1701
1702static struct clk rng_ick = {
1703 .name = "rng_ick",
1704 .ops = &clkops_omap2_iclk_dflt_wait,
1705 .parent = &l4_ck,
1706 .clkdm_name = "core_l4_clkdm",
1707 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1708 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1709 .recalc = &followparent_recalc,
1710};
1711
1712static struct clk aes_ick = {
1713 .name = "aes_ick",
1714 .ops = &clkops_omap2_iclk_dflt_wait,
1715 .parent = &l4_ck,
1716 .clkdm_name = "core_l4_clkdm",
1717 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1718 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1719 .recalc = &followparent_recalc,
1720};
1721
1722static struct clk pka_ick = {
1723 .name = "pka_ick",
1724 .ops = &clkops_omap2_iclk_dflt_wait,
1725 .parent = &l4_ck,
1726 .clkdm_name = "core_l4_clkdm",
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1728 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1729 .recalc = &followparent_recalc,
1730};
1731
1732static struct clk usb_fck = {
1733 .name = "usb_fck",
1734 .ops = &clkops_omap2_dflt_wait,
1735 .parent = &func_48m_ck,
1736 .clkdm_name = "core_l3_clkdm",
1737 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1738 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1739 .recalc = &followparent_recalc,
1740};
1741
1742/*
1743 * This clock is a composite clock which does entire set changes then
1744 * forces a rebalance. It keys on the MPU speed, but it really could
1745 * be any key speed part of a set in the rate table.
1746 *
1747 * to really change a set, you need memory table sets which get changed
1748 * in sram, pre-notifiers & post notifiers, changing the top set, without
1749 * having low level display recalc's won't work... this is why dpm notifiers
1750 * work, isr's off, walk a list of clocks already _off_ and not messing with
1751 * the bus.
1752 *
1753 * This clock should have no parent. It embodies the entire upper level
1754 * active set. A parent will mess up some of the init also.
1755 */
1756static struct clk virt_prcm_set = {
1757 .name = "virt_prcm_set",
1758 .ops = &clkops_null,
1759 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1760 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1761 .set_rate = &omap2_select_table_rate,
1762 .round_rate = &omap2_round_to_table_rate,
1763};
1764
1765
1766/*
1767 * clkdev integration
1768 */
1769
1770static struct omap_clk omap2420_clks[] = {
1771 /* external root sources */
1772 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1773 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1774 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1775 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1776 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1777 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1778 /* internal analog sources */
1779 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1780 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1781 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1782 /* internal prcm root sources */
1783 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1784 CLK(NULL, "core_ck", &core_ck, CK_242X),
1785 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1786 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1787 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1788 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1789 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1790 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1791 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1792 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1793 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1794 /* mpu domain clocks */
1795 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1796 /* dsp domain clocks */
1797 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1798 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1799 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1800 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1801 /* GFX domain clocks */
1802 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1803 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1804 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1805 /* DSS domain clocks */
1806 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1807 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1808 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1809 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1810 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1811 /* L3 domain clocks */
1812 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1813 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1814 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1815 /* L4 domain clocks */
1816 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1817 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1818 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1819 /* virtual meta-group clock */
1820 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1821 /* general l4 interface ck, multi-parent functional clk */
1822 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1823 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1824 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1825 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1826 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1827 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1828 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1829 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1830 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1831 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1832 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1833 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1834 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1835 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1836 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1837 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1838 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1839 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1840 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1841 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1842 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1843 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1844 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1845 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1846 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1847 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1848 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1849 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1850 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1851 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1852 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1853 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1854 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1855 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1856 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1857 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1858 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1859 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1860 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1861 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1862 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1863 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1864 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1865 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1866 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1867 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1868 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1869 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1870 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1871 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1872 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1873 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1874 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1875 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1876 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1877 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1878 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1879 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1880 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1881 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1882 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1883 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1884 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1885 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1886 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1887 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1888 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1889 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1890 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1891 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1892 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1893 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1894 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1895 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1896 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1897 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1898 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1899 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1900 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1901 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1902 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1903 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1904 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1905 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1906 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1907 CLK(NULL, "des_ick", &des_ick, CK_242X),
1908 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1909 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1910 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1911 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1912 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1913 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1914 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1915 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1916 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1917 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1918 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1919 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1920 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1921};
1922
1923/*
1924 * init code
1925 */
1926
1927int __init omap2420_clk_init(void)
1928{
1929 const struct prcm_config *prcm;
1930 struct omap_clk *c;
1931 u32 clkrate;
1932
1933 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1934 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
1935 cpu_mask = RATE_IN_242X;
1936 rate_table = omap2420_rate_table;
1937
1938 clk_init(&omap2_clk_functions);
1939
1940 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1941 c++)
1942 clk_preinit(c->lk.clk);
1943
1944 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
1945 propagate_rate(&osc_ck);
1946 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
1947 propagate_rate(&sys_ck);
1948
1949 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1950 c++) {
1951 clkdev_add(&c->lk);
1952 clk_register(c->lk.clk);
1953 omap2_init_clk_clkdm(c->lk.clk);
1954 }
1955
1956 /* Disable autoidle on all clocks; let the PM code enable it later */
1957 omap_clk_disable_autoidle_all();
1958
1959 /* Check the MPU rate set by bootloader */
1960 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
1961 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
1962 if (!(prcm->flags & cpu_mask))
1963 continue;
1964 if (prcm->xtal_speed != sys_ck.rate)
1965 continue;
1966 if (prcm->dpll_speed <= clkrate)
1967 break;
1968 }
1969 curr_prcm_set = prcm;
1970
1971 recalculate_root_clocks();
1972
1973 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1974 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
1975 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
1976
1977 /*
1978 * Only enable those clocks we will need, let the drivers
1979 * enable other clocks as necessary
1980 */
1981 clk_enable_init_clocks();
1982
1983 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
1984 vclk = clk_get(NULL, "virt_prcm_set");
1985 sclk = clk_get(NULL, "sys_ck");
1986 dclk = clk_get(NULL, "dpll_ck");
1987
1988 return 0;
1989}
1990
diff --git a/arch/arm/mach-omap2/clock2430.c b/arch/arm/mach-omap2/clock2430.c
index a8e326177466..cef0c8d1de52 100644
--- a/arch/arm/mach-omap2/clock2430.c
+++ b/arch/arm/mach-omap2/clock2430.c
@@ -21,13 +21,11 @@
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"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
30#include "cm2xxx_3xxx.h" 28#include "cm2xxx.h"
31#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
32 30
33/** 31/**
@@ -42,7 +40,7 @@
42 * passes back the correct CM_IDLEST register address for I2CHS 40 * passes back the correct CM_IDLEST register address for I2CHS
43 * modules. No return value. 41 * modules. No return value.
44 */ 42 */
45static void omap2430_clk_i2chs_find_idlest(struct clk *clk, 43static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
46 void __iomem **idlest_reg, 44 void __iomem **idlest_reg,
47 u8 *idlest_bit, 45 u8 *idlest_bit,
48 u8 *idlest_val) 46 u8 *idlest_val)
@@ -53,9 +51,7 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
53} 51}
54 52
55/* 2430 I2CHS has non-standard IDLEST register */ 53/* 2430 I2CHS has non-standard IDLEST register */
56const struct clkops clkops_omap2430_i2chs_wait = { 54const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = {
57 .enable = omap2_dflt_clk_enable,
58 .disable = omap2_dflt_clk_disable,
59 .find_idlest = omap2430_clk_i2chs_find_idlest, 55 .find_idlest = omap2430_clk_i2chs_find_idlest,
60 .find_companion = omap2_clk_dflt_find_companion, 56 .find_companion = omap2_clk_dflt_find_companion,
61}; 57};
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
deleted file mode 100644
index 22404fe435e7..000000000000
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ /dev/null
@@ -1,2089 +0,0 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/list.h>
19
20#include <plat/clkdev_omap.h>
21
22#include "soc.h"
23#include "iomap.h"
24#include "clock.h"
25#include "clock2xxx.h"
26#include "opp2xxx.h"
27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30#include "cm-regbits-24xx.h"
31#include "sdrc.h"
32#include "control.h"
33
34#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
35
36/*
37 * 2430 clock tree.
38 *
39 * NOTE:In many cases here we are assigning a 'default' parent. In
40 * many cases the parent is selectable. The set parent calls will
41 * also switch sources.
42 *
43 * Several sources are given initial rates which may be wrong, this will
44 * be fixed up in the init func.
45 *
46 * Things are broadly separated below by clock domains. It is
47 * noteworthy that most peripherals have dependencies on multiple clock
48 * domains. Many get their interface clocks from the L4 domain, but get
49 * functional clocks from fixed sources or other core domain derived
50 * clocks.
51 */
52
53/* Base external input clocks */
54static struct clk func_32k_ck = {
55 .name = "func_32k_ck",
56 .ops = &clkops_null,
57 .rate = 32768,
58 .clkdm_name = "wkup_clkdm",
59};
60
61static struct clk secure_32k_ck = {
62 .name = "secure_32k_ck",
63 .ops = &clkops_null,
64 .rate = 32768,
65 .clkdm_name = "wkup_clkdm",
66};
67
68/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
69static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
70 .name = "osc_ck",
71 .ops = &clkops_oscck,
72 .clkdm_name = "wkup_clkdm",
73 .recalc = &omap2_osc_clk_recalc,
74};
75
76/* Without modem likely 12MHz, with modem likely 13MHz */
77static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
78 .name = "sys_ck", /* ~ ref_clk also */
79 .ops = &clkops_null,
80 .parent = &osc_ck,
81 .clkdm_name = "wkup_clkdm",
82 .recalc = &omap2xxx_sys_clk_recalc,
83};
84
85static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
86 .name = "alt_ck",
87 .ops = &clkops_null,
88 .rate = 54000000,
89 .clkdm_name = "wkup_clkdm",
90};
91
92/* Optional external clock input for McBSP CLKS */
93static struct clk mcbsp_clks = {
94 .name = "mcbsp_clks",
95 .ops = &clkops_null,
96};
97
98/*
99 * Analog domain root source clocks
100 */
101
102/* dpll_ck, is broken out in to special cases through clksel */
103/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
104 * deal with this
105 */
106
107static struct dpll_data dpll_dd = {
108 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
109 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
110 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
111 .clk_bypass = &sys_ck,
112 .clk_ref = &sys_ck,
113 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
114 .enable_mask = OMAP24XX_EN_DPLL_MASK,
115 .max_multiplier = 1023,
116 .min_divider = 1,
117 .max_divider = 16,
118};
119
120/*
121 * XXX Cannot add round_rate here yet, as this is still a composite clock,
122 * not just a DPLL
123 */
124static struct clk dpll_ck = {
125 .name = "dpll_ck",
126 .ops = &clkops_omap2xxx_dpll_ops,
127 .parent = &sys_ck, /* Can be func_32k also */
128 .dpll_data = &dpll_dd,
129 .clkdm_name = "wkup_clkdm",
130 .recalc = &omap2_dpllcore_recalc,
131 .set_rate = &omap2_reprogram_dpllcore,
132};
133
134static struct clk apll96_ck = {
135 .name = "apll96_ck",
136 .ops = &clkops_apll96,
137 .parent = &sys_ck,
138 .rate = 96000000,
139 .flags = ENABLE_ON_INIT,
140 .clkdm_name = "wkup_clkdm",
141 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
142 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
143};
144
145static struct clk apll54_ck = {
146 .name = "apll54_ck",
147 .ops = &clkops_apll54,
148 .parent = &sys_ck,
149 .rate = 54000000,
150 .flags = ENABLE_ON_INIT,
151 .clkdm_name = "wkup_clkdm",
152 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
153 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
154};
155
156/*
157 * PRCM digital base sources
158 */
159
160/* func_54m_ck */
161
162static const struct clksel_rate func_54m_apll54_rates[] = {
163 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
164 { .div = 0 },
165};
166
167static const struct clksel_rate func_54m_alt_rates[] = {
168 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
169 { .div = 0 },
170};
171
172static const struct clksel func_54m_clksel[] = {
173 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
174 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
175 { .parent = NULL },
176};
177
178static struct clk func_54m_ck = {
179 .name = "func_54m_ck",
180 .ops = &clkops_null,
181 .parent = &apll54_ck, /* can also be alt_clk */
182 .clkdm_name = "wkup_clkdm",
183 .init = &omap2_init_clksel_parent,
184 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
185 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
186 .clksel = func_54m_clksel,
187 .recalc = &omap2_clksel_recalc,
188};
189
190static struct clk core_ck = {
191 .name = "core_ck",
192 .ops = &clkops_null,
193 .parent = &dpll_ck, /* can also be 32k */
194 .clkdm_name = "wkup_clkdm",
195 .recalc = &followparent_recalc,
196};
197
198/* func_96m_ck */
199static const struct clksel_rate func_96m_apll96_rates[] = {
200 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
201 { .div = 0 },
202};
203
204static const struct clksel_rate func_96m_alt_rates[] = {
205 { .div = 1, .val = 1, .flags = RATE_IN_243X },
206 { .div = 0 },
207};
208
209static const struct clksel func_96m_clksel[] = {
210 { .parent = &apll96_ck, .rates = func_96m_apll96_rates },
211 { .parent = &alt_ck, .rates = func_96m_alt_rates },
212 { .parent = NULL }
213};
214
215static struct clk func_96m_ck = {
216 .name = "func_96m_ck",
217 .ops = &clkops_null,
218 .parent = &apll96_ck,
219 .clkdm_name = "wkup_clkdm",
220 .init = &omap2_init_clksel_parent,
221 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
222 .clksel_mask = OMAP2430_96M_SOURCE_MASK,
223 .clksel = func_96m_clksel,
224 .recalc = &omap2_clksel_recalc,
225};
226
227/* func_48m_ck */
228
229static const struct clksel_rate func_48m_apll96_rates[] = {
230 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
231 { .div = 0 },
232};
233
234static const struct clksel_rate func_48m_alt_rates[] = {
235 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
236 { .div = 0 },
237};
238
239static const struct clksel func_48m_clksel[] = {
240 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
241 { .parent = &alt_ck, .rates = func_48m_alt_rates },
242 { .parent = NULL }
243};
244
245static struct clk func_48m_ck = {
246 .name = "func_48m_ck",
247 .ops = &clkops_null,
248 .parent = &apll96_ck, /* 96M or Alt */
249 .clkdm_name = "wkup_clkdm",
250 .init = &omap2_init_clksel_parent,
251 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
252 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
253 .clksel = func_48m_clksel,
254 .recalc = &omap2_clksel_recalc,
255 .round_rate = &omap2_clksel_round_rate,
256 .set_rate = &omap2_clksel_set_rate
257};
258
259static struct clk func_12m_ck = {
260 .name = "func_12m_ck",
261 .ops = &clkops_null,
262 .parent = &func_48m_ck,
263 .fixed_div = 4,
264 .clkdm_name = "wkup_clkdm",
265 .recalc = &omap_fixed_divisor_recalc,
266};
267
268/* Secure timer, only available in secure mode */
269static struct clk wdt1_osc_ck = {
270 .name = "ck_wdt1_osc",
271 .ops = &clkops_null, /* RMK: missing? */
272 .parent = &osc_ck,
273 .recalc = &followparent_recalc,
274};
275
276/*
277 * The common_clkout* clksel_rate structs are common to
278 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
279 * sys_clkout2_* are 2420-only, so the
280 * clksel_rate flags fields are inaccurate for those clocks. This is
281 * harmless since access to those clocks are gated by the struct clk
282 * flags fields, which mark them as 2420-only.
283 */
284static const struct clksel_rate common_clkout_src_core_rates[] = {
285 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
286 { .div = 0 }
287};
288
289static const struct clksel_rate common_clkout_src_sys_rates[] = {
290 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
291 { .div = 0 }
292};
293
294static const struct clksel_rate common_clkout_src_96m_rates[] = {
295 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
296 { .div = 0 }
297};
298
299static const struct clksel_rate common_clkout_src_54m_rates[] = {
300 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
301 { .div = 0 }
302};
303
304static const struct clksel common_clkout_src_clksel[] = {
305 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
306 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
307 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
308 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
309 { .parent = NULL }
310};
311
312static struct clk sys_clkout_src = {
313 .name = "sys_clkout_src",
314 .ops = &clkops_omap2_dflt,
315 .parent = &func_54m_ck,
316 .clkdm_name = "wkup_clkdm",
317 .enable_reg = OMAP2430_PRCM_CLKOUT_CTRL,
318 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
319 .init = &omap2_init_clksel_parent,
320 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
321 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
322 .clksel = common_clkout_src_clksel,
323 .recalc = &omap2_clksel_recalc,
324 .round_rate = &omap2_clksel_round_rate,
325 .set_rate = &omap2_clksel_set_rate
326};
327
328static const struct clksel_rate common_clkout_rates[] = {
329 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
330 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
331 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
332 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
333 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
334 { .div = 0 },
335};
336
337static const struct clksel sys_clkout_clksel[] = {
338 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
339 { .parent = NULL }
340};
341
342static struct clk sys_clkout = {
343 .name = "sys_clkout",
344 .ops = &clkops_null,
345 .parent = &sys_clkout_src,
346 .clkdm_name = "wkup_clkdm",
347 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
348 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
349 .clksel = sys_clkout_clksel,
350 .recalc = &omap2_clksel_recalc,
351 .round_rate = &omap2_clksel_round_rate,
352 .set_rate = &omap2_clksel_set_rate
353};
354
355static struct clk emul_ck = {
356 .name = "emul_ck",
357 .ops = &clkops_omap2_dflt,
358 .parent = &func_54m_ck,
359 .clkdm_name = "wkup_clkdm",
360 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
361 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
362 .recalc = &followparent_recalc,
363
364};
365
366/*
367 * MPU clock domain
368 * Clocks:
369 * MPU_FCLK, MPU_ICLK
370 * INT_M_FCLK, INT_M_I_CLK
371 *
372 * - Individual clocks are hardware managed.
373 * - Base divider comes from: CM_CLKSEL_MPU
374 *
375 */
376static const struct clksel_rate mpu_core_rates[] = {
377 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
378 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
379 { .div = 0 },
380};
381
382static const struct clksel mpu_clksel[] = {
383 { .parent = &core_ck, .rates = mpu_core_rates },
384 { .parent = NULL }
385};
386
387static struct clk mpu_ck = { /* Control cpu */
388 .name = "mpu_ck",
389 .ops = &clkops_null,
390 .parent = &core_ck,
391 .clkdm_name = "mpu_clkdm",
392 .init = &omap2_init_clksel_parent,
393 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
394 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
395 .clksel = mpu_clksel,
396 .recalc = &omap2_clksel_recalc,
397};
398
399/*
400 * DSP (2430-IVA2.1) clock domain
401 * Clocks:
402 * 2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK
403 *
404 * Won't be too specific here. The core clock comes into this block
405 * it is divided then tee'ed. One branch goes directly to xyz enable
406 * controls. The other branch gets further divided by 2 then possibly
407 * routed into a synchronizer and out of clocks abc.
408 */
409static const struct clksel_rate dsp_fck_core_rates[] = {
410 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
411 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
412 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
413 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
414 { .div = 0 },
415};
416
417static const struct clksel dsp_fck_clksel[] = {
418 { .parent = &core_ck, .rates = dsp_fck_core_rates },
419 { .parent = NULL }
420};
421
422static struct clk dsp_fck = {
423 .name = "dsp_fck",
424 .ops = &clkops_omap2_dflt_wait,
425 .parent = &core_ck,
426 .clkdm_name = "dsp_clkdm",
427 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
428 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
429 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
430 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
431 .clksel = dsp_fck_clksel,
432 .recalc = &omap2_clksel_recalc,
433};
434
435static const struct clksel dsp_ick_clksel[] = {
436 { .parent = &dsp_fck, .rates = dsp_ick_rates },
437 { .parent = NULL }
438};
439
440/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
441static struct clk iva2_1_ick = {
442 .name = "iva2_1_ick",
443 .ops = &clkops_omap2_dflt_wait,
444 .parent = &dsp_fck,
445 .clkdm_name = "dsp_clkdm",
446 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
447 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
448 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
449 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
450 .clksel = dsp_ick_clksel,
451 .recalc = &omap2_clksel_recalc,
452};
453
454/*
455 * L3 clock domain
456 * L3 clocks are used for both interface and functional clocks to
457 * multiple entities. Some of these clocks are completely managed
458 * by hardware, and some others allow software control. Hardware
459 * managed ones general are based on directly CLK_REQ signals and
460 * various auto idle settings. The functional spec sets many of these
461 * as 'tie-high' for their enables.
462 *
463 * I-CLOCKS:
464 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
465 * CAM, HS-USB.
466 * F-CLOCK
467 * SSI.
468 *
469 * GPMC memories and SDRC have timing and clock sensitive registers which
470 * may very well need notification when the clock changes. Currently for low
471 * operating points, these are taken care of in sleep.S.
472 */
473static const struct clksel_rate core_l3_core_rates[] = {
474 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
475 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
476 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
477 { .div = 0 }
478};
479
480static const struct clksel core_l3_clksel[] = {
481 { .parent = &core_ck, .rates = core_l3_core_rates },
482 { .parent = NULL }
483};
484
485static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
486 .name = "core_l3_ck",
487 .ops = &clkops_null,
488 .parent = &core_ck,
489 .clkdm_name = "core_l3_clkdm",
490 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
491 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
492 .clksel = core_l3_clksel,
493 .recalc = &omap2_clksel_recalc,
494};
495
496/* usb_l4_ick */
497static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
498 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
499 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
500 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
501 { .div = 0 }
502};
503
504static const struct clksel usb_l4_ick_clksel[] = {
505 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
506 { .parent = NULL },
507};
508
509/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
510static struct clk usb_l4_ick = { /* FS-USB interface clock */
511 .name = "usb_l4_ick",
512 .ops = &clkops_omap2_iclk_dflt_wait,
513 .parent = &core_l3_ck,
514 .clkdm_name = "core_l4_clkdm",
515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
516 .enable_bit = OMAP24XX_EN_USB_SHIFT,
517 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
518 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
519 .clksel = usb_l4_ick_clksel,
520 .recalc = &omap2_clksel_recalc,
521};
522
523/*
524 * L4 clock management domain
525 *
526 * This domain contains lots of interface clocks from the L4 interface, some
527 * functional clocks. Fixed APLL functional source clocks are managed in
528 * this domain.
529 */
530static const struct clksel_rate l4_core_l3_rates[] = {
531 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
532 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
533 { .div = 0 }
534};
535
536static const struct clksel l4_clksel[] = {
537 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
538 { .parent = NULL }
539};
540
541static struct clk l4_ck = { /* used both as an ick and fck */
542 .name = "l4_ck",
543 .ops = &clkops_null,
544 .parent = &core_l3_ck,
545 .clkdm_name = "core_l4_clkdm",
546 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
547 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
548 .clksel = l4_clksel,
549 .recalc = &omap2_clksel_recalc,
550};
551
552/*
553 * SSI is in L3 management domain, its direct parent is core not l3,
554 * many core power domain entities are grouped into the L3 clock
555 * domain.
556 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
557 *
558 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
559 */
560static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
561 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
562 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
563 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
564 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
565 { .div = 5, .val = 5, .flags = RATE_IN_243X },
566 { .div = 0 }
567};
568
569static const struct clksel ssi_ssr_sst_fck_clksel[] = {
570 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
571 { .parent = NULL }
572};
573
574static struct clk ssi_ssr_sst_fck = {
575 .name = "ssi_fck",
576 .ops = &clkops_omap2_dflt_wait,
577 .parent = &core_ck,
578 .clkdm_name = "core_l3_clkdm",
579 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
580 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
581 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
582 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
583 .clksel = ssi_ssr_sst_fck_clksel,
584 .recalc = &omap2_clksel_recalc,
585};
586
587/*
588 * Presumably this is the same as SSI_ICLK.
589 * TRM contradicts itself on what clockdomain SSI_ICLK is in
590 */
591static struct clk ssi_l4_ick = {
592 .name = "ssi_l4_ick",
593 .ops = &clkops_omap2_iclk_dflt_wait,
594 .parent = &l4_ck,
595 .clkdm_name = "core_l4_clkdm",
596 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
597 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
598 .recalc = &followparent_recalc,
599};
600
601
602/*
603 * GFX clock domain
604 * Clocks:
605 * GFX_FCLK, GFX_ICLK
606 * GFX_CG1(2d), GFX_CG2(3d)
607 *
608 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
609 * The 2d and 3d clocks run at a hardware determined
610 * divided value of fclk.
611 *
612 */
613
614/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
615static const struct clksel gfx_fck_clksel[] = {
616 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
617 { .parent = NULL },
618};
619
620static struct clk gfx_3d_fck = {
621 .name = "gfx_3d_fck",
622 .ops = &clkops_omap2_dflt_wait,
623 .parent = &core_l3_ck,
624 .clkdm_name = "gfx_clkdm",
625 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
626 .enable_bit = OMAP24XX_EN_3D_SHIFT,
627 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
628 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
629 .clksel = gfx_fck_clksel,
630 .recalc = &omap2_clksel_recalc,
631 .round_rate = &omap2_clksel_round_rate,
632 .set_rate = &omap2_clksel_set_rate
633};
634
635static struct clk gfx_2d_fck = {
636 .name = "gfx_2d_fck",
637 .ops = &clkops_omap2_dflt_wait,
638 .parent = &core_l3_ck,
639 .clkdm_name = "gfx_clkdm",
640 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
641 .enable_bit = OMAP24XX_EN_2D_SHIFT,
642 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
643 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
644 .clksel = gfx_fck_clksel,
645 .recalc = &omap2_clksel_recalc,
646};
647
648/* This interface clock does not have a CM_AUTOIDLE bit */
649static struct clk gfx_ick = {
650 .name = "gfx_ick", /* From l3 */
651 .ops = &clkops_omap2_dflt_wait,
652 .parent = &core_l3_ck,
653 .clkdm_name = "gfx_clkdm",
654 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
655 .enable_bit = OMAP_EN_GFX_SHIFT,
656 .recalc = &followparent_recalc,
657};
658
659/*
660 * Modem clock domain (2430)
661 * CLOCKS:
662 * MDM_OSC_CLK
663 * MDM_ICLK
664 * These clocks are usable in chassis mode only.
665 */
666static const struct clksel_rate mdm_ick_core_rates[] = {
667 { .div = 1, .val = 1, .flags = RATE_IN_243X },
668 { .div = 4, .val = 4, .flags = RATE_IN_243X },
669 { .div = 6, .val = 6, .flags = RATE_IN_243X },
670 { .div = 9, .val = 9, .flags = RATE_IN_243X },
671 { .div = 0 }
672};
673
674static const struct clksel mdm_ick_clksel[] = {
675 { .parent = &core_ck, .rates = mdm_ick_core_rates },
676 { .parent = NULL }
677};
678
679static struct clk mdm_ick = { /* used both as a ick and fck */
680 .name = "mdm_ick",
681 .ops = &clkops_omap2_iclk_dflt_wait,
682 .parent = &core_ck,
683 .clkdm_name = "mdm_clkdm",
684 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
685 .enable_bit = OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
686 .clksel_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
687 .clksel_mask = OMAP2430_CLKSEL_MDM_MASK,
688 .clksel = mdm_ick_clksel,
689 .recalc = &omap2_clksel_recalc,
690};
691
692static struct clk mdm_osc_ck = {
693 .name = "mdm_osc_ck",
694 .ops = &clkops_omap2_mdmclk_dflt_wait,
695 .parent = &osc_ck,
696 .clkdm_name = "mdm_clkdm",
697 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
698 .enable_bit = OMAP2430_EN_OSC_SHIFT,
699 .recalc = &followparent_recalc,
700};
701
702/*
703 * DSS clock domain
704 * CLOCKs:
705 * DSS_L4_ICLK, DSS_L3_ICLK,
706 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
707 *
708 * DSS is both initiator and target.
709 */
710/* XXX Add RATE_NOT_VALIDATED */
711
712static const struct clksel_rate dss1_fck_sys_rates[] = {
713 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
714 { .div = 0 }
715};
716
717static const struct clksel_rate dss1_fck_core_rates[] = {
718 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
719 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
720 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
721 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
722 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
723 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
724 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
725 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
726 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
727 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
728 { .div = 0 }
729};
730
731static const struct clksel dss1_fck_clksel[] = {
732 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
733 { .parent = &core_ck, .rates = dss1_fck_core_rates },
734 { .parent = NULL },
735};
736
737static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
738 .name = "dss_ick",
739 .ops = &clkops_omap2_iclk_dflt,
740 .parent = &l4_ck, /* really both l3 and l4 */
741 .clkdm_name = "dss_clkdm",
742 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
743 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
744 .recalc = &followparent_recalc,
745};
746
747static struct clk dss1_fck = {
748 .name = "dss1_fck",
749 .ops = &clkops_omap2_dflt,
750 .parent = &core_ck, /* Core or sys */
751 .clkdm_name = "dss_clkdm",
752 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
753 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
754 .init = &omap2_init_clksel_parent,
755 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
756 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
757 .clksel = dss1_fck_clksel,
758 .recalc = &omap2_clksel_recalc,
759};
760
761static const struct clksel_rate dss2_fck_sys_rates[] = {
762 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
763 { .div = 0 }
764};
765
766static const struct clksel_rate dss2_fck_48m_rates[] = {
767 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
768 { .div = 0 }
769};
770
771static const struct clksel dss2_fck_clksel[] = {
772 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
773 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
774 { .parent = NULL }
775};
776
777static struct clk dss2_fck = { /* Alt clk used in power management */
778 .name = "dss2_fck",
779 .ops = &clkops_omap2_dflt,
780 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
781 .clkdm_name = "dss_clkdm",
782 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
783 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
784 .init = &omap2_init_clksel_parent,
785 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
786 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
787 .clksel = dss2_fck_clksel,
788 .recalc = &omap2_clksel_recalc,
789};
790
791static struct clk dss_54m_fck = { /* Alt clk used in power management */
792 .name = "dss_54m_fck", /* 54m tv clk */
793 .ops = &clkops_omap2_dflt_wait,
794 .parent = &func_54m_ck,
795 .clkdm_name = "dss_clkdm",
796 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
797 .enable_bit = OMAP24XX_EN_TV_SHIFT,
798 .recalc = &followparent_recalc,
799};
800
801static struct clk wu_l4_ick = {
802 .name = "wu_l4_ick",
803 .ops = &clkops_null,
804 .parent = &sys_ck,
805 .clkdm_name = "wkup_clkdm",
806 .recalc = &followparent_recalc,
807};
808
809/*
810 * CORE power domain ICLK & FCLK defines.
811 * Many of the these can have more than one possible parent. Entries
812 * here will likely have an L4 interface parent, and may have multiple
813 * functional clock parents.
814 */
815static const struct clksel_rate gpt_alt_rates[] = {
816 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
817 { .div = 0 }
818};
819
820static const struct clksel omap24xx_gpt_clksel[] = {
821 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
822 { .parent = &sys_ck, .rates = gpt_sys_rates },
823 { .parent = &alt_ck, .rates = gpt_alt_rates },
824 { .parent = NULL },
825};
826
827static struct clk gpt1_ick = {
828 .name = "gpt1_ick",
829 .ops = &clkops_omap2_iclk_dflt_wait,
830 .parent = &wu_l4_ick,
831 .clkdm_name = "wkup_clkdm",
832 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
833 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
834 .recalc = &followparent_recalc,
835};
836
837static struct clk gpt1_fck = {
838 .name = "gpt1_fck",
839 .ops = &clkops_omap2_dflt_wait,
840 .parent = &func_32k_ck,
841 .clkdm_name = "core_l4_clkdm",
842 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
843 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
844 .init = &omap2_init_clksel_parent,
845 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
846 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
847 .clksel = omap24xx_gpt_clksel,
848 .recalc = &omap2_clksel_recalc,
849 .round_rate = &omap2_clksel_round_rate,
850 .set_rate = &omap2_clksel_set_rate
851};
852
853static struct clk gpt2_ick = {
854 .name = "gpt2_ick",
855 .ops = &clkops_omap2_iclk_dflt_wait,
856 .parent = &l4_ck,
857 .clkdm_name = "core_l4_clkdm",
858 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
859 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
860 .recalc = &followparent_recalc,
861};
862
863static struct clk gpt2_fck = {
864 .name = "gpt2_fck",
865 .ops = &clkops_omap2_dflt_wait,
866 .parent = &func_32k_ck,
867 .clkdm_name = "core_l4_clkdm",
868 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
869 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
870 .init = &omap2_init_clksel_parent,
871 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
872 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
873 .clksel = omap24xx_gpt_clksel,
874 .recalc = &omap2_clksel_recalc,
875};
876
877static struct clk gpt3_ick = {
878 .name = "gpt3_ick",
879 .ops = &clkops_omap2_iclk_dflt_wait,
880 .parent = &l4_ck,
881 .clkdm_name = "core_l4_clkdm",
882 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
883 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
884 .recalc = &followparent_recalc,
885};
886
887static struct clk gpt3_fck = {
888 .name = "gpt3_fck",
889 .ops = &clkops_omap2_dflt_wait,
890 .parent = &func_32k_ck,
891 .clkdm_name = "core_l4_clkdm",
892 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
893 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
894 .init = &omap2_init_clksel_parent,
895 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
896 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
897 .clksel = omap24xx_gpt_clksel,
898 .recalc = &omap2_clksel_recalc,
899};
900
901static struct clk gpt4_ick = {
902 .name = "gpt4_ick",
903 .ops = &clkops_omap2_iclk_dflt_wait,
904 .parent = &l4_ck,
905 .clkdm_name = "core_l4_clkdm",
906 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
907 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
908 .recalc = &followparent_recalc,
909};
910
911static struct clk gpt4_fck = {
912 .name = "gpt4_fck",
913 .ops = &clkops_omap2_dflt_wait,
914 .parent = &func_32k_ck,
915 .clkdm_name = "core_l4_clkdm",
916 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
917 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
918 .init = &omap2_init_clksel_parent,
919 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
920 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
921 .clksel = omap24xx_gpt_clksel,
922 .recalc = &omap2_clksel_recalc,
923};
924
925static struct clk gpt5_ick = {
926 .name = "gpt5_ick",
927 .ops = &clkops_omap2_iclk_dflt_wait,
928 .parent = &l4_ck,
929 .clkdm_name = "core_l4_clkdm",
930 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
931 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
932 .recalc = &followparent_recalc,
933};
934
935static struct clk gpt5_fck = {
936 .name = "gpt5_fck",
937 .ops = &clkops_omap2_dflt_wait,
938 .parent = &func_32k_ck,
939 .clkdm_name = "core_l4_clkdm",
940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
941 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
942 .init = &omap2_init_clksel_parent,
943 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
944 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
945 .clksel = omap24xx_gpt_clksel,
946 .recalc = &omap2_clksel_recalc,
947};
948
949static struct clk gpt6_ick = {
950 .name = "gpt6_ick",
951 .ops = &clkops_omap2_iclk_dflt_wait,
952 .parent = &l4_ck,
953 .clkdm_name = "core_l4_clkdm",
954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
955 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
956 .recalc = &followparent_recalc,
957};
958
959static struct clk gpt6_fck = {
960 .name = "gpt6_fck",
961 .ops = &clkops_omap2_dflt_wait,
962 .parent = &func_32k_ck,
963 .clkdm_name = "core_l4_clkdm",
964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
965 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
966 .init = &omap2_init_clksel_parent,
967 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
968 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
969 .clksel = omap24xx_gpt_clksel,
970 .recalc = &omap2_clksel_recalc,
971};
972
973static struct clk gpt7_ick = {
974 .name = "gpt7_ick",
975 .ops = &clkops_omap2_iclk_dflt_wait,
976 .parent = &l4_ck,
977 .clkdm_name = "core_l4_clkdm",
978 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
979 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
980 .recalc = &followparent_recalc,
981};
982
983static struct clk gpt7_fck = {
984 .name = "gpt7_fck",
985 .ops = &clkops_omap2_dflt_wait,
986 .parent = &func_32k_ck,
987 .clkdm_name = "core_l4_clkdm",
988 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
989 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
990 .init = &omap2_init_clksel_parent,
991 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
992 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
993 .clksel = omap24xx_gpt_clksel,
994 .recalc = &omap2_clksel_recalc,
995};
996
997static struct clk gpt8_ick = {
998 .name = "gpt8_ick",
999 .ops = &clkops_omap2_iclk_dflt_wait,
1000 .parent = &l4_ck,
1001 .clkdm_name = "core_l4_clkdm",
1002 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1003 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1004 .recalc = &followparent_recalc,
1005};
1006
1007static struct clk gpt8_fck = {
1008 .name = "gpt8_fck",
1009 .ops = &clkops_omap2_dflt_wait,
1010 .parent = &func_32k_ck,
1011 .clkdm_name = "core_l4_clkdm",
1012 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1013 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1014 .init = &omap2_init_clksel_parent,
1015 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1016 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1017 .clksel = omap24xx_gpt_clksel,
1018 .recalc = &omap2_clksel_recalc,
1019};
1020
1021static struct clk gpt9_ick = {
1022 .name = "gpt9_ick",
1023 .ops = &clkops_omap2_iclk_dflt_wait,
1024 .parent = &l4_ck,
1025 .clkdm_name = "core_l4_clkdm",
1026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1027 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1028 .recalc = &followparent_recalc,
1029};
1030
1031static struct clk gpt9_fck = {
1032 .name = "gpt9_fck",
1033 .ops = &clkops_omap2_dflt_wait,
1034 .parent = &func_32k_ck,
1035 .clkdm_name = "core_l4_clkdm",
1036 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1037 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1038 .init = &omap2_init_clksel_parent,
1039 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1040 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1041 .clksel = omap24xx_gpt_clksel,
1042 .recalc = &omap2_clksel_recalc,
1043};
1044
1045static struct clk gpt10_ick = {
1046 .name = "gpt10_ick",
1047 .ops = &clkops_omap2_iclk_dflt_wait,
1048 .parent = &l4_ck,
1049 .clkdm_name = "core_l4_clkdm",
1050 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1051 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1052 .recalc = &followparent_recalc,
1053};
1054
1055static struct clk gpt10_fck = {
1056 .name = "gpt10_fck",
1057 .ops = &clkops_omap2_dflt_wait,
1058 .parent = &func_32k_ck,
1059 .clkdm_name = "core_l4_clkdm",
1060 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1061 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1062 .init = &omap2_init_clksel_parent,
1063 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1064 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1065 .clksel = omap24xx_gpt_clksel,
1066 .recalc = &omap2_clksel_recalc,
1067};
1068
1069static struct clk gpt11_ick = {
1070 .name = "gpt11_ick",
1071 .ops = &clkops_omap2_iclk_dflt_wait,
1072 .parent = &l4_ck,
1073 .clkdm_name = "core_l4_clkdm",
1074 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1075 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1076 .recalc = &followparent_recalc,
1077};
1078
1079static struct clk gpt11_fck = {
1080 .name = "gpt11_fck",
1081 .ops = &clkops_omap2_dflt_wait,
1082 .parent = &func_32k_ck,
1083 .clkdm_name = "core_l4_clkdm",
1084 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1085 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1086 .init = &omap2_init_clksel_parent,
1087 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1088 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1089 .clksel = omap24xx_gpt_clksel,
1090 .recalc = &omap2_clksel_recalc,
1091};
1092
1093static struct clk gpt12_ick = {
1094 .name = "gpt12_ick",
1095 .ops = &clkops_omap2_iclk_dflt_wait,
1096 .parent = &l4_ck,
1097 .clkdm_name = "core_l4_clkdm",
1098 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1099 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1100 .recalc = &followparent_recalc,
1101};
1102
1103static struct clk gpt12_fck = {
1104 .name = "gpt12_fck",
1105 .ops = &clkops_omap2_dflt_wait,
1106 .parent = &secure_32k_ck,
1107 .clkdm_name = "core_l4_clkdm",
1108 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1109 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1110 .init = &omap2_init_clksel_parent,
1111 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1112 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1113 .clksel = omap24xx_gpt_clksel,
1114 .recalc = &omap2_clksel_recalc,
1115};
1116
1117static struct clk mcbsp1_ick = {
1118 .name = "mcbsp1_ick",
1119 .ops = &clkops_omap2_iclk_dflt_wait,
1120 .parent = &l4_ck,
1121 .clkdm_name = "core_l4_clkdm",
1122 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1123 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1124 .recalc = &followparent_recalc,
1125};
1126
1127static const struct clksel_rate common_mcbsp_96m_rates[] = {
1128 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1129 { .div = 0 }
1130};
1131
1132static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1133 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1134 { .div = 0 }
1135};
1136
1137static const struct clksel mcbsp_fck_clksel[] = {
1138 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1139 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1140 { .parent = NULL }
1141};
1142
1143static struct clk mcbsp1_fck = {
1144 .name = "mcbsp1_fck",
1145 .ops = &clkops_omap2_dflt_wait,
1146 .parent = &func_96m_ck,
1147 .init = &omap2_init_clksel_parent,
1148 .clkdm_name = "core_l4_clkdm",
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1150 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1151 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1152 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1153 .clksel = mcbsp_fck_clksel,
1154 .recalc = &omap2_clksel_recalc,
1155};
1156
1157static struct clk mcbsp2_ick = {
1158 .name = "mcbsp2_ick",
1159 .ops = &clkops_omap2_iclk_dflt_wait,
1160 .parent = &l4_ck,
1161 .clkdm_name = "core_l4_clkdm",
1162 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1163 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1164 .recalc = &followparent_recalc,
1165};
1166
1167static struct clk mcbsp2_fck = {
1168 .name = "mcbsp2_fck",
1169 .ops = &clkops_omap2_dflt_wait,
1170 .parent = &func_96m_ck,
1171 .init = &omap2_init_clksel_parent,
1172 .clkdm_name = "core_l4_clkdm",
1173 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1174 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1175 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1176 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1177 .clksel = mcbsp_fck_clksel,
1178 .recalc = &omap2_clksel_recalc,
1179};
1180
1181static struct clk mcbsp3_ick = {
1182 .name = "mcbsp3_ick",
1183 .ops = &clkops_omap2_iclk_dflt_wait,
1184 .parent = &l4_ck,
1185 .clkdm_name = "core_l4_clkdm",
1186 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1187 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1188 .recalc = &followparent_recalc,
1189};
1190
1191static struct clk mcbsp3_fck = {
1192 .name = "mcbsp3_fck",
1193 .ops = &clkops_omap2_dflt_wait,
1194 .parent = &func_96m_ck,
1195 .init = &omap2_init_clksel_parent,
1196 .clkdm_name = "core_l4_clkdm",
1197 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1198 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1199 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1200 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
1201 .clksel = mcbsp_fck_clksel,
1202 .recalc = &omap2_clksel_recalc,
1203};
1204
1205static struct clk mcbsp4_ick = {
1206 .name = "mcbsp4_ick",
1207 .ops = &clkops_omap2_iclk_dflt_wait,
1208 .parent = &l4_ck,
1209 .clkdm_name = "core_l4_clkdm",
1210 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1211 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1212 .recalc = &followparent_recalc,
1213};
1214
1215static struct clk mcbsp4_fck = {
1216 .name = "mcbsp4_fck",
1217 .ops = &clkops_omap2_dflt_wait,
1218 .parent = &func_96m_ck,
1219 .init = &omap2_init_clksel_parent,
1220 .clkdm_name = "core_l4_clkdm",
1221 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1222 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1223 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1224 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
1225 .clksel = mcbsp_fck_clksel,
1226 .recalc = &omap2_clksel_recalc,
1227};
1228
1229static struct clk mcbsp5_ick = {
1230 .name = "mcbsp5_ick",
1231 .ops = &clkops_omap2_iclk_dflt_wait,
1232 .parent = &l4_ck,
1233 .clkdm_name = "core_l4_clkdm",
1234 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1235 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1236 .recalc = &followparent_recalc,
1237};
1238
1239static struct clk mcbsp5_fck = {
1240 .name = "mcbsp5_fck",
1241 .ops = &clkops_omap2_dflt_wait,
1242 .parent = &func_96m_ck,
1243 .init = &omap2_init_clksel_parent,
1244 .clkdm_name = "core_l4_clkdm",
1245 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1246 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1247 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1248 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1249 .clksel = mcbsp_fck_clksel,
1250 .recalc = &omap2_clksel_recalc,
1251};
1252
1253static struct clk mcspi1_ick = {
1254 .name = "mcspi1_ick",
1255 .ops = &clkops_omap2_iclk_dflt_wait,
1256 .parent = &l4_ck,
1257 .clkdm_name = "core_l4_clkdm",
1258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1259 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1260 .recalc = &followparent_recalc,
1261};
1262
1263static struct clk mcspi1_fck = {
1264 .name = "mcspi1_fck",
1265 .ops = &clkops_omap2_dflt_wait,
1266 .parent = &func_48m_ck,
1267 .clkdm_name = "core_l4_clkdm",
1268 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1269 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1270 .recalc = &followparent_recalc,
1271};
1272
1273static struct clk mcspi2_ick = {
1274 .name = "mcspi2_ick",
1275 .ops = &clkops_omap2_iclk_dflt_wait,
1276 .parent = &l4_ck,
1277 .clkdm_name = "core_l4_clkdm",
1278 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1279 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1280 .recalc = &followparent_recalc,
1281};
1282
1283static struct clk mcspi2_fck = {
1284 .name = "mcspi2_fck",
1285 .ops = &clkops_omap2_dflt_wait,
1286 .parent = &func_48m_ck,
1287 .clkdm_name = "core_l4_clkdm",
1288 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1289 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1290 .recalc = &followparent_recalc,
1291};
1292
1293static struct clk mcspi3_ick = {
1294 .name = "mcspi3_ick",
1295 .ops = &clkops_omap2_iclk_dflt_wait,
1296 .parent = &l4_ck,
1297 .clkdm_name = "core_l4_clkdm",
1298 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1299 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1300 .recalc = &followparent_recalc,
1301};
1302
1303static struct clk mcspi3_fck = {
1304 .name = "mcspi3_fck",
1305 .ops = &clkops_omap2_dflt_wait,
1306 .parent = &func_48m_ck,
1307 .clkdm_name = "core_l4_clkdm",
1308 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1309 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1310 .recalc = &followparent_recalc,
1311};
1312
1313static struct clk uart1_ick = {
1314 .name = "uart1_ick",
1315 .ops = &clkops_omap2_iclk_dflt_wait,
1316 .parent = &l4_ck,
1317 .clkdm_name = "core_l4_clkdm",
1318 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1319 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1320 .recalc = &followparent_recalc,
1321};
1322
1323static struct clk uart1_fck = {
1324 .name = "uart1_fck",
1325 .ops = &clkops_omap2_dflt_wait,
1326 .parent = &func_48m_ck,
1327 .clkdm_name = "core_l4_clkdm",
1328 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1329 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1330 .recalc = &followparent_recalc,
1331};
1332
1333static struct clk uart2_ick = {
1334 .name = "uart2_ick",
1335 .ops = &clkops_omap2_iclk_dflt_wait,
1336 .parent = &l4_ck,
1337 .clkdm_name = "core_l4_clkdm",
1338 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1339 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1340 .recalc = &followparent_recalc,
1341};
1342
1343static struct clk uart2_fck = {
1344 .name = "uart2_fck",
1345 .ops = &clkops_omap2_dflt_wait,
1346 .parent = &func_48m_ck,
1347 .clkdm_name = "core_l4_clkdm",
1348 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1349 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1350 .recalc = &followparent_recalc,
1351};
1352
1353static struct clk uart3_ick = {
1354 .name = "uart3_ick",
1355 .ops = &clkops_omap2_iclk_dflt_wait,
1356 .parent = &l4_ck,
1357 .clkdm_name = "core_l4_clkdm",
1358 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1359 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1360 .recalc = &followparent_recalc,
1361};
1362
1363static struct clk uart3_fck = {
1364 .name = "uart3_fck",
1365 .ops = &clkops_omap2_dflt_wait,
1366 .parent = &func_48m_ck,
1367 .clkdm_name = "core_l4_clkdm",
1368 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1369 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1370 .recalc = &followparent_recalc,
1371};
1372
1373static struct clk gpios_ick = {
1374 .name = "gpios_ick",
1375 .ops = &clkops_omap2_iclk_dflt_wait,
1376 .parent = &wu_l4_ick,
1377 .clkdm_name = "wkup_clkdm",
1378 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1379 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1380 .recalc = &followparent_recalc,
1381};
1382
1383static struct clk gpios_fck = {
1384 .name = "gpios_fck",
1385 .ops = &clkops_omap2_dflt_wait,
1386 .parent = &func_32k_ck,
1387 .clkdm_name = "wkup_clkdm",
1388 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1389 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1390 .recalc = &followparent_recalc,
1391};
1392
1393static struct clk mpu_wdt_ick = {
1394 .name = "mpu_wdt_ick",
1395 .ops = &clkops_omap2_iclk_dflt_wait,
1396 .parent = &wu_l4_ick,
1397 .clkdm_name = "wkup_clkdm",
1398 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1399 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1400 .recalc = &followparent_recalc,
1401};
1402
1403static struct clk mpu_wdt_fck = {
1404 .name = "mpu_wdt_fck",
1405 .ops = &clkops_omap2_dflt_wait,
1406 .parent = &func_32k_ck,
1407 .clkdm_name = "wkup_clkdm",
1408 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1409 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1410 .recalc = &followparent_recalc,
1411};
1412
1413static struct clk sync_32k_ick = {
1414 .name = "sync_32k_ick",
1415 .ops = &clkops_omap2_iclk_dflt_wait,
1416 .flags = ENABLE_ON_INIT,
1417 .parent = &wu_l4_ick,
1418 .clkdm_name = "wkup_clkdm",
1419 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1420 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1421 .recalc = &followparent_recalc,
1422};
1423
1424static struct clk wdt1_ick = {
1425 .name = "wdt1_ick",
1426 .ops = &clkops_omap2_iclk_dflt_wait,
1427 .parent = &wu_l4_ick,
1428 .clkdm_name = "wkup_clkdm",
1429 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1430 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1431 .recalc = &followparent_recalc,
1432};
1433
1434static struct clk omapctrl_ick = {
1435 .name = "omapctrl_ick",
1436 .ops = &clkops_omap2_iclk_dflt_wait,
1437 .flags = ENABLE_ON_INIT,
1438 .parent = &wu_l4_ick,
1439 .clkdm_name = "wkup_clkdm",
1440 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1441 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1442 .recalc = &followparent_recalc,
1443};
1444
1445static struct clk icr_ick = {
1446 .name = "icr_ick",
1447 .ops = &clkops_omap2_iclk_dflt_wait,
1448 .parent = &wu_l4_ick,
1449 .clkdm_name = "wkup_clkdm",
1450 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1451 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1452 .recalc = &followparent_recalc,
1453};
1454
1455static struct clk cam_ick = {
1456 .name = "cam_ick",
1457 .ops = &clkops_omap2_iclk_dflt,
1458 .parent = &l4_ck,
1459 .clkdm_name = "core_l4_clkdm",
1460 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1461 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1462 .recalc = &followparent_recalc,
1463};
1464
1465/*
1466 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1467 * split into two separate clocks, since the parent clocks are different
1468 * and the clockdomains are also different.
1469 */
1470static struct clk cam_fck = {
1471 .name = "cam_fck",
1472 .ops = &clkops_omap2_dflt,
1473 .parent = &func_96m_ck,
1474 .clkdm_name = "core_l3_clkdm",
1475 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1476 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1477 .recalc = &followparent_recalc,
1478};
1479
1480static struct clk mailboxes_ick = {
1481 .name = "mailboxes_ick",
1482 .ops = &clkops_omap2_iclk_dflt_wait,
1483 .parent = &l4_ck,
1484 .clkdm_name = "core_l4_clkdm",
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1486 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1487 .recalc = &followparent_recalc,
1488};
1489
1490static struct clk wdt4_ick = {
1491 .name = "wdt4_ick",
1492 .ops = &clkops_omap2_iclk_dflt_wait,
1493 .parent = &l4_ck,
1494 .clkdm_name = "core_l4_clkdm",
1495 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1496 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1497 .recalc = &followparent_recalc,
1498};
1499
1500static struct clk wdt4_fck = {
1501 .name = "wdt4_fck",
1502 .ops = &clkops_omap2_dflt_wait,
1503 .parent = &func_32k_ck,
1504 .clkdm_name = "core_l4_clkdm",
1505 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1506 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1507 .recalc = &followparent_recalc,
1508};
1509
1510static struct clk mspro_ick = {
1511 .name = "mspro_ick",
1512 .ops = &clkops_omap2_iclk_dflt_wait,
1513 .parent = &l4_ck,
1514 .clkdm_name = "core_l4_clkdm",
1515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1516 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1517 .recalc = &followparent_recalc,
1518};
1519
1520static struct clk mspro_fck = {
1521 .name = "mspro_fck",
1522 .ops = &clkops_omap2_dflt_wait,
1523 .parent = &func_96m_ck,
1524 .clkdm_name = "core_l4_clkdm",
1525 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1526 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1527 .recalc = &followparent_recalc,
1528};
1529
1530static struct clk fac_ick = {
1531 .name = "fac_ick",
1532 .ops = &clkops_omap2_iclk_dflt_wait,
1533 .parent = &l4_ck,
1534 .clkdm_name = "core_l4_clkdm",
1535 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1536 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1537 .recalc = &followparent_recalc,
1538};
1539
1540static struct clk fac_fck = {
1541 .name = "fac_fck",
1542 .ops = &clkops_omap2_dflt_wait,
1543 .parent = &func_12m_ck,
1544 .clkdm_name = "core_l4_clkdm",
1545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1547 .recalc = &followparent_recalc,
1548};
1549
1550static struct clk hdq_ick = {
1551 .name = "hdq_ick",
1552 .ops = &clkops_omap2_iclk_dflt_wait,
1553 .parent = &l4_ck,
1554 .clkdm_name = "core_l4_clkdm",
1555 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1556 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1557 .recalc = &followparent_recalc,
1558};
1559
1560static struct clk hdq_fck = {
1561 .name = "hdq_fck",
1562 .ops = &clkops_omap2_dflt_wait,
1563 .parent = &func_12m_ck,
1564 .clkdm_name = "core_l4_clkdm",
1565 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1566 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1567 .recalc = &followparent_recalc,
1568};
1569
1570/*
1571 * XXX This is marked as a 2420-only define, but it claims to be present
1572 * on 2430 also. Double-check.
1573 */
1574static struct clk i2c2_ick = {
1575 .name = "i2c2_ick",
1576 .ops = &clkops_omap2_iclk_dflt_wait,
1577 .parent = &l4_ck,
1578 .clkdm_name = "core_l4_clkdm",
1579 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1580 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1581 .recalc = &followparent_recalc,
1582};
1583
1584static struct clk i2chs2_fck = {
1585 .name = "i2chs2_fck",
1586 .ops = &clkops_omap2430_i2chs_wait,
1587 .parent = &func_96m_ck,
1588 .clkdm_name = "core_l4_clkdm",
1589 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1590 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1591 .recalc = &followparent_recalc,
1592};
1593
1594/*
1595 * XXX This is marked as a 2420-only define, but it claims to be present
1596 * on 2430 also. Double-check.
1597 */
1598static struct clk i2c1_ick = {
1599 .name = "i2c1_ick",
1600 .ops = &clkops_omap2_iclk_dflt_wait,
1601 .parent = &l4_ck,
1602 .clkdm_name = "core_l4_clkdm",
1603 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1604 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1605 .recalc = &followparent_recalc,
1606};
1607
1608static struct clk i2chs1_fck = {
1609 .name = "i2chs1_fck",
1610 .ops = &clkops_omap2430_i2chs_wait,
1611 .parent = &func_96m_ck,
1612 .clkdm_name = "core_l4_clkdm",
1613 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1614 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
1615 .recalc = &followparent_recalc,
1616};
1617
1618/*
1619 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1620 * accesses derived from this data.
1621 */
1622static struct clk gpmc_fck = {
1623 .name = "gpmc_fck",
1624 .ops = &clkops_omap2_iclk_idle_only,
1625 .parent = &core_l3_ck,
1626 .flags = ENABLE_ON_INIT,
1627 .clkdm_name = "core_l3_clkdm",
1628 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1629 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1630 .recalc = &followparent_recalc,
1631};
1632
1633static struct clk sdma_fck = {
1634 .name = "sdma_fck",
1635 .ops = &clkops_null, /* RMK: missing? */
1636 .parent = &core_l3_ck,
1637 .clkdm_name = "core_l3_clkdm",
1638 .recalc = &followparent_recalc,
1639};
1640
1641/*
1642 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1643 * accesses derived from this data.
1644 */
1645static struct clk sdma_ick = {
1646 .name = "sdma_ick",
1647 .ops = &clkops_omap2_iclk_idle_only,
1648 .parent = &core_l3_ck,
1649 .clkdm_name = "core_l3_clkdm",
1650 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1651 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1652 .recalc = &followparent_recalc,
1653};
1654
1655static struct clk sdrc_ick = {
1656 .name = "sdrc_ick",
1657 .ops = &clkops_omap2_iclk_idle_only,
1658 .parent = &core_l3_ck,
1659 .flags = ENABLE_ON_INIT,
1660 .clkdm_name = "core_l3_clkdm",
1661 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1662 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1663 .recalc = &followparent_recalc,
1664};
1665
1666static struct clk des_ick = {
1667 .name = "des_ick",
1668 .ops = &clkops_omap2_iclk_dflt_wait,
1669 .parent = &l4_ck,
1670 .clkdm_name = "core_l4_clkdm",
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1672 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1673 .recalc = &followparent_recalc,
1674};
1675
1676static struct clk sha_ick = {
1677 .name = "sha_ick",
1678 .ops = &clkops_omap2_iclk_dflt_wait,
1679 .parent = &l4_ck,
1680 .clkdm_name = "core_l4_clkdm",
1681 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1682 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1683 .recalc = &followparent_recalc,
1684};
1685
1686static struct clk rng_ick = {
1687 .name = "rng_ick",
1688 .ops = &clkops_omap2_iclk_dflt_wait,
1689 .parent = &l4_ck,
1690 .clkdm_name = "core_l4_clkdm",
1691 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1692 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1693 .recalc = &followparent_recalc,
1694};
1695
1696static struct clk aes_ick = {
1697 .name = "aes_ick",
1698 .ops = &clkops_omap2_iclk_dflt_wait,
1699 .parent = &l4_ck,
1700 .clkdm_name = "core_l4_clkdm",
1701 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1702 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1703 .recalc = &followparent_recalc,
1704};
1705
1706static struct clk pka_ick = {
1707 .name = "pka_ick",
1708 .ops = &clkops_omap2_iclk_dflt_wait,
1709 .parent = &l4_ck,
1710 .clkdm_name = "core_l4_clkdm",
1711 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1712 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1713 .recalc = &followparent_recalc,
1714};
1715
1716static struct clk usb_fck = {
1717 .name = "usb_fck",
1718 .ops = &clkops_omap2_dflt_wait,
1719 .parent = &func_48m_ck,
1720 .clkdm_name = "core_l3_clkdm",
1721 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1722 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1723 .recalc = &followparent_recalc,
1724};
1725
1726static struct clk usbhs_ick = {
1727 .name = "usbhs_ick",
1728 .ops = &clkops_omap2_iclk_dflt_wait,
1729 .parent = &core_l3_ck,
1730 .clkdm_name = "core_l3_clkdm",
1731 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1732 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1733 .recalc = &followparent_recalc,
1734};
1735
1736static struct clk mmchs1_ick = {
1737 .name = "mmchs1_ick",
1738 .ops = &clkops_omap2_iclk_dflt_wait,
1739 .parent = &l4_ck,
1740 .clkdm_name = "core_l4_clkdm",
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1742 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1743 .recalc = &followparent_recalc,
1744};
1745
1746static struct clk mmchs1_fck = {
1747 .name = "mmchs1_fck",
1748 .ops = &clkops_omap2_dflt_wait,
1749 .parent = &func_96m_ck,
1750 .clkdm_name = "core_l4_clkdm",
1751 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1752 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1753 .recalc = &followparent_recalc,
1754};
1755
1756static struct clk mmchs2_ick = {
1757 .name = "mmchs2_ick",
1758 .ops = &clkops_omap2_iclk_dflt_wait,
1759 .parent = &l4_ck,
1760 .clkdm_name = "core_l4_clkdm",
1761 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1762 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1763 .recalc = &followparent_recalc,
1764};
1765
1766static struct clk mmchs2_fck = {
1767 .name = "mmchs2_fck",
1768 .ops = &clkops_omap2_dflt_wait,
1769 .parent = &func_96m_ck,
1770 .clkdm_name = "core_l4_clkdm",
1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1772 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1773 .recalc = &followparent_recalc,
1774};
1775
1776static struct clk gpio5_ick = {
1777 .name = "gpio5_ick",
1778 .ops = &clkops_omap2_iclk_dflt_wait,
1779 .parent = &l4_ck,
1780 .clkdm_name = "core_l4_clkdm",
1781 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1782 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1783 .recalc = &followparent_recalc,
1784};
1785
1786static struct clk gpio5_fck = {
1787 .name = "gpio5_fck",
1788 .ops = &clkops_omap2_dflt_wait,
1789 .parent = &func_32k_ck,
1790 .clkdm_name = "core_l4_clkdm",
1791 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1792 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1793 .recalc = &followparent_recalc,
1794};
1795
1796static struct clk mdm_intc_ick = {
1797 .name = "mdm_intc_ick",
1798 .ops = &clkops_omap2_iclk_dflt_wait,
1799 .parent = &l4_ck,
1800 .clkdm_name = "core_l4_clkdm",
1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1802 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1803 .recalc = &followparent_recalc,
1804};
1805
1806static struct clk mmchsdb1_fck = {
1807 .name = "mmchsdb1_fck",
1808 .ops = &clkops_omap2_dflt_wait,
1809 .parent = &func_32k_ck,
1810 .clkdm_name = "core_l4_clkdm",
1811 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1812 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1813 .recalc = &followparent_recalc,
1814};
1815
1816static struct clk mmchsdb2_fck = {
1817 .name = "mmchsdb2_fck",
1818 .ops = &clkops_omap2_dflt_wait,
1819 .parent = &func_32k_ck,
1820 .clkdm_name = "core_l4_clkdm",
1821 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1822 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1823 .recalc = &followparent_recalc,
1824};
1825
1826/*
1827 * This clock is a composite clock which does entire set changes then
1828 * forces a rebalance. It keys on the MPU speed, but it really could
1829 * be any key speed part of a set in the rate table.
1830 *
1831 * to really change a set, you need memory table sets which get changed
1832 * in sram, pre-notifiers & post notifiers, changing the top set, without
1833 * having low level display recalc's won't work... this is why dpm notifiers
1834 * work, isr's off, walk a list of clocks already _off_ and not messing with
1835 * the bus.
1836 *
1837 * This clock should have no parent. It embodies the entire upper level
1838 * active set. A parent will mess up some of the init also.
1839 */
1840static struct clk virt_prcm_set = {
1841 .name = "virt_prcm_set",
1842 .ops = &clkops_null,
1843 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1844 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1845 .set_rate = &omap2_select_table_rate,
1846 .round_rate = &omap2_round_to_table_rate,
1847};
1848
1849
1850/*
1851 * clkdev integration
1852 */
1853
1854static struct omap_clk omap2430_clks[] = {
1855 /* external root sources */
1856 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1857 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1858 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1859 CLK("twl", "fck", &osc_ck, CK_243X),
1860 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1861 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1862 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1863 /* internal analog sources */
1864 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1865 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1866 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1867 /* internal prcm root sources */
1868 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1869 CLK(NULL, "core_ck", &core_ck, CK_243X),
1870 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1871 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1872 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1873 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1874 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1875 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1876 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1877 /* mpu domain clocks */
1878 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1879 /* dsp domain clocks */
1880 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1881 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1882 /* GFX domain clocks */
1883 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1884 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1885 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1886 /* Modem domain clocks */
1887 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1888 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1889 /* DSS domain clocks */
1890 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1892 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1893 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1894 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1895 /* L3 domain clocks */
1896 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1897 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1898 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1899 /* L4 domain clocks */
1900 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1901 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1902 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1903 /* virtual meta-group clock */
1904 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1905 /* general l4 interface ck, multi-parent functional clk */
1906 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1907 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1908 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1909 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1910 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1911 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1912 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1913 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1914 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1915 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1916 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1917 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1918 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1919 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1920 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1921 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1922 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1923 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1924 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1925 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1926 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1927 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1928 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1929 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1930 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1932 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1933 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1935 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1936 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1938 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1939 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1941 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1942 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1944 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1945 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1947 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1948 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1950 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1951 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1953 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1954 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1955 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1956 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1957 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1958 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1959 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1960 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1961 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1962 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1964 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1965 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1966 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1967 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1968 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1969 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1970 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1971 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1972 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1973 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1974 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1975 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1976 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1977 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1978 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1979 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1980 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1981 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1982 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1983 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1984 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1986 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1987 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1989 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1990 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1991 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1992 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1993 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1994 CLK(NULL, "des_ick", &des_ick, CK_243X),
1995 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1996 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1997 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1998 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1999 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
2000 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
2001 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2002 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2003 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2005 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2006 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2008 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2009 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2010 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2011 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2012 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2013 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2014 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2016 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2017 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2018 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2019 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2020};
2021
2022/*
2023 * init code
2024 */
2025
2026int __init omap2430_clk_init(void)
2027{
2028 const struct prcm_config *prcm;
2029 struct omap_clk *c;
2030 u32 clkrate;
2031
2032 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2033 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
2034 cpu_mask = RATE_IN_243X;
2035 rate_table = omap2430_rate_table;
2036
2037 clk_init(&omap2_clk_functions);
2038
2039 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2040 c++)
2041 clk_preinit(c->lk.clk);
2042
2043 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
2044 propagate_rate(&osc_ck);
2045 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2046 propagate_rate(&sys_ck);
2047
2048 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2049 c++) {
2050 clkdev_add(&c->lk);
2051 clk_register(c->lk.clk);
2052 omap2_init_clk_clkdm(c->lk.clk);
2053 }
2054
2055 /* Disable autoidle on all clocks; let the PM code enable it later */
2056 omap_clk_disable_autoidle_all();
2057
2058 /* Check the MPU rate set by bootloader */
2059 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
2060 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
2061 if (!(prcm->flags & cpu_mask))
2062 continue;
2063 if (prcm->xtal_speed != sys_ck.rate)
2064 continue;
2065 if (prcm->dpll_speed <= clkrate)
2066 break;
2067 }
2068 curr_prcm_set = prcm;
2069
2070 recalculate_root_clocks();
2071
2072 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2073 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
2074 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
2075
2076 /*
2077 * Only enable those clocks we will need, let the drivers
2078 * enable other clocks as necessary
2079 */
2080 clk_enable_init_clocks();
2081
2082 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
2083 vclk = clk_get(NULL, "virt_prcm_set");
2084 sclk = clk_get(NULL, "sys_ck");
2085 dclk = clk_get(NULL, "dpll_ck");
2086
2087 return 0;
2088}
2089
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index e92be1fc1a00..1ff646908627 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -22,35 +22,18 @@
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"
30#include "cm.h" 28#include "cm.h"
31#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
32 30
33struct clk *vclk, *sclk, *dclk; 31struct clk_hw *dclk_hw;
34
35/* 32/*
36 * Omap24xx specific clock functions 33 * Omap24xx specific clock functions
37 */ 34 */
38 35
39/* 36/*
40 * Set clocks for bypass mode for reboot to work.
41 */
42void omap2xxx_clk_prepare_for_reboot(void)
43{
44 u32 rate;
45
46 if (vclk == NULL || sclk == NULL)
47 return;
48
49 rate = clk_get_rate(sclk);
50 clk_set_rate(vclk, rate);
51}
52
53/*
54 * Switch the MPU rate if specified on cmdline. We cannot do this 37 * Switch the MPU rate if specified on cmdline. We cannot do this
55 * early until cmdline is parsed. XXX This should be removed from the 38 * early until cmdline is parsed. XXX This should be removed from the
56 * clock code and handled by the OPP layer code in the near future. 39 * clock code and handled by the OPP layer code in the near future.
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
index cb6df8ca9e4a..539dc08afbba 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -8,17 +8,34 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
10 10
11unsigned long omap2_table_mpu_recalc(struct clk *clk); 11#include <linux/clk-provider.h>
12int omap2_select_table_rate(struct clk *clk, unsigned long rate); 12#include "clock.h"
13long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); 13
14unsigned long omap2xxx_sys_clk_recalc(struct clk *clk); 14unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
15unsigned long omap2_osc_clk_recalc(struct clk *clk); 15 unsigned long parent_rate);
16unsigned long omap2_dpllcore_recalc(struct clk *clk); 16int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
17int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); 17 unsigned long parent_rate);
18unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); 18long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
19 unsigned long *parent_rate);
20unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
21 unsigned long parent_rate);
22unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
23 unsigned long parent_rate);
24unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
25 unsigned long parent_rate);
26int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
27 unsigned long parent_rate);
28void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
29unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
30 unsigned long parent_rate);
31unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
32 unsigned long parent_rate);
33unsigned long omap2xxx_clk_get_core_rate(void);
19u32 omap2xxx_get_apll_clkin(void); 34u32 omap2xxx_get_apll_clkin(void);
20u32 omap2xxx_get_sysclkdiv(void); 35u32 omap2xxx_get_sysclkdiv(void);
21void omap2xxx_clk_prepare_for_reboot(void); 36void omap2xxx_clk_prepare_for_reboot(void);
37void omap2xxx_clkt_vps_check_bootloader_rates(void);
38void omap2xxx_clkt_vps_late_init(void);
22 39
23#ifdef CONFIG_SOC_OMAP2420 40#ifdef CONFIG_SOC_OMAP2420
24int omap2420_clk_init(void); 41int omap2420_clk_init(void);
@@ -32,13 +49,14 @@ int omap2430_clk_init(void);
32#define omap2430_clk_init() do { } while(0) 49#define omap2430_clk_init() do { } while(0)
33#endif 50#endif
34 51
35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; 52extern void __iomem *prcm_clksrc_ctrl;
36 53
37extern struct clk *dclk; 54extern struct clk_hw *dclk_hw;
38 55int omap2_enable_osc_ck(struct clk_hw *hw);
39extern const struct clkops clkops_omap2430_i2chs_wait; 56void omap2_disable_osc_ck(struct clk_hw *hw);
40extern const struct clkops clkops_oscck; 57int omap2_clk_apll96_enable(struct clk_hw *hw);
41extern const struct clkops clkops_apll96; 58int omap2_clk_apll54_enable(struct clk_hw *hw);
42extern const struct clkops clkops_apll54; 59void omap2_clk_apll96_disable(struct clk_hw *hw);
60void omap2_clk_apll54_disable(struct clk_hw *hw);
43 61
44#endif 62#endif
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
deleted file mode 100644
index 88fa9494d5e9..000000000000
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ /dev/null
@@ -1,1112 +0,0 @@
1/*
2 * AM33XX Clock data
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk.h>
20#include <plat/clkdev_omap.h>
21
22#include "am33xx.h"
23#include "iomap.h"
24#include "control.h"
25#include "clock.h"
26#include "cm.h"
27#include "cm33xx.h"
28#include "cm-regbits-33xx.h"
29#include "prm.h"
30
31/* Maximum DPLL multiplier, divider values for AM33XX */
32#define AM33XX_MAX_DPLL_MULT 2047
33#define AM33XX_MAX_DPLL_DIV 128
34
35/* Modulemode control */
36#define AM33XX_MODULEMODE_HWCTRL 0
37#define AM33XX_MODULEMODE_SWCTRL 1
38
39/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
40 * physically present, in such a case HWMOD enabling of
41 * clock would be failure with default parent. And timer
42 * probe thinks clock is already enabled, this leads to
43 * crash upon accessing timer 3 & 6 registers in probe.
44 * Fix by setting parent of both these timers to master
45 * oscillator clock.
46 */
47static inline void am33xx_init_timer_parent(struct clk *clk)
48{
49 omap2_clksel_set_parent(clk, clk->parent);
50}
51
52/* Root clocks */
53
54/* RTC 32k */
55static struct clk clk_32768_ck = {
56 .name = "clk_32768_ck",
57 .clkdm_name = "l4_rtc_clkdm",
58 .rate = 32768,
59 .ops = &clkops_null,
60};
61
62/* On-Chip 32KHz RC OSC */
63static struct clk clk_rc32k_ck = {
64 .name = "clk_rc32k_ck",
65 .rate = 32000,
66 .ops = &clkops_null,
67};
68
69/* Crystal input clks */
70static struct clk virt_24000000_ck = {
71 .name = "virt_24000000_ck",
72 .rate = 24000000,
73 .ops = &clkops_null,
74};
75
76static struct clk virt_25000000_ck = {
77 .name = "virt_25000000_ck",
78 .rate = 25000000,
79 .ops = &clkops_null,
80};
81
82/* Oscillator clock */
83/* 19.2, 24, 25 or 26 MHz */
84static const struct clksel sys_clkin_sel[] = {
85 { .parent = &virt_19200000_ck, .rates = div_1_0_rates },
86 { .parent = &virt_24000000_ck, .rates = div_1_1_rates },
87 { .parent = &virt_25000000_ck, .rates = div_1_2_rates },
88 { .parent = &virt_26000000_ck, .rates = div_1_3_rates },
89 { .parent = NULL },
90};
91
92/* External clock - 12 MHz */
93static struct clk tclkin_ck = {
94 .name = "tclkin_ck",
95 .rate = 12000000,
96 .ops = &clkops_null,
97};
98
99/*
100 * sys_clk in: input to the dpll and also used as funtional clock for,
101 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
102 *
103 */
104static struct clk sys_clkin_ck = {
105 .name = "sys_clkin_ck",
106 .parent = &virt_24000000_ck,
107 .init = &omap2_init_clksel_parent,
108 .clksel_reg = AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
109 .clksel_mask = AM33XX_CONTROL_STATUS_SYSBOOT1_MASK,
110 .clksel = sys_clkin_sel,
111 .ops = &clkops_null,
112 .recalc = &omap2_clksel_recalc,
113};
114
115/* DPLL_CORE */
116static struct dpll_data dpll_core_dd = {
117 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
118 .clk_bypass = &sys_clkin_ck,
119 .clk_ref = &sys_clkin_ck,
120 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
121 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
122 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
123 .mult_mask = AM33XX_DPLL_MULT_MASK,
124 .div1_mask = AM33XX_DPLL_DIV_MASK,
125 .enable_mask = AM33XX_DPLL_EN_MASK,
126 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
127 .max_multiplier = AM33XX_MAX_DPLL_MULT,
128 .max_divider = AM33XX_MAX_DPLL_DIV,
129 .min_divider = 1,
130};
131
132/* CLKDCOLDO output */
133static struct clk dpll_core_ck = {
134 .name = "dpll_core_ck",
135 .parent = &sys_clkin_ck,
136 .dpll_data = &dpll_core_dd,
137 .init = &omap2_init_dpll_parent,
138 .ops = &clkops_omap3_core_dpll_ops,
139 .recalc = &omap3_dpll_recalc,
140};
141
142static struct clk dpll_core_x2_ck = {
143 .name = "dpll_core_x2_ck",
144 .parent = &dpll_core_ck,
145 .flags = CLOCK_CLKOUTX2,
146 .ops = &clkops_null,
147 .recalc = &omap3_clkoutx2_recalc,
148};
149
150
151static const struct clksel dpll_core_m4_div[] = {
152 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
153 { .parent = NULL },
154};
155
156static struct clk dpll_core_m4_ck = {
157 .name = "dpll_core_m4_ck",
158 .parent = &dpll_core_x2_ck,
159 .init = &omap2_init_clksel_parent,
160 .clksel = dpll_core_m4_div,
161 .clksel_reg = AM33XX_CM_DIV_M4_DPLL_CORE,
162 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK,
163 .ops = &clkops_null,
164 .recalc = &omap2_clksel_recalc,
165 .round_rate = &omap2_clksel_round_rate,
166 .set_rate = &omap2_clksel_set_rate,
167};
168
169static const struct clksel dpll_core_m5_div[] = {
170 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
171 { .parent = NULL },
172};
173
174static struct clk dpll_core_m5_ck = {
175 .name = "dpll_core_m5_ck",
176 .parent = &dpll_core_x2_ck,
177 .init = &omap2_init_clksel_parent,
178 .clksel = dpll_core_m5_div,
179 .clksel_reg = AM33XX_CM_DIV_M5_DPLL_CORE,
180 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK,
181 .ops = &clkops_null,
182 .recalc = &omap2_clksel_recalc,
183 .round_rate = &omap2_clksel_round_rate,
184 .set_rate = &omap2_clksel_set_rate,
185};
186
187static const struct clksel dpll_core_m6_div[] = {
188 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
189 { .parent = NULL },
190};
191
192static struct clk dpll_core_m6_ck = {
193 .name = "dpll_core_m6_ck",
194 .parent = &dpll_core_x2_ck,
195 .init = &omap2_init_clksel_parent,
196 .clksel = dpll_core_m6_div,
197 .clksel_reg = AM33XX_CM_DIV_M6_DPLL_CORE,
198 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK,
199 .ops = &clkops_null,
200 .recalc = &omap2_clksel_recalc,
201 .round_rate = &omap2_clksel_round_rate,
202 .set_rate = &omap2_clksel_set_rate,
203};
204
205/* DPLL_MPU */
206static struct dpll_data dpll_mpu_dd = {
207 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
208 .clk_bypass = &sys_clkin_ck,
209 .clk_ref = &sys_clkin_ck,
210 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
211 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
212 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
213 .mult_mask = AM33XX_DPLL_MULT_MASK,
214 .div1_mask = AM33XX_DPLL_DIV_MASK,
215 .enable_mask = AM33XX_DPLL_EN_MASK,
216 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
217 .max_multiplier = AM33XX_MAX_DPLL_MULT,
218 .max_divider = AM33XX_MAX_DPLL_DIV,
219 .min_divider = 1,
220};
221
222/* CLKOUT: fdpll/M2 */
223static struct clk dpll_mpu_ck = {
224 .name = "dpll_mpu_ck",
225 .parent = &sys_clkin_ck,
226 .dpll_data = &dpll_mpu_dd,
227 .init = &omap2_init_dpll_parent,
228 .ops = &clkops_omap3_noncore_dpll_ops,
229 .recalc = &omap3_dpll_recalc,
230 .round_rate = &omap2_dpll_round_rate,
231 .set_rate = &omap3_noncore_dpll_set_rate,
232};
233
234/*
235 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
236 * and ALT_CLK1/2)
237 */
238static const struct clksel dpll_mpu_m2_div[] = {
239 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
240 { .parent = NULL },
241};
242
243static struct clk dpll_mpu_m2_ck = {
244 .name = "dpll_mpu_m2_ck",
245 .clkdm_name = "mpu_clkdm",
246 .parent = &dpll_mpu_ck,
247 .clksel = dpll_mpu_m2_div,
248 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_MPU,
249 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
250 .ops = &clkops_null,
251 .recalc = &omap2_clksel_recalc,
252 .round_rate = &omap2_clksel_round_rate,
253 .set_rate = &omap2_clksel_set_rate,
254};
255
256/* DPLL_DDR */
257static struct dpll_data dpll_ddr_dd = {
258 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
259 .clk_bypass = &sys_clkin_ck,
260 .clk_ref = &sys_clkin_ck,
261 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
262 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
263 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
264 .mult_mask = AM33XX_DPLL_MULT_MASK,
265 .div1_mask = AM33XX_DPLL_DIV_MASK,
266 .enable_mask = AM33XX_DPLL_EN_MASK,
267 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
268 .max_multiplier = AM33XX_MAX_DPLL_MULT,
269 .max_divider = AM33XX_MAX_DPLL_DIV,
270 .min_divider = 1,
271};
272
273/* CLKOUT: fdpll/M2 */
274static struct clk dpll_ddr_ck = {
275 .name = "dpll_ddr_ck",
276 .parent = &sys_clkin_ck,
277 .dpll_data = &dpll_ddr_dd,
278 .init = &omap2_init_dpll_parent,
279 .ops = &clkops_null,
280 .recalc = &omap3_dpll_recalc,
281};
282
283/*
284 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
285 * and ALT_CLK1/2)
286 */
287static const struct clksel dpll_ddr_m2_div[] = {
288 { .parent = &dpll_ddr_ck, .rates = div31_1to31_rates },
289 { .parent = NULL },
290};
291
292static struct clk dpll_ddr_m2_ck = {
293 .name = "dpll_ddr_m2_ck",
294 .parent = &dpll_ddr_ck,
295 .clksel = dpll_ddr_m2_div,
296 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DDR,
297 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
298 .ops = &clkops_null,
299 .recalc = &omap2_clksel_recalc,
300 .round_rate = &omap2_clksel_round_rate,
301 .set_rate = &omap2_clksel_set_rate,
302};
303
304/* emif_fck functional clock */
305static struct clk dpll_ddr_m2_div2_ck = {
306 .name = "dpll_ddr_m2_div2_ck",
307 .clkdm_name = "l3_clkdm",
308 .parent = &dpll_ddr_m2_ck,
309 .ops = &clkops_null,
310 .fixed_div = 2,
311 .recalc = &omap_fixed_divisor_recalc,
312};
313
314/* DPLL_DISP */
315static struct dpll_data dpll_disp_dd = {
316 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
317 .clk_bypass = &sys_clkin_ck,
318 .clk_ref = &sys_clkin_ck,
319 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
320 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
321 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
322 .mult_mask = AM33XX_DPLL_MULT_MASK,
323 .div1_mask = AM33XX_DPLL_DIV_MASK,
324 .enable_mask = AM33XX_DPLL_EN_MASK,
325 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
326 .max_multiplier = AM33XX_MAX_DPLL_MULT,
327 .max_divider = AM33XX_MAX_DPLL_DIV,
328 .min_divider = 1,
329};
330
331/* CLKOUT: fdpll/M2 */
332static struct clk dpll_disp_ck = {
333 .name = "dpll_disp_ck",
334 .parent = &sys_clkin_ck,
335 .dpll_data = &dpll_disp_dd,
336 .init = &omap2_init_dpll_parent,
337 .ops = &clkops_null,
338 .recalc = &omap3_dpll_recalc,
339 .round_rate = &omap2_dpll_round_rate,
340 .set_rate = &omap3_noncore_dpll_set_rate,
341};
342
343/*
344 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
345 * and ALT_CLK1/2)
346 */
347static const struct clksel dpll_disp_m2_div[] = {
348 { .parent = &dpll_disp_ck, .rates = div31_1to31_rates },
349 { .parent = NULL },
350};
351
352static struct clk dpll_disp_m2_ck = {
353 .name = "dpll_disp_m2_ck",
354 .parent = &dpll_disp_ck,
355 .clksel = dpll_disp_m2_div,
356 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DISP,
357 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
358 .ops = &clkops_null,
359 .recalc = &omap2_clksel_recalc,
360 .round_rate = &omap2_clksel_round_rate,
361 .set_rate = &omap2_clksel_set_rate,
362};
363
364/* DPLL_PER */
365static struct dpll_data dpll_per_dd = {
366 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
367 .clk_bypass = &sys_clkin_ck,
368 .clk_ref = &sys_clkin_ck,
369 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
370 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
371 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
372 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
373 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
374 .enable_mask = AM33XX_DPLL_EN_MASK,
375 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
376 .max_multiplier = AM33XX_MAX_DPLL_MULT,
377 .max_divider = AM33XX_MAX_DPLL_DIV,
378 .min_divider = 1,
379 .flags = DPLL_J_TYPE,
380};
381
382/* CLKDCOLDO */
383static struct clk dpll_per_ck = {
384 .name = "dpll_per_ck",
385 .parent = &sys_clkin_ck,
386 .dpll_data = &dpll_per_dd,
387 .init = &omap2_init_dpll_parent,
388 .ops = &clkops_null,
389 .recalc = &omap3_dpll_recalc,
390 .round_rate = &omap2_dpll_round_rate,
391 .set_rate = &omap3_noncore_dpll_set_rate,
392};
393
394/* CLKOUT: fdpll/M2 */
395static const struct clksel dpll_per_m2_div[] = {
396 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
397 { .parent = NULL },
398};
399
400static struct clk dpll_per_m2_ck = {
401 .name = "dpll_per_m2_ck",
402 .parent = &dpll_per_ck,
403 .clksel = dpll_per_m2_div,
404 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_PER,
405 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
406 .ops = &clkops_null,
407 .recalc = &omap2_clksel_recalc,
408 .round_rate = &omap2_clksel_round_rate,
409 .set_rate = &omap2_clksel_set_rate,
410};
411
412static struct clk dpll_per_m2_div4_wkupdm_ck = {
413 .name = "dpll_per_m2_div4_wkupdm_ck",
414 .clkdm_name = "l4_wkup_clkdm",
415 .parent = &dpll_per_m2_ck,
416 .fixed_div = 4,
417 .ops = &clkops_null,
418 .recalc = &omap_fixed_divisor_recalc,
419};
420
421static struct clk dpll_per_m2_div4_ck = {
422 .name = "dpll_per_m2_div4_ck",
423 .clkdm_name = "l4ls_clkdm",
424 .parent = &dpll_per_m2_ck,
425 .fixed_div = 4,
426 .ops = &clkops_null,
427 .recalc = &omap_fixed_divisor_recalc,
428};
429
430static struct clk l3_gclk = {
431 .name = "l3_gclk",
432 .clkdm_name = "l3_clkdm",
433 .parent = &dpll_core_m4_ck,
434 .ops = &clkops_null,
435 .recalc = &followparent_recalc,
436};
437
438static struct clk dpll_core_m4_div2_ck = {
439 .name = "dpll_core_m4_div2_ck",
440 .clkdm_name = "l4_wkup_clkdm",
441 .parent = &dpll_core_m4_ck,
442 .ops = &clkops_null,
443 .fixed_div = 2,
444 .recalc = &omap_fixed_divisor_recalc,
445};
446
447static struct clk l4_rtc_gclk = {
448 .name = "l4_rtc_gclk",
449 .parent = &dpll_core_m4_ck,
450 .ops = &clkops_null,
451 .fixed_div = 2,
452 .recalc = &omap_fixed_divisor_recalc,
453};
454
455static struct clk clk_24mhz = {
456 .name = "clk_24mhz",
457 .parent = &dpll_per_m2_ck,
458 .fixed_div = 8,
459 .ops = &clkops_null,
460 .recalc = &omap_fixed_divisor_recalc,
461};
462
463/*
464 * Below clock nodes describes clockdomains derived out
465 * of core clock.
466 */
467static struct clk l4hs_gclk = {
468 .name = "l4hs_gclk",
469 .clkdm_name = "l4hs_clkdm",
470 .parent = &dpll_core_m4_ck,
471 .ops = &clkops_null,
472 .recalc = &followparent_recalc,
473};
474
475static struct clk l3s_gclk = {
476 .name = "l3s_gclk",
477 .clkdm_name = "l3s_clkdm",
478 .parent = &dpll_core_m4_div2_ck,
479 .ops = &clkops_null,
480 .recalc = &followparent_recalc,
481};
482
483static struct clk l4fw_gclk = {
484 .name = "l4fw_gclk",
485 .clkdm_name = "l4fw_clkdm",
486 .parent = &dpll_core_m4_div2_ck,
487 .ops = &clkops_null,
488 .recalc = &followparent_recalc,
489};
490
491static struct clk l4ls_gclk = {
492 .name = "l4ls_gclk",
493 .clkdm_name = "l4ls_clkdm",
494 .parent = &dpll_core_m4_div2_ck,
495 .ops = &clkops_null,
496 .recalc = &followparent_recalc,
497};
498
499static struct clk sysclk_div_ck = {
500 .name = "sysclk_div_ck",
501 .parent = &dpll_core_m4_ck,
502 .ops = &clkops_null,
503 .recalc = &followparent_recalc,
504};
505
506/*
507 * In order to match the clock domain with hwmod clockdomain entry,
508 * separate clock nodes is required for the modules which are
509 * directly getting their funtioncal clock from sys_clkin.
510 */
511static struct clk adc_tsc_fck = {
512 .name = "adc_tsc_fck",
513 .clkdm_name = "l4_wkup_clkdm",
514 .parent = &sys_clkin_ck,
515 .ops = &clkops_null,
516 .recalc = &followparent_recalc,
517};
518
519static struct clk dcan0_fck = {
520 .name = "dcan0_fck",
521 .clkdm_name = "l4ls_clkdm",
522 .parent = &sys_clkin_ck,
523 .ops = &clkops_null,
524 .recalc = &followparent_recalc,
525};
526
527static struct clk dcan1_fck = {
528 .name = "dcan1_fck",
529 .clkdm_name = "l4ls_clkdm",
530 .parent = &sys_clkin_ck,
531 .ops = &clkops_null,
532 .recalc = &followparent_recalc,
533};
534
535static struct clk mcasp0_fck = {
536 .name = "mcasp0_fck",
537 .clkdm_name = "l3s_clkdm",
538 .parent = &sys_clkin_ck,
539 .ops = &clkops_null,
540 .recalc = &followparent_recalc,
541};
542
543static struct clk mcasp1_fck = {
544 .name = "mcasp1_fck",
545 .clkdm_name = "l3s_clkdm",
546 .parent = &sys_clkin_ck,
547 .ops = &clkops_null,
548 .recalc = &followparent_recalc,
549};
550
551static struct clk smartreflex_mpu_fck = {
552 .name = "smartreflex_mpu_fck",
553 .clkdm_name = "l4_wkup_clkdm",
554 .parent = &sys_clkin_ck,
555 .ops = &clkops_null,
556 .recalc = &followparent_recalc,
557};
558
559static struct clk smartreflex_core_fck = {
560 .name = "smartreflex_core_fck",
561 .clkdm_name = "l4_wkup_clkdm",
562 .parent = &sys_clkin_ck,
563 .ops = &clkops_null,
564 .recalc = &followparent_recalc,
565};
566
567/*
568 * Modules clock nodes
569 *
570 * The following clock leaf nodes are added for the moment because:
571 *
572 * - hwmod data is not present for these modules, either hwmod
573 * control is not required or its not populated.
574 * - Driver code is not yet migrated to use hwmod/runtime pm
575 * - Modules outside kernel access (to disable them by default)
576 *
577 * - debugss
578 * - mmu (gfx domain)
579 * - cefuse
580 * - usbotg_fck (its additional clock and not really a modulemode)
581 * - ieee5000
582 */
583static struct clk debugss_ick = {
584 .name = "debugss_ick",
585 .clkdm_name = "l3_aon_clkdm",
586 .parent = &dpll_core_m4_ck,
587 .ops = &clkops_omap2_dflt,
588 .enable_reg = AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
589 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
590 .recalc = &followparent_recalc,
591};
592
593static struct clk mmu_fck = {
594 .name = "mmu_fck",
595 .clkdm_name = "gfx_l3_clkdm",
596 .parent = &dpll_core_m4_ck,
597 .ops = &clkops_omap2_dflt,
598 .enable_reg = AM33XX_CM_GFX_MMUDATA_CLKCTRL,
599 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
600 .recalc = &followparent_recalc,
601};
602
603static struct clk cefuse_fck = {
604 .name = "cefuse_fck",
605 .clkdm_name = "l4_cefuse_clkdm",
606 .parent = &sys_clkin_ck,
607 .enable_reg = AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL,
608 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
609 .ops = &clkops_omap2_dflt,
610 .recalc = &followparent_recalc,
611};
612
613/*
614 * clkdiv32 is generated from fixed division of 732.4219
615 */
616static struct clk clkdiv32k_ick = {
617 .name = "clkdiv32k_ick",
618 .clkdm_name = "clk_24mhz_clkdm",
619 .rate = 32768,
620 .parent = &clk_24mhz,
621 .enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
622 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
623 .ops = &clkops_omap2_dflt,
624};
625
626static struct clk usbotg_fck = {
627 .name = "usbotg_fck",
628 .clkdm_name = "l3s_clkdm",
629 .parent = &dpll_per_ck,
630 .enable_reg = AM33XX_CM_CLKDCOLDO_DPLL_PER,
631 .enable_bit = AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
632 .ops = &clkops_omap2_dflt,
633 .recalc = &followparent_recalc,
634};
635
636static struct clk ieee5000_fck = {
637 .name = "ieee5000_fck",
638 .clkdm_name = "l3s_clkdm",
639 .parent = &dpll_core_m4_div2_ck,
640 .enable_reg = AM33XX_CM_PER_IEEE5000_CLKCTRL,
641 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
642 .ops = &clkops_omap2_dflt,
643 .recalc = &followparent_recalc,
644};
645
646/* Timers */
647static const struct clksel timer1_clkmux_sel[] = {
648 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
649 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
650 { .parent = &tclkin_ck, .rates = div_1_2_rates },
651 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
652 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
653 { .parent = NULL },
654};
655
656static struct clk timer1_fck = {
657 .name = "timer1_fck",
658 .clkdm_name = "l4ls_clkdm",
659 .parent = &sys_clkin_ck,
660 .init = &omap2_init_clksel_parent,
661 .clksel = timer1_clkmux_sel,
662 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
663 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
664 .ops = &clkops_null,
665 .recalc = &omap2_clksel_recalc,
666};
667
668static const struct clksel timer2_to_7_clk_sel[] = {
669 { .parent = &tclkin_ck, .rates = div_1_0_rates },
670 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
671 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
672 { .parent = NULL },
673};
674
675static struct clk timer2_fck = {
676 .name = "timer2_fck",
677 .clkdm_name = "l4ls_clkdm",
678 .parent = &sys_clkin_ck,
679 .init = &omap2_init_clksel_parent,
680 .clksel = timer2_to_7_clk_sel,
681 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
682 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
683 .ops = &clkops_null,
684 .recalc = &omap2_clksel_recalc,
685};
686
687static struct clk timer3_fck = {
688 .name = "timer3_fck",
689 .clkdm_name = "l4ls_clkdm",
690 .parent = &sys_clkin_ck,
691 .init = &am33xx_init_timer_parent,
692 .clksel = timer2_to_7_clk_sel,
693 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
694 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
695 .ops = &clkops_null,
696 .recalc = &omap2_clksel_recalc,
697};
698
699static struct clk timer4_fck = {
700 .name = "timer4_fck",
701 .clkdm_name = "l4ls_clkdm",
702 .parent = &sys_clkin_ck,
703 .init = &omap2_init_clksel_parent,
704 .clksel = timer2_to_7_clk_sel,
705 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
706 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
707 .ops = &clkops_null,
708 .recalc = &omap2_clksel_recalc,
709};
710
711static struct clk timer5_fck = {
712 .name = "timer5_fck",
713 .clkdm_name = "l4ls_clkdm",
714 .parent = &sys_clkin_ck,
715 .init = &omap2_init_clksel_parent,
716 .clksel = timer2_to_7_clk_sel,
717 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
718 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
719 .ops = &clkops_null,
720 .recalc = &omap2_clksel_recalc,
721};
722
723static struct clk timer6_fck = {
724 .name = "timer6_fck",
725 .clkdm_name = "l4ls_clkdm",
726 .parent = &sys_clkin_ck,
727 .init = &am33xx_init_timer_parent,
728 .clksel = timer2_to_7_clk_sel,
729 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
730 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
731 .ops = &clkops_null,
732 .recalc = &omap2_clksel_recalc,
733};
734
735static struct clk timer7_fck = {
736 .name = "timer7_fck",
737 .clkdm_name = "l4ls_clkdm",
738 .parent = &sys_clkin_ck,
739 .init = &omap2_init_clksel_parent,
740 .clksel = timer2_to_7_clk_sel,
741 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
742 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
743 .ops = &clkops_null,
744 .recalc = &omap2_clksel_recalc,
745};
746
747static struct clk cpsw_125mhz_gclk = {
748 .name = "cpsw_125mhz_gclk",
749 .clkdm_name = "cpsw_125mhz_clkdm",
750 .parent = &dpll_core_m5_ck,
751 .ops = &clkops_null,
752 .fixed_div = 2,
753 .recalc = &omap_fixed_divisor_recalc,
754};
755
756static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
757 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
758 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
759 { .parent = NULL },
760};
761
762static struct clk cpsw_cpts_rft_clk = {
763 .name = "cpsw_cpts_rft_clk",
764 .clkdm_name = "cpsw_125mhz_clkdm",
765 .parent = &dpll_core_m5_ck,
766 .clksel = cpsw_cpts_rft_clkmux_sel,
767 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
768 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
769 .ops = &clkops_null,
770 .recalc = &followparent_recalc,
771};
772
773/* gpio */
774static const struct clksel gpio0_dbclk_mux_sel[] = {
775 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
776 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
777 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
778 { .parent = NULL },
779};
780
781static struct clk gpio0_dbclk_mux_ck = {
782 .name = "gpio0_dbclk_mux_ck",
783 .clkdm_name = "l4_wkup_clkdm",
784 .parent = &clk_rc32k_ck,
785 .init = &omap2_init_clksel_parent,
786 .clksel = gpio0_dbclk_mux_sel,
787 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
788 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
789 .ops = &clkops_null,
790 .recalc = &omap2_clksel_recalc,
791};
792
793static struct clk gpio0_dbclk = {
794 .name = "gpio0_dbclk",
795 .clkdm_name = "l4_wkup_clkdm",
796 .parent = &gpio0_dbclk_mux_ck,
797 .enable_reg = AM33XX_CM_WKUP_GPIO0_CLKCTRL,
798 .enable_bit = AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT,
799 .ops = &clkops_omap2_dflt,
800 .recalc = &followparent_recalc,
801};
802
803static struct clk gpio1_dbclk = {
804 .name = "gpio1_dbclk",
805 .clkdm_name = "l4ls_clkdm",
806 .parent = &clkdiv32k_ick,
807 .enable_reg = AM33XX_CM_PER_GPIO1_CLKCTRL,
808 .enable_bit = AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT,
809 .ops = &clkops_omap2_dflt,
810 .recalc = &followparent_recalc,
811};
812
813static struct clk gpio2_dbclk = {
814 .name = "gpio2_dbclk",
815 .clkdm_name = "l4ls_clkdm",
816 .parent = &clkdiv32k_ick,
817 .enable_reg = AM33XX_CM_PER_GPIO2_CLKCTRL,
818 .enable_bit = AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT,
819 .ops = &clkops_omap2_dflt,
820 .recalc = &followparent_recalc,
821};
822
823static struct clk gpio3_dbclk = {
824 .name = "gpio3_dbclk",
825 .clkdm_name = "l4ls_clkdm",
826 .parent = &clkdiv32k_ick,
827 .enable_reg = AM33XX_CM_PER_GPIO3_CLKCTRL,
828 .enable_bit = AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT,
829 .ops = &clkops_omap2_dflt,
830 .recalc = &followparent_recalc,
831};
832
833static const struct clksel pruss_ocp_clk_mux_sel[] = {
834 { .parent = &l3_gclk, .rates = div_1_0_rates },
835 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
836 { .parent = NULL },
837};
838
839static struct clk pruss_ocp_gclk = {
840 .name = "pruss_ocp_gclk",
841 .clkdm_name = "pruss_ocp_clkdm",
842 .parent = &l3_gclk,
843 .init = &omap2_init_clksel_parent,
844 .clksel = pruss_ocp_clk_mux_sel,
845 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
846 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
847 .ops = &clkops_null,
848 .recalc = &followparent_recalc,
849};
850
851static const struct clksel lcd_clk_mux_sel[] = {
852 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
853 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
854 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
855 { .parent = NULL },
856};
857
858static struct clk lcd_gclk = {
859 .name = "lcd_gclk",
860 .clkdm_name = "lcdc_clkdm",
861 .parent = &dpll_disp_m2_ck,
862 .init = &omap2_init_clksel_parent,
863 .clksel = lcd_clk_mux_sel,
864 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
865 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
866 .ops = &clkops_null,
867 .recalc = &followparent_recalc,
868};
869
870static struct clk mmc_clk = {
871 .name = "mmc_clk",
872 .clkdm_name = "l4ls_clkdm",
873 .parent = &dpll_per_m2_ck,
874 .ops = &clkops_null,
875 .fixed_div = 2,
876 .recalc = &omap_fixed_divisor_recalc,
877};
878
879static struct clk mmc2_fck = {
880 .name = "mmc2_fck",
881 .clkdm_name = "l3s_clkdm",
882 .parent = &mmc_clk,
883 .ops = &clkops_null,
884 .recalc = &followparent_recalc,
885};
886
887static const struct clksel gfx_clksel_sel[] = {
888 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
889 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
890 { .parent = NULL },
891};
892
893static struct clk gfx_fclk_clksel_ck = {
894 .name = "gfx_fclk_clksel_ck",
895 .parent = &dpll_core_m4_ck,
896 .clksel = gfx_clksel_sel,
897 .ops = &clkops_null,
898 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
899 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
900 .recalc = &omap2_clksel_recalc,
901};
902
903static const struct clksel_rate div_1_0_2_1_rates[] = {
904 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
905 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
906 { .div = 0 },
907};
908
909static const struct clksel gfx_div_sel[] = {
910 { .parent = &gfx_fclk_clksel_ck, .rates = div_1_0_2_1_rates },
911 { .parent = NULL },
912};
913
914static struct clk gfx_fck_div_ck = {
915 .name = "gfx_fck_div_ck",
916 .clkdm_name = "gfx_l3_clkdm",
917 .parent = &gfx_fclk_clksel_ck,
918 .init = &omap2_init_clksel_parent,
919 .clksel = gfx_div_sel,
920 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
921 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
922 .recalc = &omap2_clksel_recalc,
923 .round_rate = &omap2_clksel_round_rate,
924 .set_rate = &omap2_clksel_set_rate,
925 .ops = &clkops_null,
926};
927
928static const struct clksel sysclkout_pre_sel[] = {
929 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
930 { .parent = &l3_gclk, .rates = div_1_1_rates },
931 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
932 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
933 { .parent = &lcd_gclk, .rates = div_1_4_rates },
934 { .parent = NULL },
935};
936
937static struct clk sysclkout_pre_ck = {
938 .name = "sysclkout_pre_ck",
939 .parent = &clk_32768_ck,
940 .init = &omap2_init_clksel_parent,
941 .clksel = sysclkout_pre_sel,
942 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
943 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
944 .ops = &clkops_null,
945 .recalc = &omap2_clksel_recalc,
946};
947
948/* Divide by 8 clock rates with default clock is 1/1*/
949static const struct clksel_rate div8_rates[] = {
950 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
951 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
952 { .div = 3, .val = 2, .flags = RATE_IN_AM33XX },
953 { .div = 4, .val = 3, .flags = RATE_IN_AM33XX },
954 { .div = 5, .val = 4, .flags = RATE_IN_AM33XX },
955 { .div = 6, .val = 5, .flags = RATE_IN_AM33XX },
956 { .div = 7, .val = 6, .flags = RATE_IN_AM33XX },
957 { .div = 8, .val = 7, .flags = RATE_IN_AM33XX },
958 { .div = 0 },
959};
960
961static const struct clksel clkout2_div[] = {
962 { .parent = &sysclkout_pre_ck, .rates = div8_rates },
963 { .parent = NULL },
964};
965
966static struct clk clkout2_ck = {
967 .name = "clkout2_ck",
968 .parent = &sysclkout_pre_ck,
969 .ops = &clkops_omap2_dflt,
970 .clksel = clkout2_div,
971 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
972 .clksel_mask = AM33XX_CLKOUT2DIV_MASK,
973 .enable_reg = AM33XX_CM_CLKOUT_CTRL,
974 .enable_bit = AM33XX_CLKOUT2EN_SHIFT,
975 .recalc = &omap2_clksel_recalc,
976 .round_rate = &omap2_clksel_round_rate,
977 .set_rate = &omap2_clksel_set_rate,
978};
979
980static const struct clksel wdt_clkmux_sel[] = {
981 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
982 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
983 { .parent = NULL },
984};
985
986static struct clk wdt1_fck = {
987 .name = "wdt1_fck",
988 .clkdm_name = "l4_wkup_clkdm",
989 .parent = &clk_rc32k_ck,
990 .init = &omap2_init_clksel_parent,
991 .clksel = wdt_clkmux_sel,
992 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
993 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
994 .ops = &clkops_null,
995 .recalc = &omap2_clksel_recalc,
996};
997
998/*
999 * clkdev
1000 */
1001static struct omap_clk am33xx_clks[] = {
1002 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
1003 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
1004 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
1005 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
1006 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
1007 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
1008 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
1009 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
1010 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
1011 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
1012 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
1013 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
1014 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
1015 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
1016 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
1017 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
1018 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
1019 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
1020 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
1021 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
1022 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
1023 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
1024 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
1025 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
1026 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
1027 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
1028 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
1029 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
1030 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
1031 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
1032 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
1033 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
1034 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
1035 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
1036 CLK("davinci-mcasp.0", NULL, &mcasp0_fck, CK_AM33XX),
1037 CLK("davinci-mcasp.1", NULL, &mcasp1_fck, CK_AM33XX),
1038 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
1039 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
1040 CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX),
1041 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
1042 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_AM33XX),
1043 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_AM33XX),
1044 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
1045 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
1046 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
1047 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
1048 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
1049 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
1050 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
1051 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
1052 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
1053 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
1054 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
1055 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
1056 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
1057 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
1058 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
1059 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
1060 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
1061 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
1062 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
1063 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
1064 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
1065 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
1066 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
1067 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
1068 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
1069 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
1070 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
1071 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
1072 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
1073 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
1074 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
1075 CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX),
1076 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
1077 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
1078};
1079
1080int __init am33xx_clk_init(void)
1081{
1082 struct omap_clk *c;
1083 u32 cpu_clkflg;
1084
1085 if (soc_is_am33xx()) {
1086 cpu_mask = RATE_IN_AM33XX;
1087 cpu_clkflg = CK_AM33XX;
1088 }
1089
1090 clk_init(&omap2_clk_functions);
1091
1092 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
1093 clk_preinit(c->lk.clk);
1094
1095 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
1096 if (c->cpu & cpu_clkflg) {
1097 clkdev_add(&c->lk);
1098 clk_register(c->lk.clk);
1099 omap2_init_clk_clkdm(c->lk.clk);
1100 }
1101 }
1102
1103 recalculate_root_clocks();
1104
1105 /*
1106 * Only enable those clocks we will need, let the drivers
1107 * enable other clocks as necessary
1108 */
1109 clk_enable_init_clocks();
1110
1111 return 0;
1112}
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 1fc96b9ee330..4596468e50ab 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -21,11 +21,9 @@
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 "cm3xxx.h"
29#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
30 28
31/** 29/**
@@ -39,7 +37,7 @@
39 * from the CM_{I,F}CLKEN bit. Pass back the correct info via 37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
40 * @idlest_reg and @idlest_bit. No return value. 38 * @idlest_reg and @idlest_bit. No return value.
41 */ 39 */
42static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, 40static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
43 void __iomem **idlest_reg, 41 void __iomem **idlest_reg,
44 u8 *idlest_bit, 42 u8 *idlest_bit,
45 u8 *idlest_val) 43 u8 *idlest_val)
@@ -51,21 +49,16 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
51 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; 49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
52 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 50 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
53} 51}
54 52const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
55const struct clkops clkops_omap3430es2_ssi_wait = {
56 .enable = omap2_dflt_clk_enable,
57 .disable = omap2_dflt_clk_disable,
58 .find_idlest = omap3430es2_clk_ssi_find_idlest, 53 .find_idlest = omap3430es2_clk_ssi_find_idlest,
59 .find_companion = omap2_clk_dflt_find_companion, 54 .find_companion = omap2_clk_dflt_find_companion,
60}; 55};
61 56
62const struct clkops clkops_omap3430es2_iclk_ssi_wait = { 57const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .find_idlest = omap3430es2_clk_ssi_find_idlest,
66 .find_companion = omap2_clk_dflt_find_companion,
67 .allow_idle = omap2_clkt_iclk_allow_idle, 58 .allow_idle = omap2_clkt_iclk_allow_idle,
68 .deny_idle = omap2_clkt_iclk_deny_idle, 59 .deny_idle = omap2_clkt_iclk_deny_idle,
60 .find_idlest = omap3430es2_clk_ssi_find_idlest,
61 .find_companion = omap2_clk_dflt_find_companion,
69}; 62};
70 63
71/** 64/**
@@ -82,7 +75,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
82 * default find_idlest code assumes that they are at the same 75 * default find_idlest code assumes that they are at the same
83 * position.) No return value. 76 * position.) No return value.
84 */ 77 */
85static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, 78static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
86 void __iomem **idlest_reg, 79 void __iomem **idlest_reg,
87 u8 *idlest_bit, 80 u8 *idlest_bit,
88 u8 *idlest_val) 81 u8 *idlest_val)
@@ -96,20 +89,16 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
96 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 89 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
97} 90}
98 91
99const struct clkops clkops_omap3430es2_dss_usbhost_wait = { 92const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
100 .enable = omap2_dflt_clk_enable,
101 .disable = omap2_dflt_clk_disable,
102 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest, 93 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
103 .find_companion = omap2_clk_dflt_find_companion, 94 .find_companion = omap2_clk_dflt_find_companion,
104}; 95};
105 96
106const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = { 97const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
107 .enable = omap2_dflt_clk_enable,
108 .disable = omap2_dflt_clk_disable,
109 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
110 .find_companion = omap2_clk_dflt_find_companion,
111 .allow_idle = omap2_clkt_iclk_allow_idle, 98 .allow_idle = omap2_clkt_iclk_allow_idle,
112 .deny_idle = omap2_clkt_iclk_deny_idle, 99 .deny_idle = omap2_clkt_iclk_deny_idle,
100 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
101 .find_companion = omap2_clk_dflt_find_companion,
113}; 102};
114 103
115/** 104/**
@@ -123,7 +112,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
123 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via 112 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
124 * @idlest_reg and @idlest_bit. No return value. 113 * @idlest_reg and @idlest_bit. No return value.
125 */ 114 */
126static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, 115static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
127 void __iomem **idlest_reg, 116 void __iomem **idlest_reg,
128 u8 *idlest_bit, 117 u8 *idlest_bit,
129 u8 *idlest_val) 118 u8 *idlest_val)
@@ -136,18 +125,14 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
136 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 125 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
137} 126}
138 127
139const struct clkops clkops_omap3430es2_hsotgusb_wait = { 128const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
140 .enable = omap2_dflt_clk_enable, 129 .allow_idle = omap2_clkt_iclk_allow_idle,
141 .disable = omap2_dflt_clk_disable, 130 .deny_idle = omap2_clkt_iclk_deny_idle,
142 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 131 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
143 .find_companion = omap2_clk_dflt_find_companion, 132 .find_companion = omap2_clk_dflt_find_companion,
144}; 133};
145 134
146const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = { 135const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
147 .enable = omap2_dflt_clk_enable,
148 .disable = omap2_dflt_clk_disable,
149 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 136 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
150 .find_companion = omap2_clk_dflt_find_companion, 137 .find_companion = omap2_clk_dflt_find_companion,
151 .allow_idle = omap2_clkt_iclk_allow_idle,
152 .deny_idle = omap2_clkt_iclk_deny_idle,
153}; 138};
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 2e97d08f0e56..4d79ae2c0241 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -21,11 +21,9 @@
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 "cm3xxx.h"
29#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
30 28
31/* 29/*
@@ -49,7 +47,7 @@
49 * in the enable register itsel at a bit offset of 4 from the enable 47 * in the enable register itsel at a bit offset of 4 from the enable
50 * bit. A value of 1 indicates that clock is enabled. 48 * bit. A value of 1 indicates that clock is enabled.
51 */ 49 */
52static void am35xx_clk_find_idlest(struct clk *clk, 50static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
53 void __iomem **idlest_reg, 51 void __iomem **idlest_reg,
54 u8 *idlest_bit, 52 u8 *idlest_bit,
55 u8 *idlest_val) 53 u8 *idlest_val)
@@ -73,8 +71,9 @@ static void am35xx_clk_find_idlest(struct clk *clk,
73 * associate this type of code with per-module data structures to 71 * associate this type of code with per-module data structures to
74 * avoid this issue, and remove the casts. No return value. 72 * avoid this issue, and remove the casts. No return value.
75 */ 73 */
76static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, 74static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
77 u8 *other_bit) 75 void __iomem **other_reg,
76 u8 *other_bit)
78{ 77{
79 *other_reg = (__force void __iomem *)(clk->enable_reg); 78 *other_reg = (__force void __iomem *)(clk->enable_reg);
80 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK) 79 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
@@ -82,10 +81,7 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg,
82 else 81 else
83 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; 82 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
84} 83}
85 84const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
86const struct clkops clkops_am35xx_ipss_module_wait = {
87 .enable = omap2_dflt_clk_enable,
88 .disable = omap2_dflt_clk_disable,
89 .find_idlest = am35xx_clk_find_idlest, 85 .find_idlest = am35xx_clk_find_idlest,
90 .find_companion = am35xx_clk_find_companion, 86 .find_companion = am35xx_clk_find_companion,
91}; 87};
@@ -101,7 +97,7 @@ const struct clkops clkops_am35xx_ipss_module_wait = {
101 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg 97 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
102 * and @idlest_bit. No return value. 98 * and @idlest_bit. No return value.
103 */ 99 */
104static void am35xx_clk_ipss_find_idlest(struct clk *clk, 100static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
105 void __iomem **idlest_reg, 101 void __iomem **idlest_reg,
106 u8 *idlest_bit, 102 u8 *idlest_bit,
107 u8 *idlest_val) 103 u8 *idlest_val)
@@ -114,13 +110,9 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk,
114 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 110 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
115} 111}
116 112
117const struct clkops clkops_am35xx_ipss_wait = { 113const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
118 .enable = omap2_dflt_clk_enable,
119 .disable = omap2_dflt_clk_disable,
120 .find_idlest = am35xx_clk_ipss_find_idlest,
121 .find_companion = omap2_clk_dflt_find_companion,
122 .allow_idle = omap2_clkt_iclk_allow_idle, 114 .allow_idle = omap2_clkt_iclk_allow_idle,
123 .deny_idle = omap2_clkt_iclk_deny_idle, 115 .deny_idle = omap2_clkt_iclk_deny_idle,
116 .find_idlest = am35xx_clk_ipss_find_idlest,
117 .find_companion = omap2_clk_dflt_find_companion,
124}; 118};
125
126
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 0c5e25ed8879..8f3bf4e50908 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
@@ -39,34 +37,32 @@
39 * (Any other value different from the Read value) to the 37 * (Any other value different from the Read value) to the
40 * corresponding CM_CLKSEL register will refresh the dividers. 38 * corresponding CM_CLKSEL register will refresh the dividers.
41 */ 39 */
42static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk) 40int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
43{ 41{
42 struct clk_hw_omap *parent;
43 struct clk_hw *parent_hw;
44 u32 dummy_v, orig_v, clksel_shift; 44 u32 dummy_v, orig_v, clksel_shift;
45 int ret; 45 int ret;
46 46
47 /* Clear PWRDN bit of HSDIVIDER */ 47 /* Clear PWRDN bit of HSDIVIDER */
48 ret = omap2_dflt_clk_enable(clk); 48 ret = omap2_dflt_clk_enable(clk);
49 49
50 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
51 parent = to_clk_hw_omap(parent_hw);
52
50 /* Restore the dividers */ 53 /* Restore the dividers */
51 if (!ret) { 54 if (!ret) {
52 clksel_shift = __ffs(clk->parent->clksel_mask); 55 clksel_shift = __ffs(parent->clksel_mask);
53 orig_v = __raw_readl(clk->parent->clksel_reg); 56 orig_v = __raw_readl(parent->clksel_reg);
54 dummy_v = orig_v; 57 dummy_v = orig_v;
55 58
56 /* Write any other value different from the Read value */ 59 /* Write any other value different from the Read value */
57 dummy_v ^= (1 << clksel_shift); 60 dummy_v ^= (1 << clksel_shift);
58 __raw_writel(dummy_v, clk->parent->clksel_reg); 61 __raw_writel(dummy_v, parent->clksel_reg);
59 62
60 /* Write the original divider */ 63 /* Write the original divider */
61 __raw_writel(orig_v, clk->parent->clksel_reg); 64 __raw_writel(orig_v, parent->clksel_reg);
62 } 65 }
63 66
64 return ret; 67 return ret;
65} 68}
66
67const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = {
68 .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
69 .disable = omap2_dflt_clk_disable,
70 .find_companion = omap2_clk_dflt_find_companion,
71 .find_idlest = omap2_clk_dflt_find_idlest,
72};
diff --git a/arch/arm/mach-omap2/clock36xx.h b/arch/arm/mach-omap2/clock36xx.h
index a7dee5bc6364..945bb7f083e9 100644
--- a/arch/arm/mach-omap2/clock36xx.h
+++ b/arch/arm/mach-omap2/clock36xx.h
@@ -8,6 +8,6 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
10 10
11extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; 11extern int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *hw);
12 12
13#endif 13#endif
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 83bb01427d40..4eacab8f1176 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"
@@ -40,8 +38,8 @@
40 38
41/* needed by omap3_core_dpll_m2_set_rate() */ 39/* needed by omap3_core_dpll_m2_set_rate() */
42struct clk *sdrc_ick_p, *arm_fck_p; 40struct clk *sdrc_ick_p, *arm_fck_p;
43 41int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
44int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) 42 unsigned long parent_rate)
45{ 43{
46 /* 44 /*
47 * According to the 12-5 CDP code from TI, "Limitation 2.5" 45 * According to the 12-5 CDP code from TI, "Limitation 2.5"
@@ -53,7 +51,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
53 return -EINVAL; 51 return -EINVAL;
54 } 52 }
55 53
56 return omap3_noncore_dpll_set_rate(clk, rate); 54 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
57} 55}
58 56
59void __init omap3_clk_lock_dpll5(void) 57void __init omap3_clk_lock_dpll5(void)
diff --git a/arch/arm/mach-omap2/clock3xxx.h b/arch/arm/mach-omap2/clock3xxx.h
index 8bbeeaf399e2..8cd4b0a882ae 100644
--- a/arch/arm/mach-omap2/clock3xxx.h
+++ b/arch/arm/mach-omap2/clock3xxx.h
@@ -9,8 +9,10 @@
9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H
10 10
11int omap3xxx_clk_init(void); 11int omap3xxx_clk_init(void);
12int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate); 12int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
13int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate); 13 unsigned long parent_rate);
14int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
15 unsigned long parent_rate);
14void omap3_clk_lock_dpll5(void); 16void omap3_clk_lock_dpll5(void);
15 17
16extern struct clk *sdrc_ick_p; 18extern struct clk *sdrc_ick_p;
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
deleted file mode 100644
index d1786fca6919..000000000000
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ /dev/null
@@ -1,3617 +0,0 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
17 */
18
19#include <linux/kernel.h>
20#include <linux/clk.h>
21#include <linux/list.h>
22#include <linux/io.h>
23
24#include <plat/clkdev_omap.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "clock.h"
29#include "clock3xxx.h"
30#include "clock34xx.h"
31#include "clock36xx.h"
32#include "clock3517.h"
33#include "cm2xxx_3xxx.h"
34#include "cm-regbits-34xx.h"
35#include "prm2xxx_3xxx.h"
36#include "prm-regbits-34xx.h"
37#include "control.h"
38
39/*
40 * clocks
41 */
42
43#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
44
45/* Maximum DPLL multiplier, divider values for OMAP3 */
46#define OMAP3_MAX_DPLL_MULT 2047
47#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
48#define OMAP3_MAX_DPLL_DIV 128
49
50/*
51 * DPLL1 supplies clock to the MPU.
52 * DPLL2 supplies clock to the IVA2.
53 * DPLL3 supplies CORE domain clocks.
54 * DPLL4 supplies peripheral clocks.
55 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
56 */
57
58/* Forward declarations for DPLL bypass clocks */
59static struct clk dpll1_fck;
60static struct clk dpll2_fck;
61
62/* PRM CLOCKS */
63
64/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
65static struct clk omap_32k_fck = {
66 .name = "omap_32k_fck",
67 .ops = &clkops_null,
68 .rate = 32768,
69};
70
71static struct clk secure_32k_fck = {
72 .name = "secure_32k_fck",
73 .ops = &clkops_null,
74 .rate = 32768,
75};
76
77/* Virtual source clocks for osc_sys_ck */
78static struct clk virt_12m_ck = {
79 .name = "virt_12m_ck",
80 .ops = &clkops_null,
81 .rate = 12000000,
82};
83
84static struct clk virt_13m_ck = {
85 .name = "virt_13m_ck",
86 .ops = &clkops_null,
87 .rate = 13000000,
88};
89
90static struct clk virt_16_8m_ck = {
91 .name = "virt_16_8m_ck",
92 .ops = &clkops_null,
93 .rate = 16800000,
94};
95
96static struct clk virt_38_4m_ck = {
97 .name = "virt_38_4m_ck",
98 .ops = &clkops_null,
99 .rate = 38400000,
100};
101
102static const struct clksel_rate osc_sys_12m_rates[] = {
103 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
104 { .div = 0 }
105};
106
107static const struct clksel_rate osc_sys_13m_rates[] = {
108 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
109 { .div = 0 }
110};
111
112static const struct clksel_rate osc_sys_16_8m_rates[] = {
113 { .div = 1, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
114 { .div = 0 }
115};
116
117static const struct clksel_rate osc_sys_19_2m_rates[] = {
118 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
119 { .div = 0 }
120};
121
122static const struct clksel_rate osc_sys_26m_rates[] = {
123 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
124 { .div = 0 }
125};
126
127static const struct clksel_rate osc_sys_38_4m_rates[] = {
128 { .div = 1, .val = 4, .flags = RATE_IN_3XXX },
129 { .div = 0 }
130};
131
132static const struct clksel osc_sys_clksel[] = {
133 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
134 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
135 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
136 { .parent = &virt_19200000_ck, .rates = osc_sys_19_2m_rates },
137 { .parent = &virt_26000000_ck, .rates = osc_sys_26m_rates },
138 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
139 { .parent = NULL },
140};
141
142/* Oscillator clock */
143/* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */
144static struct clk osc_sys_ck = {
145 .name = "osc_sys_ck",
146 .ops = &clkops_null,
147 .init = &omap2_init_clksel_parent,
148 .clksel_reg = OMAP3430_PRM_CLKSEL,
149 .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK,
150 .clksel = osc_sys_clksel,
151 /* REVISIT: deal with autoextclkmode? */
152 .recalc = &omap2_clksel_recalc,
153};
154
155static const struct clksel_rate div2_rates[] = {
156 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
157 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
158 { .div = 0 }
159};
160
161static const struct clksel sys_clksel[] = {
162 { .parent = &osc_sys_ck, .rates = div2_rates },
163 { .parent = NULL }
164};
165
166/* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */
167/* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */
168static struct clk sys_ck = {
169 .name = "sys_ck",
170 .ops = &clkops_null,
171 .parent = &osc_sys_ck,
172 .init = &omap2_init_clksel_parent,
173 .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL,
174 .clksel_mask = OMAP_SYSCLKDIV_MASK,
175 .clksel = sys_clksel,
176 .recalc = &omap2_clksel_recalc,
177};
178
179static struct clk sys_altclk = {
180 .name = "sys_altclk",
181 .ops = &clkops_null,
182};
183
184/* Optional external clock input for some McBSPs */
185static struct clk mcbsp_clks = {
186 .name = "mcbsp_clks",
187 .ops = &clkops_null,
188};
189
190/* PRM EXTERNAL CLOCK OUTPUT */
191
192static struct clk sys_clkout1 = {
193 .name = "sys_clkout1",
194 .ops = &clkops_omap2_dflt,
195 .parent = &osc_sys_ck,
196 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
197 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
198 .recalc = &followparent_recalc,
199};
200
201/* DPLLS */
202
203/* CM CLOCKS */
204
205static const struct clksel_rate div16_dpll_rates[] = {
206 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
207 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
208 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
209 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
210 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
211 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
212 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
213 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
214 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
215 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
216 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
217 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
218 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
219 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
220 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
221 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
222 { .div = 0 }
223};
224
225static const struct clksel_rate dpll4_rates[] = {
226 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
227 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
228 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
229 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
230 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
231 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
232 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
233 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
234 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
235 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
236 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
237 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
238 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
239 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
240 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
241 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
242 { .div = 17, .val = 17, .flags = RATE_IN_36XX },
243 { .div = 18, .val = 18, .flags = RATE_IN_36XX },
244 { .div = 19, .val = 19, .flags = RATE_IN_36XX },
245 { .div = 20, .val = 20, .flags = RATE_IN_36XX },
246 { .div = 21, .val = 21, .flags = RATE_IN_36XX },
247 { .div = 22, .val = 22, .flags = RATE_IN_36XX },
248 { .div = 23, .val = 23, .flags = RATE_IN_36XX },
249 { .div = 24, .val = 24, .flags = RATE_IN_36XX },
250 { .div = 25, .val = 25, .flags = RATE_IN_36XX },
251 { .div = 26, .val = 26, .flags = RATE_IN_36XX },
252 { .div = 27, .val = 27, .flags = RATE_IN_36XX },
253 { .div = 28, .val = 28, .flags = RATE_IN_36XX },
254 { .div = 29, .val = 29, .flags = RATE_IN_36XX },
255 { .div = 30, .val = 30, .flags = RATE_IN_36XX },
256 { .div = 31, .val = 31, .flags = RATE_IN_36XX },
257 { .div = 32, .val = 32, .flags = RATE_IN_36XX },
258 { .div = 0 }
259};
260
261/* DPLL1 */
262/* MPU clock source */
263/* Type: DPLL */
264static struct dpll_data dpll1_dd = {
265 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
266 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
267 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
268 .clk_bypass = &dpll1_fck,
269 .clk_ref = &sys_ck,
270 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
271 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
272 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
273 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
274 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
275 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
276 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
277 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
278 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
279 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
280 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
281 .max_multiplier = OMAP3_MAX_DPLL_MULT,
282 .min_divider = 1,
283 .max_divider = OMAP3_MAX_DPLL_DIV,
284};
285
286static struct clk dpll1_ck = {
287 .name = "dpll1_ck",
288 .ops = &clkops_omap3_noncore_dpll_ops,
289 .parent = &sys_ck,
290 .dpll_data = &dpll1_dd,
291 .round_rate = &omap2_dpll_round_rate,
292 .set_rate = &omap3_noncore_dpll_set_rate,
293 .clkdm_name = "dpll1_clkdm",
294 .recalc = &omap3_dpll_recalc,
295};
296
297/*
298 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
299 * DPLL isn't bypassed.
300 */
301static struct clk dpll1_x2_ck = {
302 .name = "dpll1_x2_ck",
303 .ops = &clkops_null,
304 .parent = &dpll1_ck,
305 .clkdm_name = "dpll1_clkdm",
306 .recalc = &omap3_clkoutx2_recalc,
307};
308
309/* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */
310static const struct clksel div16_dpll1_x2m2_clksel[] = {
311 { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates },
312 { .parent = NULL }
313};
314
315/*
316 * Does not exist in the TRM - needed to separate the M2 divider from
317 * bypass selection in mpu_ck
318 */
319static struct clk dpll1_x2m2_ck = {
320 .name = "dpll1_x2m2_ck",
321 .ops = &clkops_null,
322 .parent = &dpll1_x2_ck,
323 .init = &omap2_init_clksel_parent,
324 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
325 .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK,
326 .clksel = div16_dpll1_x2m2_clksel,
327 .clkdm_name = "dpll1_clkdm",
328 .recalc = &omap2_clksel_recalc,
329};
330
331/* DPLL2 */
332/* IVA2 clock source */
333/* Type: DPLL */
334
335static struct dpll_data dpll2_dd = {
336 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
337 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
338 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
339 .clk_bypass = &dpll2_fck,
340 .clk_ref = &sys_ck,
341 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
342 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
343 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
344 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
345 (1 << DPLL_LOW_POWER_BYPASS),
346 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
347 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
348 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
349 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
350 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
351 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
352 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
353 .max_multiplier = OMAP3_MAX_DPLL_MULT,
354 .min_divider = 1,
355 .max_divider = OMAP3_MAX_DPLL_DIV,
356};
357
358static struct clk dpll2_ck = {
359 .name = "dpll2_ck",
360 .ops = &clkops_omap3_noncore_dpll_ops,
361 .parent = &sys_ck,
362 .dpll_data = &dpll2_dd,
363 .round_rate = &omap2_dpll_round_rate,
364 .set_rate = &omap3_noncore_dpll_set_rate,
365 .clkdm_name = "dpll2_clkdm",
366 .recalc = &omap3_dpll_recalc,
367};
368
369static const struct clksel div16_dpll2_m2x2_clksel[] = {
370 { .parent = &dpll2_ck, .rates = div16_dpll_rates },
371 { .parent = NULL }
372};
373
374/*
375 * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT
376 * or CLKOUTX2. CLKOUT seems most plausible.
377 */
378static struct clk dpll2_m2_ck = {
379 .name = "dpll2_m2_ck",
380 .ops = &clkops_null,
381 .parent = &dpll2_ck,
382 .init = &omap2_init_clksel_parent,
383 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
384 OMAP3430_CM_CLKSEL2_PLL),
385 .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK,
386 .clksel = div16_dpll2_m2x2_clksel,
387 .clkdm_name = "dpll2_clkdm",
388 .recalc = &omap2_clksel_recalc,
389};
390
391/*
392 * DPLL3
393 * Source clock for all interfaces and for some device fclks
394 * REVISIT: Also supports fast relock bypass - not included below
395 */
396static struct dpll_data dpll3_dd = {
397 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
398 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
399 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
400 .clk_bypass = &sys_ck,
401 .clk_ref = &sys_ck,
402 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
403 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
404 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
405 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
406 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
407 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
408 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
409 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
410 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
411 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
412 .max_multiplier = OMAP3_MAX_DPLL_MULT,
413 .min_divider = 1,
414 .max_divider = OMAP3_MAX_DPLL_DIV,
415};
416
417static struct clk dpll3_ck = {
418 .name = "dpll3_ck",
419 .ops = &clkops_omap3_core_dpll_ops,
420 .parent = &sys_ck,
421 .dpll_data = &dpll3_dd,
422 .round_rate = &omap2_dpll_round_rate,
423 .clkdm_name = "dpll3_clkdm",
424 .recalc = &omap3_dpll_recalc,
425};
426
427/*
428 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
429 * DPLL isn't bypassed
430 */
431static struct clk dpll3_x2_ck = {
432 .name = "dpll3_x2_ck",
433 .ops = &clkops_null,
434 .parent = &dpll3_ck,
435 .clkdm_name = "dpll3_clkdm",
436 .recalc = &omap3_clkoutx2_recalc,
437};
438
439static const struct clksel_rate div31_dpll3_rates[] = {
440 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
441 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
442 { .div = 3, .val = 3, .flags = RATE_IN_3430ES2PLUS_36XX },
443 { .div = 4, .val = 4, .flags = RATE_IN_3430ES2PLUS_36XX },
444 { .div = 5, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
445 { .div = 6, .val = 6, .flags = RATE_IN_3430ES2PLUS_36XX },
446 { .div = 7, .val = 7, .flags = RATE_IN_3430ES2PLUS_36XX },
447 { .div = 8, .val = 8, .flags = RATE_IN_3430ES2PLUS_36XX },
448 { .div = 9, .val = 9, .flags = RATE_IN_3430ES2PLUS_36XX },
449 { .div = 10, .val = 10, .flags = RATE_IN_3430ES2PLUS_36XX },
450 { .div = 11, .val = 11, .flags = RATE_IN_3430ES2PLUS_36XX },
451 { .div = 12, .val = 12, .flags = RATE_IN_3430ES2PLUS_36XX },
452 { .div = 13, .val = 13, .flags = RATE_IN_3430ES2PLUS_36XX },
453 { .div = 14, .val = 14, .flags = RATE_IN_3430ES2PLUS_36XX },
454 { .div = 15, .val = 15, .flags = RATE_IN_3430ES2PLUS_36XX },
455 { .div = 16, .val = 16, .flags = RATE_IN_3430ES2PLUS_36XX },
456 { .div = 17, .val = 17, .flags = RATE_IN_3430ES2PLUS_36XX },
457 { .div = 18, .val = 18, .flags = RATE_IN_3430ES2PLUS_36XX },
458 { .div = 19, .val = 19, .flags = RATE_IN_3430ES2PLUS_36XX },
459 { .div = 20, .val = 20, .flags = RATE_IN_3430ES2PLUS_36XX },
460 { .div = 21, .val = 21, .flags = RATE_IN_3430ES2PLUS_36XX },
461 { .div = 22, .val = 22, .flags = RATE_IN_3430ES2PLUS_36XX },
462 { .div = 23, .val = 23, .flags = RATE_IN_3430ES2PLUS_36XX },
463 { .div = 24, .val = 24, .flags = RATE_IN_3430ES2PLUS_36XX },
464 { .div = 25, .val = 25, .flags = RATE_IN_3430ES2PLUS_36XX },
465 { .div = 26, .val = 26, .flags = RATE_IN_3430ES2PLUS_36XX },
466 { .div = 27, .val = 27, .flags = RATE_IN_3430ES2PLUS_36XX },
467 { .div = 28, .val = 28, .flags = RATE_IN_3430ES2PLUS_36XX },
468 { .div = 29, .val = 29, .flags = RATE_IN_3430ES2PLUS_36XX },
469 { .div = 30, .val = 30, .flags = RATE_IN_3430ES2PLUS_36XX },
470 { .div = 31, .val = 31, .flags = RATE_IN_3430ES2PLUS_36XX },
471 { .div = 0 },
472};
473
474static const struct clksel div31_dpll3m2_clksel[] = {
475 { .parent = &dpll3_ck, .rates = div31_dpll3_rates },
476 { .parent = NULL }
477};
478
479/* DPLL3 output M2 - primary control point for CORE speed */
480static struct clk dpll3_m2_ck = {
481 .name = "dpll3_m2_ck",
482 .ops = &clkops_null,
483 .parent = &dpll3_ck,
484 .init = &omap2_init_clksel_parent,
485 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
486 .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK,
487 .clksel = div31_dpll3m2_clksel,
488 .clkdm_name = "dpll3_clkdm",
489 .round_rate = &omap2_clksel_round_rate,
490 .set_rate = &omap3_core_dpll_m2_set_rate,
491 .recalc = &omap2_clksel_recalc,
492};
493
494static struct clk core_ck = {
495 .name = "core_ck",
496 .ops = &clkops_null,
497 .parent = &dpll3_m2_ck,
498 .recalc = &followparent_recalc,
499};
500
501static struct clk dpll3_m2x2_ck = {
502 .name = "dpll3_m2x2_ck",
503 .ops = &clkops_null,
504 .parent = &dpll3_m2_ck,
505 .clkdm_name = "dpll3_clkdm",
506 .recalc = &omap3_clkoutx2_recalc,
507};
508
509/* The PWRDN bit is apparently only available on 3430ES2 and above */
510static const struct clksel div16_dpll3_clksel[] = {
511 { .parent = &dpll3_ck, .rates = div16_dpll_rates },
512 { .parent = NULL }
513};
514
515/* This virtual clock is the source for dpll3_m3x2_ck */
516static struct clk dpll3_m3_ck = {
517 .name = "dpll3_m3_ck",
518 .ops = &clkops_null,
519 .parent = &dpll3_ck,
520 .init = &omap2_init_clksel_parent,
521 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
522 .clksel_mask = OMAP3430_DIV_DPLL3_MASK,
523 .clksel = div16_dpll3_clksel,
524 .clkdm_name = "dpll3_clkdm",
525 .recalc = &omap2_clksel_recalc,
526};
527
528/* The PWRDN bit is apparently only available on 3430ES2 and above */
529static struct clk dpll3_m3x2_ck = {
530 .name = "dpll3_m3x2_ck",
531 .ops = &clkops_omap2_dflt_wait,
532 .parent = &dpll3_m3_ck,
533 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
534 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
535 .flags = INVERT_ENABLE,
536 .clkdm_name = "dpll3_clkdm",
537 .recalc = &omap3_clkoutx2_recalc,
538};
539
540static struct clk emu_core_alwon_ck = {
541 .name = "emu_core_alwon_ck",
542 .ops = &clkops_null,
543 .parent = &dpll3_m3x2_ck,
544 .clkdm_name = "dpll3_clkdm",
545 .recalc = &followparent_recalc,
546};
547
548/* DPLL4 */
549/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
550/* Type: DPLL */
551static struct dpll_data dpll4_dd;
552
553static struct dpll_data dpll4_dd_34xx __initdata = {
554 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
555 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
556 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
557 .clk_bypass = &sys_ck,
558 .clk_ref = &sys_ck,
559 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
560 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
561 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
562 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
563 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
564 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
565 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
566 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
567 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
568 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
569 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
570 .max_multiplier = OMAP3_MAX_DPLL_MULT,
571 .min_divider = 1,
572 .max_divider = OMAP3_MAX_DPLL_DIV,
573};
574
575static struct dpll_data dpll4_dd_3630 __initdata = {
576 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
577 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
578 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
579 .clk_bypass = &sys_ck,
580 .clk_ref = &sys_ck,
581 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
582 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
583 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
584 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
585 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
586 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
587 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
588 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
589 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
590 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
591 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
592 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
593 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
594 .min_divider = 1,
595 .max_divider = OMAP3_MAX_DPLL_DIV,
596 .flags = DPLL_J_TYPE
597};
598
599static struct clk dpll4_ck = {
600 .name = "dpll4_ck",
601 .ops = &clkops_omap3_noncore_dpll_ops,
602 .parent = &sys_ck,
603 .dpll_data = &dpll4_dd,
604 .round_rate = &omap2_dpll_round_rate,
605 .set_rate = &omap3_dpll4_set_rate,
606 .clkdm_name = "dpll4_clkdm",
607 .recalc = &omap3_dpll_recalc,
608};
609
610/*
611 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
612 * DPLL isn't bypassed --
613 * XXX does this serve any downstream clocks?
614 */
615static struct clk dpll4_x2_ck = {
616 .name = "dpll4_x2_ck",
617 .ops = &clkops_null,
618 .parent = &dpll4_ck,
619 .clkdm_name = "dpll4_clkdm",
620 .recalc = &omap3_clkoutx2_recalc,
621};
622
623static const struct clksel dpll4_clksel[] = {
624 { .parent = &dpll4_ck, .rates = dpll4_rates },
625 { .parent = NULL }
626};
627
628/* This virtual clock is the source for dpll4_m2x2_ck */
629static struct clk dpll4_m2_ck = {
630 .name = "dpll4_m2_ck",
631 .ops = &clkops_null,
632 .parent = &dpll4_ck,
633 .init = &omap2_init_clksel_parent,
634 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
635 .clksel_mask = OMAP3630_DIV_96M_MASK,
636 .clksel = dpll4_clksel,
637 .clkdm_name = "dpll4_clkdm",
638 .recalc = &omap2_clksel_recalc,
639};
640
641/* The PWRDN bit is apparently only available on 3430ES2 and above */
642static struct clk dpll4_m2x2_ck = {
643 .name = "dpll4_m2x2_ck",
644 .ops = &clkops_omap2_dflt_wait,
645 .parent = &dpll4_m2_ck,
646 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
647 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
648 .flags = INVERT_ENABLE,
649 .clkdm_name = "dpll4_clkdm",
650 .recalc = &omap3_clkoutx2_recalc,
651};
652
653/*
654 * DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as
655 * PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM:
656 * 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and
657 * CM_96K_(F)CLK.
658 */
659
660/* Adding 192MHz Clock node needed by SGX */
661static struct clk omap_192m_alwon_fck = {
662 .name = "omap_192m_alwon_fck",
663 .ops = &clkops_null,
664 .parent = &dpll4_m2x2_ck,
665 .recalc = &followparent_recalc,
666};
667
668static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
669 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
670 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
671 { .div = 0 }
672};
673
674static const struct clksel omap_96m_alwon_fck_clksel[] = {
675 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
676 { .parent = NULL }
677};
678
679static const struct clksel_rate omap_96m_dpll_rates[] = {
680 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
681 { .div = 0 }
682};
683
684static const struct clksel_rate omap_96m_sys_rates[] = {
685 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
686 { .div = 0 }
687};
688
689static struct clk omap_96m_alwon_fck = {
690 .name = "omap_96m_alwon_fck",
691 .ops = &clkops_null,
692 .parent = &dpll4_m2x2_ck,
693 .recalc = &followparent_recalc,
694};
695
696static struct clk omap_96m_alwon_fck_3630 = {
697 .name = "omap_96m_alwon_fck",
698 .parent = &omap_192m_alwon_fck,
699 .init = &omap2_init_clksel_parent,
700 .ops = &clkops_null,
701 .recalc = &omap2_clksel_recalc,
702 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
703 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
704 .clksel = omap_96m_alwon_fck_clksel
705};
706
707static struct clk cm_96m_fck = {
708 .name = "cm_96m_fck",
709 .ops = &clkops_null,
710 .parent = &omap_96m_alwon_fck,
711 .recalc = &followparent_recalc,
712};
713
714static const struct clksel omap_96m_fck_clksel[] = {
715 { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates },
716 { .parent = &sys_ck, .rates = omap_96m_sys_rates },
717 { .parent = NULL }
718};
719
720static struct clk omap_96m_fck = {
721 .name = "omap_96m_fck",
722 .ops = &clkops_null,
723 .parent = &sys_ck,
724 .init = &omap2_init_clksel_parent,
725 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
726 .clksel_mask = OMAP3430_SOURCE_96M_MASK,
727 .clksel = omap_96m_fck_clksel,
728 .recalc = &omap2_clksel_recalc,
729};
730
731/* This virtual clock is the source for dpll4_m3x2_ck */
732static struct clk dpll4_m3_ck = {
733 .name = "dpll4_m3_ck",
734 .ops = &clkops_null,
735 .parent = &dpll4_ck,
736 .init = &omap2_init_clksel_parent,
737 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
738 .clksel_mask = OMAP3630_CLKSEL_TV_MASK,
739 .clksel = dpll4_clksel,
740 .clkdm_name = "dpll4_clkdm",
741 .recalc = &omap2_clksel_recalc,
742};
743
744/* The PWRDN bit is apparently only available on 3430ES2 and above */
745static struct clk dpll4_m3x2_ck = {
746 .name = "dpll4_m3x2_ck",
747 .ops = &clkops_omap2_dflt_wait,
748 .parent = &dpll4_m3_ck,
749 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
750 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
751 .flags = INVERT_ENABLE,
752 .clkdm_name = "dpll4_clkdm",
753 .recalc = &omap3_clkoutx2_recalc,
754};
755
756static const struct clksel_rate omap_54m_d4m3x2_rates[] = {
757 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
758 { .div = 0 }
759};
760
761static const struct clksel_rate omap_54m_alt_rates[] = {
762 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
763 { .div = 0 }
764};
765
766static const struct clksel omap_54m_clksel[] = {
767 { .parent = &dpll4_m3x2_ck, .rates = omap_54m_d4m3x2_rates },
768 { .parent = &sys_altclk, .rates = omap_54m_alt_rates },
769 { .parent = NULL }
770};
771
772static struct clk omap_54m_fck = {
773 .name = "omap_54m_fck",
774 .ops = &clkops_null,
775 .init = &omap2_init_clksel_parent,
776 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
777 .clksel_mask = OMAP3430_SOURCE_54M_MASK,
778 .clksel = omap_54m_clksel,
779 .recalc = &omap2_clksel_recalc,
780};
781
782static const struct clksel_rate omap_48m_cm96m_rates[] = {
783 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
784 { .div = 0 }
785};
786
787static const struct clksel_rate omap_48m_alt_rates[] = {
788 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
789 { .div = 0 }
790};
791
792static const struct clksel omap_48m_clksel[] = {
793 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
794 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
795 { .parent = NULL }
796};
797
798static struct clk omap_48m_fck = {
799 .name = "omap_48m_fck",
800 .ops = &clkops_null,
801 .init = &omap2_init_clksel_parent,
802 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
803 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
804 .clksel = omap_48m_clksel,
805 .recalc = &omap2_clksel_recalc,
806};
807
808static struct clk omap_12m_fck = {
809 .name = "omap_12m_fck",
810 .ops = &clkops_null,
811 .parent = &omap_48m_fck,
812 .fixed_div = 4,
813 .recalc = &omap_fixed_divisor_recalc,
814};
815
816/* This virtual clock is the source for dpll4_m4x2_ck */
817static struct clk dpll4_m4_ck = {
818 .name = "dpll4_m4_ck",
819 .ops = &clkops_null,
820 .parent = &dpll4_ck,
821 .init = &omap2_init_clksel_parent,
822 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
823 .clksel_mask = OMAP3630_CLKSEL_DSS1_MASK,
824 .clksel = dpll4_clksel,
825 .clkdm_name = "dpll4_clkdm",
826 .recalc = &omap2_clksel_recalc,
827 .set_rate = &omap2_clksel_set_rate,
828 .round_rate = &omap2_clksel_round_rate,
829};
830
831/* The PWRDN bit is apparently only available on 3430ES2 and above */
832static struct clk dpll4_m4x2_ck = {
833 .name = "dpll4_m4x2_ck",
834 .ops = &clkops_omap2_dflt_wait,
835 .parent = &dpll4_m4_ck,
836 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
837 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
838 .flags = INVERT_ENABLE,
839 .clkdm_name = "dpll4_clkdm",
840 .recalc = &omap3_clkoutx2_recalc,
841};
842
843/* This virtual clock is the source for dpll4_m5x2_ck */
844static struct clk dpll4_m5_ck = {
845 .name = "dpll4_m5_ck",
846 .ops = &clkops_null,
847 .parent = &dpll4_ck,
848 .init = &omap2_init_clksel_parent,
849 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
850 .clksel_mask = OMAP3630_CLKSEL_CAM_MASK,
851 .clksel = dpll4_clksel,
852 .clkdm_name = "dpll4_clkdm",
853 .set_rate = &omap2_clksel_set_rate,
854 .round_rate = &omap2_clksel_round_rate,
855 .recalc = &omap2_clksel_recalc,
856};
857
858/* The PWRDN bit is apparently only available on 3430ES2 and above */
859static struct clk dpll4_m5x2_ck = {
860 .name = "dpll4_m5x2_ck",
861 .ops = &clkops_omap2_dflt_wait,
862 .parent = &dpll4_m5_ck,
863 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
864 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
865 .flags = INVERT_ENABLE,
866 .clkdm_name = "dpll4_clkdm",
867 .recalc = &omap3_clkoutx2_recalc,
868};
869
870/* This virtual clock is the source for dpll4_m6x2_ck */
871static struct clk dpll4_m6_ck = {
872 .name = "dpll4_m6_ck",
873 .ops = &clkops_null,
874 .parent = &dpll4_ck,
875 .init = &omap2_init_clksel_parent,
876 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
877 .clksel_mask = OMAP3630_DIV_DPLL4_MASK,
878 .clksel = dpll4_clksel,
879 .clkdm_name = "dpll4_clkdm",
880 .recalc = &omap2_clksel_recalc,
881};
882
883/* The PWRDN bit is apparently only available on 3430ES2 and above */
884static struct clk dpll4_m6x2_ck = {
885 .name = "dpll4_m6x2_ck",
886 .ops = &clkops_omap2_dflt_wait,
887 .parent = &dpll4_m6_ck,
888 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
889 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
890 .flags = INVERT_ENABLE,
891 .clkdm_name = "dpll4_clkdm",
892 .recalc = &omap3_clkoutx2_recalc,
893};
894
895static struct clk emu_per_alwon_ck = {
896 .name = "emu_per_alwon_ck",
897 .ops = &clkops_null,
898 .parent = &dpll4_m6x2_ck,
899 .clkdm_name = "dpll4_clkdm",
900 .recalc = &followparent_recalc,
901};
902
903/* DPLL5 */
904/* Supplies 120MHz clock, USIM source clock */
905/* Type: DPLL */
906/* 3430ES2 only */
907static struct dpll_data dpll5_dd = {
908 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
909 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
910 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
911 .clk_bypass = &sys_ck,
912 .clk_ref = &sys_ck,
913 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
914 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
915 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
916 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
917 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
918 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
919 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
920 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
921 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
922 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
923 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
924 .max_multiplier = OMAP3_MAX_DPLL_MULT,
925 .min_divider = 1,
926 .max_divider = OMAP3_MAX_DPLL_DIV,
927};
928
929static struct clk dpll5_ck = {
930 .name = "dpll5_ck",
931 .ops = &clkops_omap3_noncore_dpll_ops,
932 .parent = &sys_ck,
933 .dpll_data = &dpll5_dd,
934 .round_rate = &omap2_dpll_round_rate,
935 .set_rate = &omap3_noncore_dpll_set_rate,
936 .clkdm_name = "dpll5_clkdm",
937 .recalc = &omap3_dpll_recalc,
938};
939
940static const struct clksel div16_dpll5_clksel[] = {
941 { .parent = &dpll5_ck, .rates = div16_dpll_rates },
942 { .parent = NULL }
943};
944
945static struct clk dpll5_m2_ck = {
946 .name = "dpll5_m2_ck",
947 .ops = &clkops_null,
948 .parent = &dpll5_ck,
949 .init = &omap2_init_clksel_parent,
950 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
951 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
952 .clksel = div16_dpll5_clksel,
953 .clkdm_name = "dpll5_clkdm",
954 .recalc = &omap2_clksel_recalc,
955};
956
957/* CM EXTERNAL CLOCK OUTPUTS */
958
959static const struct clksel_rate clkout2_src_core_rates[] = {
960 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
961 { .div = 0 }
962};
963
964static const struct clksel_rate clkout2_src_sys_rates[] = {
965 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
966 { .div = 0 }
967};
968
969static const struct clksel_rate clkout2_src_96m_rates[] = {
970 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
971 { .div = 0 }
972};
973
974static const struct clksel_rate clkout2_src_54m_rates[] = {
975 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
976 { .div = 0 }
977};
978
979static const struct clksel clkout2_src_clksel[] = {
980 { .parent = &core_ck, .rates = clkout2_src_core_rates },
981 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
982 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
983 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
984 { .parent = NULL }
985};
986
987static struct clk clkout2_src_ck = {
988 .name = "clkout2_src_ck",
989 .ops = &clkops_omap2_dflt,
990 .init = &omap2_init_clksel_parent,
991 .enable_reg = OMAP3430_CM_CLKOUT_CTRL,
992 .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT,
993 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
994 .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK,
995 .clksel = clkout2_src_clksel,
996 .clkdm_name = "core_clkdm",
997 .recalc = &omap2_clksel_recalc,
998};
999
1000static const struct clksel_rate sys_clkout2_rates[] = {
1001 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1002 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1003 { .div = 4, .val = 2, .flags = RATE_IN_3XXX },
1004 { .div = 8, .val = 3, .flags = RATE_IN_3XXX },
1005 { .div = 16, .val = 4, .flags = RATE_IN_3XXX },
1006 { .div = 0 },
1007};
1008
1009static const struct clksel sys_clkout2_clksel[] = {
1010 { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates },
1011 { .parent = NULL },
1012};
1013
1014static struct clk sys_clkout2 = {
1015 .name = "sys_clkout2",
1016 .ops = &clkops_null,
1017 .init = &omap2_init_clksel_parent,
1018 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
1019 .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK,
1020 .clksel = sys_clkout2_clksel,
1021 .recalc = &omap2_clksel_recalc,
1022 .round_rate = &omap2_clksel_round_rate,
1023 .set_rate = &omap2_clksel_set_rate
1024};
1025
1026/* CM OUTPUT CLOCKS */
1027
1028static struct clk corex2_fck = {
1029 .name = "corex2_fck",
1030 .ops = &clkops_null,
1031 .parent = &dpll3_m2x2_ck,
1032 .recalc = &followparent_recalc,
1033};
1034
1035/* DPLL power domain clock controls */
1036
1037static const struct clksel_rate div4_rates[] = {
1038 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1039 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1040 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1041 { .div = 0 }
1042};
1043
1044static const struct clksel div4_core_clksel[] = {
1045 { .parent = &core_ck, .rates = div4_rates },
1046 { .parent = NULL }
1047};
1048
1049/*
1050 * REVISIT: Are these in DPLL power domain or CM power domain? docs
1051 * may be inconsistent here?
1052 */
1053static struct clk dpll1_fck = {
1054 .name = "dpll1_fck",
1055 .ops = &clkops_null,
1056 .parent = &core_ck,
1057 .init = &omap2_init_clksel_parent,
1058 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
1059 .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK,
1060 .clksel = div4_core_clksel,
1061 .recalc = &omap2_clksel_recalc,
1062};
1063
1064static struct clk mpu_ck = {
1065 .name = "mpu_ck",
1066 .ops = &clkops_null,
1067 .parent = &dpll1_x2m2_ck,
1068 .clkdm_name = "mpu_clkdm",
1069 .recalc = &followparent_recalc,
1070};
1071
1072/* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */
1073static const struct clksel_rate arm_fck_rates[] = {
1074 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1075 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1076 { .div = 0 },
1077};
1078
1079static const struct clksel arm_fck_clksel[] = {
1080 { .parent = &mpu_ck, .rates = arm_fck_rates },
1081 { .parent = NULL }
1082};
1083
1084static struct clk arm_fck = {
1085 .name = "arm_fck",
1086 .ops = &clkops_null,
1087 .parent = &mpu_ck,
1088 .init = &omap2_init_clksel_parent,
1089 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
1090 .clksel_mask = OMAP3430_ST_MPU_CLK_MASK,
1091 .clksel = arm_fck_clksel,
1092 .clkdm_name = "mpu_clkdm",
1093 .recalc = &omap2_clksel_recalc,
1094};
1095
1096/* XXX What about neon_clkdm ? */
1097
1098/*
1099 * REVISIT: This clock is never specifically defined in the 3430 TRM,
1100 * although it is referenced - so this is a guess
1101 */
1102static struct clk emu_mpu_alwon_ck = {
1103 .name = "emu_mpu_alwon_ck",
1104 .ops = &clkops_null,
1105 .parent = &mpu_ck,
1106 .recalc = &followparent_recalc,
1107};
1108
1109static struct clk dpll2_fck = {
1110 .name = "dpll2_fck",
1111 .ops = &clkops_null,
1112 .parent = &core_ck,
1113 .init = &omap2_init_clksel_parent,
1114 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
1115 .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK,
1116 .clksel = div4_core_clksel,
1117 .recalc = &omap2_clksel_recalc,
1118};
1119
1120static struct clk iva2_ck = {
1121 .name = "iva2_ck",
1122 .ops = &clkops_omap2_dflt_wait,
1123 .parent = &dpll2_m2_ck,
1124 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1125 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1126 .clkdm_name = "iva2_clkdm",
1127 .recalc = &followparent_recalc,
1128};
1129
1130/* Common interface clocks */
1131
1132static const struct clksel div2_core_clksel[] = {
1133 { .parent = &core_ck, .rates = div2_rates },
1134 { .parent = NULL }
1135};
1136
1137static struct clk l3_ick = {
1138 .name = "l3_ick",
1139 .ops = &clkops_null,
1140 .parent = &core_ck,
1141 .init = &omap2_init_clksel_parent,
1142 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1143 .clksel_mask = OMAP3430_CLKSEL_L3_MASK,
1144 .clksel = div2_core_clksel,
1145 .clkdm_name = "core_l3_clkdm",
1146 .recalc = &omap2_clksel_recalc,
1147};
1148
1149static const struct clksel div2_l3_clksel[] = {
1150 { .parent = &l3_ick, .rates = div2_rates },
1151 { .parent = NULL }
1152};
1153
1154static struct clk l4_ick = {
1155 .name = "l4_ick",
1156 .ops = &clkops_null,
1157 .parent = &l3_ick,
1158 .init = &omap2_init_clksel_parent,
1159 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1160 .clksel_mask = OMAP3430_CLKSEL_L4_MASK,
1161 .clksel = div2_l3_clksel,
1162 .clkdm_name = "core_l4_clkdm",
1163 .recalc = &omap2_clksel_recalc,
1164
1165};
1166
1167static const struct clksel div2_l4_clksel[] = {
1168 { .parent = &l4_ick, .rates = div2_rates },
1169 { .parent = NULL }
1170};
1171
1172static struct clk rm_ick = {
1173 .name = "rm_ick",
1174 .ops = &clkops_null,
1175 .parent = &l4_ick,
1176 .init = &omap2_init_clksel_parent,
1177 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1178 .clksel_mask = OMAP3430_CLKSEL_RM_MASK,
1179 .clksel = div2_l4_clksel,
1180 .recalc = &omap2_clksel_recalc,
1181};
1182
1183/* GFX power domain */
1184
1185/* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */
1186
1187static const struct clksel gfx_l3_clksel[] = {
1188 { .parent = &l3_ick, .rates = gfx_l3_rates },
1189 { .parent = NULL }
1190};
1191
1192/*
1193 * Virtual parent clock for gfx_l3_ick and gfx_l3_fck
1194 * This interface clock does not have a CM_AUTOIDLE bit
1195 */
1196static struct clk gfx_l3_ck = {
1197 .name = "gfx_l3_ck",
1198 .ops = &clkops_omap2_dflt_wait,
1199 .parent = &l3_ick,
1200 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1201 .enable_bit = OMAP_EN_GFX_SHIFT,
1202 .recalc = &followparent_recalc,
1203};
1204
1205static struct clk gfx_l3_fck = {
1206 .name = "gfx_l3_fck",
1207 .ops = &clkops_null,
1208 .parent = &gfx_l3_ck,
1209 .init = &omap2_init_clksel_parent,
1210 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1211 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
1212 .clksel = gfx_l3_clksel,
1213 .clkdm_name = "gfx_3430es1_clkdm",
1214 .recalc = &omap2_clksel_recalc,
1215};
1216
1217static struct clk gfx_l3_ick = {
1218 .name = "gfx_l3_ick",
1219 .ops = &clkops_null,
1220 .parent = &gfx_l3_ck,
1221 .clkdm_name = "gfx_3430es1_clkdm",
1222 .recalc = &followparent_recalc,
1223};
1224
1225static struct clk gfx_cg1_ck = {
1226 .name = "gfx_cg1_ck",
1227 .ops = &clkops_omap2_dflt_wait,
1228 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1229 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1230 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1231 .clkdm_name = "gfx_3430es1_clkdm",
1232 .recalc = &followparent_recalc,
1233};
1234
1235static struct clk gfx_cg2_ck = {
1236 .name = "gfx_cg2_ck",
1237 .ops = &clkops_omap2_dflt_wait,
1238 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1239 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1240 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1241 .clkdm_name = "gfx_3430es1_clkdm",
1242 .recalc = &followparent_recalc,
1243};
1244
1245/* SGX power domain - 3430ES2 only */
1246
1247static const struct clksel_rate sgx_core_rates[] = {
1248 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
1249 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
1250 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
1251 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
1252 { .div = 0 },
1253};
1254
1255static const struct clksel_rate sgx_192m_rates[] = {
1256 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
1257 { .div = 0 },
1258};
1259
1260static const struct clksel_rate sgx_corex2_rates[] = {
1261 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
1262 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
1263 { .div = 0 },
1264};
1265
1266static const struct clksel_rate sgx_96m_rates[] = {
1267 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1268 { .div = 0 },
1269};
1270
1271static const struct clksel sgx_clksel[] = {
1272 { .parent = &core_ck, .rates = sgx_core_rates },
1273 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
1274 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
1275 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
1276 { .parent = NULL }
1277};
1278
1279static struct clk sgx_fck = {
1280 .name = "sgx_fck",
1281 .ops = &clkops_omap2_dflt_wait,
1282 .init = &omap2_init_clksel_parent,
1283 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
1284 .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
1285 .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
1286 .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK,
1287 .clksel = sgx_clksel,
1288 .clkdm_name = "sgx_clkdm",
1289 .recalc = &omap2_clksel_recalc,
1290 .set_rate = &omap2_clksel_set_rate,
1291 .round_rate = &omap2_clksel_round_rate
1292};
1293
1294/* This interface clock does not have a CM_AUTOIDLE bit */
1295static struct clk sgx_ick = {
1296 .name = "sgx_ick",
1297 .ops = &clkops_omap2_dflt_wait,
1298 .parent = &l3_ick,
1299 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
1300 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
1301 .clkdm_name = "sgx_clkdm",
1302 .recalc = &followparent_recalc,
1303};
1304
1305/* CORE power domain */
1306
1307static struct clk d2d_26m_fck = {
1308 .name = "d2d_26m_fck",
1309 .ops = &clkops_omap2_dflt_wait,
1310 .parent = &sys_ck,
1311 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1312 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
1313 .clkdm_name = "d2d_clkdm",
1314 .recalc = &followparent_recalc,
1315};
1316
1317static struct clk modem_fck = {
1318 .name = "modem_fck",
1319 .ops = &clkops_omap2_mdmclk_dflt_wait,
1320 .parent = &sys_ck,
1321 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1322 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
1323 .clkdm_name = "d2d_clkdm",
1324 .recalc = &followparent_recalc,
1325};
1326
1327static struct clk sad2d_ick = {
1328 .name = "sad2d_ick",
1329 .ops = &clkops_omap2_iclk_dflt_wait,
1330 .parent = &l3_ick,
1331 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1332 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
1333 .clkdm_name = "d2d_clkdm",
1334 .recalc = &followparent_recalc,
1335};
1336
1337static struct clk mad2d_ick = {
1338 .name = "mad2d_ick",
1339 .ops = &clkops_omap2_iclk_dflt_wait,
1340 .parent = &l3_ick,
1341 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1342 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1343 .clkdm_name = "d2d_clkdm",
1344 .recalc = &followparent_recalc,
1345};
1346
1347static const struct clksel omap343x_gpt_clksel[] = {
1348 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1349 { .parent = &sys_ck, .rates = gpt_sys_rates },
1350 { .parent = NULL}
1351};
1352
1353static struct clk gpt10_fck = {
1354 .name = "gpt10_fck",
1355 .ops = &clkops_omap2_dflt_wait,
1356 .parent = &sys_ck,
1357 .init = &omap2_init_clksel_parent,
1358 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1359 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1360 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1361 .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK,
1362 .clksel = omap343x_gpt_clksel,
1363 .clkdm_name = "core_l4_clkdm",
1364 .recalc = &omap2_clksel_recalc,
1365};
1366
1367static struct clk gpt11_fck = {
1368 .name = "gpt11_fck",
1369 .ops = &clkops_omap2_dflt_wait,
1370 .parent = &sys_ck,
1371 .init = &omap2_init_clksel_parent,
1372 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1373 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1374 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1375 .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK,
1376 .clksel = omap343x_gpt_clksel,
1377 .clkdm_name = "core_l4_clkdm",
1378 .recalc = &omap2_clksel_recalc,
1379};
1380
1381static struct clk cpefuse_fck = {
1382 .name = "cpefuse_fck",
1383 .ops = &clkops_omap2_dflt,
1384 .parent = &sys_ck,
1385 .clkdm_name = "core_l4_clkdm",
1386 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1387 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk ts_fck = {
1392 .name = "ts_fck",
1393 .ops = &clkops_omap2_dflt,
1394 .parent = &omap_32k_fck,
1395 .clkdm_name = "core_l4_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1397 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk usbtll_fck = {
1402 .name = "usbtll_fck",
1403 .ops = &clkops_omap2_dflt_wait,
1404 .parent = &dpll5_m2_ck,
1405 .clkdm_name = "core_l4_clkdm",
1406 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1407 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1408 .recalc = &followparent_recalc,
1409};
1410
1411/* CORE 96M FCLK-derived clocks */
1412
1413static struct clk core_96m_fck = {
1414 .name = "core_96m_fck",
1415 .ops = &clkops_null,
1416 .parent = &omap_96m_fck,
1417 .clkdm_name = "core_l4_clkdm",
1418 .recalc = &followparent_recalc,
1419};
1420
1421static struct clk mmchs3_fck = {
1422 .name = "mmchs3_fck",
1423 .ops = &clkops_omap2_dflt_wait,
1424 .parent = &core_96m_fck,
1425 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1426 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1427 .clkdm_name = "core_l4_clkdm",
1428 .recalc = &followparent_recalc,
1429};
1430
1431static struct clk mmchs2_fck = {
1432 .name = "mmchs2_fck",
1433 .ops = &clkops_omap2_dflt_wait,
1434 .parent = &core_96m_fck,
1435 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1436 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1437 .clkdm_name = "core_l4_clkdm",
1438 .recalc = &followparent_recalc,
1439};
1440
1441static struct clk mspro_fck = {
1442 .name = "mspro_fck",
1443 .ops = &clkops_omap2_dflt_wait,
1444 .parent = &core_96m_fck,
1445 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1446 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1447 .clkdm_name = "core_l4_clkdm",
1448 .recalc = &followparent_recalc,
1449};
1450
1451static struct clk mmchs1_fck = {
1452 .name = "mmchs1_fck",
1453 .ops = &clkops_omap2_dflt_wait,
1454 .parent = &core_96m_fck,
1455 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1456 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1457 .clkdm_name = "core_l4_clkdm",
1458 .recalc = &followparent_recalc,
1459};
1460
1461static struct clk i2c3_fck = {
1462 .name = "i2c3_fck",
1463 .ops = &clkops_omap2_dflt_wait,
1464 .parent = &core_96m_fck,
1465 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1466 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1467 .clkdm_name = "core_l4_clkdm",
1468 .recalc = &followparent_recalc,
1469};
1470
1471static struct clk i2c2_fck = {
1472 .name = "i2c2_fck",
1473 .ops = &clkops_omap2_dflt_wait,
1474 .parent = &core_96m_fck,
1475 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1476 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1477 .clkdm_name = "core_l4_clkdm",
1478 .recalc = &followparent_recalc,
1479};
1480
1481static struct clk i2c1_fck = {
1482 .name = "i2c1_fck",
1483 .ops = &clkops_omap2_dflt_wait,
1484 .parent = &core_96m_fck,
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1486 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1487 .clkdm_name = "core_l4_clkdm",
1488 .recalc = &followparent_recalc,
1489};
1490
1491/*
1492 * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck;
1493 * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck.
1494 */
1495static const struct clksel_rate common_mcbsp_96m_rates[] = {
1496 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1497 { .div = 0 }
1498};
1499
1500static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1501 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1502 { .div = 0 }
1503};
1504
1505static const struct clksel mcbsp_15_clksel[] = {
1506 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
1507 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1508 { .parent = NULL }
1509};
1510
1511static struct clk mcbsp5_fck = {
1512 .name = "mcbsp5_fck",
1513 .ops = &clkops_omap2_dflt_wait,
1514 .init = &omap2_init_clksel_parent,
1515 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1516 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1517 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
1518 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1519 .clksel = mcbsp_15_clksel,
1520 .clkdm_name = "core_l4_clkdm",
1521 .recalc = &omap2_clksel_recalc,
1522};
1523
1524static struct clk mcbsp1_fck = {
1525 .name = "mcbsp1_fck",
1526 .ops = &clkops_omap2_dflt_wait,
1527 .init = &omap2_init_clksel_parent,
1528 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1529 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1530 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1531 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1532 .clksel = mcbsp_15_clksel,
1533 .clkdm_name = "core_l4_clkdm",
1534 .recalc = &omap2_clksel_recalc,
1535};
1536
1537/* CORE_48M_FCK-derived clocks */
1538
1539static struct clk core_48m_fck = {
1540 .name = "core_48m_fck",
1541 .ops = &clkops_null,
1542 .parent = &omap_48m_fck,
1543 .clkdm_name = "core_l4_clkdm",
1544 .recalc = &followparent_recalc,
1545};
1546
1547static struct clk mcspi4_fck = {
1548 .name = "mcspi4_fck",
1549 .ops = &clkops_omap2_dflt_wait,
1550 .parent = &core_48m_fck,
1551 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1552 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1553 .recalc = &followparent_recalc,
1554 .clkdm_name = "core_l4_clkdm",
1555};
1556
1557static struct clk mcspi3_fck = {
1558 .name = "mcspi3_fck",
1559 .ops = &clkops_omap2_dflt_wait,
1560 .parent = &core_48m_fck,
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1562 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1563 .recalc = &followparent_recalc,
1564 .clkdm_name = "core_l4_clkdm",
1565};
1566
1567static struct clk mcspi2_fck = {
1568 .name = "mcspi2_fck",
1569 .ops = &clkops_omap2_dflt_wait,
1570 .parent = &core_48m_fck,
1571 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1572 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1573 .recalc = &followparent_recalc,
1574 .clkdm_name = "core_l4_clkdm",
1575};
1576
1577static struct clk mcspi1_fck = {
1578 .name = "mcspi1_fck",
1579 .ops = &clkops_omap2_dflt_wait,
1580 .parent = &core_48m_fck,
1581 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1582 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1583 .recalc = &followparent_recalc,
1584 .clkdm_name = "core_l4_clkdm",
1585};
1586
1587static struct clk uart2_fck = {
1588 .name = "uart2_fck",
1589 .ops = &clkops_omap2_dflt_wait,
1590 .parent = &core_48m_fck,
1591 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1592 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1593 .clkdm_name = "core_l4_clkdm",
1594 .recalc = &followparent_recalc,
1595};
1596
1597static struct clk uart1_fck = {
1598 .name = "uart1_fck",
1599 .ops = &clkops_omap2_dflt_wait,
1600 .parent = &core_48m_fck,
1601 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1602 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1603 .clkdm_name = "core_l4_clkdm",
1604 .recalc = &followparent_recalc,
1605};
1606
1607static struct clk fshostusb_fck = {
1608 .name = "fshostusb_fck",
1609 .ops = &clkops_omap2_dflt_wait,
1610 .parent = &core_48m_fck,
1611 .clkdm_name = "core_l4_clkdm",
1612 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1613 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1614 .recalc = &followparent_recalc,
1615};
1616
1617/* CORE_12M_FCK based clocks */
1618
1619static struct clk core_12m_fck = {
1620 .name = "core_12m_fck",
1621 .ops = &clkops_null,
1622 .parent = &omap_12m_fck,
1623 .clkdm_name = "core_l4_clkdm",
1624 .recalc = &followparent_recalc,
1625};
1626
1627static struct clk hdq_fck = {
1628 .name = "hdq_fck",
1629 .ops = &clkops_omap2_dflt_wait,
1630 .parent = &core_12m_fck,
1631 .clkdm_name = "core_l4_clkdm",
1632 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1633 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1634 .recalc = &followparent_recalc,
1635};
1636
1637/* DPLL3-derived clock */
1638
1639static const struct clksel_rate ssi_ssr_corex2_rates[] = {
1640 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1641 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1642 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
1643 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1644 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
1645 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
1646 { .div = 0 }
1647};
1648
1649static const struct clksel ssi_ssr_clksel[] = {
1650 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
1651 { .parent = NULL }
1652};
1653
1654static struct clk ssi_ssr_fck_3430es1 = {
1655 .name = "ssi_ssr_fck",
1656 .ops = &clkops_omap2_dflt,
1657 .init = &omap2_init_clksel_parent,
1658 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1659 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1660 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1661 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1662 .clksel = ssi_ssr_clksel,
1663 .clkdm_name = "core_l4_clkdm",
1664 .recalc = &omap2_clksel_recalc,
1665};
1666
1667static struct clk ssi_ssr_fck_3430es2 = {
1668 .name = "ssi_ssr_fck",
1669 .ops = &clkops_omap3430es2_ssi_wait,
1670 .init = &omap2_init_clksel_parent,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1672 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1673 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1674 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1675 .clksel = ssi_ssr_clksel,
1676 .clkdm_name = "core_l4_clkdm",
1677 .recalc = &omap2_clksel_recalc,
1678};
1679
1680static struct clk ssi_sst_fck_3430es1 = {
1681 .name = "ssi_sst_fck",
1682 .ops = &clkops_null,
1683 .parent = &ssi_ssr_fck_3430es1,
1684 .fixed_div = 2,
1685 .recalc = &omap_fixed_divisor_recalc,
1686};
1687
1688static struct clk ssi_sst_fck_3430es2 = {
1689 .name = "ssi_sst_fck",
1690 .ops = &clkops_null,
1691 .parent = &ssi_ssr_fck_3430es2,
1692 .fixed_div = 2,
1693 .recalc = &omap_fixed_divisor_recalc,
1694};
1695
1696
1697
1698/* CORE_L3_ICK based clocks */
1699
1700/*
1701 * XXX must add clk_enable/clk_disable for these if standard code won't
1702 * handle it
1703 */
1704static struct clk core_l3_ick = {
1705 .name = "core_l3_ick",
1706 .ops = &clkops_null,
1707 .parent = &l3_ick,
1708 .clkdm_name = "core_l3_clkdm",
1709 .recalc = &followparent_recalc,
1710};
1711
1712static struct clk hsotgusb_ick_3430es1 = {
1713 .name = "hsotgusb_ick",
1714 .ops = &clkops_omap2_iclk_dflt,
1715 .parent = &core_l3_ick,
1716 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1717 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1718 .clkdm_name = "core_l3_clkdm",
1719 .recalc = &followparent_recalc,
1720};
1721
1722static struct clk hsotgusb_ick_3430es2 = {
1723 .name = "hsotgusb_ick",
1724 .ops = &clkops_omap3430es2_iclk_hsotgusb_wait,
1725 .parent = &core_l3_ick,
1726 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1727 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1728 .clkdm_name = "core_l3_clkdm",
1729 .recalc = &followparent_recalc,
1730};
1731
1732/* This interface clock does not have a CM_AUTOIDLE bit */
1733static struct clk sdrc_ick = {
1734 .name = "sdrc_ick",
1735 .ops = &clkops_omap2_dflt_wait,
1736 .parent = &core_l3_ick,
1737 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1738 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
1739 .flags = ENABLE_ON_INIT,
1740 .clkdm_name = "core_l3_clkdm",
1741 .recalc = &followparent_recalc,
1742};
1743
1744static struct clk gpmc_fck = {
1745 .name = "gpmc_fck",
1746 .ops = &clkops_null,
1747 .parent = &core_l3_ick,
1748 .flags = ENABLE_ON_INIT, /* huh? */
1749 .clkdm_name = "core_l3_clkdm",
1750 .recalc = &followparent_recalc,
1751};
1752
1753/* SECURITY_L3_ICK based clocks */
1754
1755static struct clk security_l3_ick = {
1756 .name = "security_l3_ick",
1757 .ops = &clkops_null,
1758 .parent = &l3_ick,
1759 .recalc = &followparent_recalc,
1760};
1761
1762static struct clk pka_ick = {
1763 .name = "pka_ick",
1764 .ops = &clkops_omap2_iclk_dflt_wait,
1765 .parent = &security_l3_ick,
1766 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1767 .enable_bit = OMAP3430_EN_PKA_SHIFT,
1768 .recalc = &followparent_recalc,
1769};
1770
1771/* CORE_L4_ICK based clocks */
1772
1773static struct clk core_l4_ick = {
1774 .name = "core_l4_ick",
1775 .ops = &clkops_null,
1776 .parent = &l4_ick,
1777 .clkdm_name = "core_l4_clkdm",
1778 .recalc = &followparent_recalc,
1779};
1780
1781static struct clk usbtll_ick = {
1782 .name = "usbtll_ick",
1783 .ops = &clkops_omap2_iclk_dflt_wait,
1784 .parent = &core_l4_ick,
1785 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1786 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1787 .clkdm_name = "core_l4_clkdm",
1788 .recalc = &followparent_recalc,
1789};
1790
1791static struct clk mmchs3_ick = {
1792 .name = "mmchs3_ick",
1793 .ops = &clkops_omap2_iclk_dflt_wait,
1794 .parent = &core_l4_ick,
1795 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1796 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1797 .clkdm_name = "core_l4_clkdm",
1798 .recalc = &followparent_recalc,
1799};
1800
1801/* Intersystem Communication Registers - chassis mode only */
1802static struct clk icr_ick = {
1803 .name = "icr_ick",
1804 .ops = &clkops_omap2_iclk_dflt_wait,
1805 .parent = &core_l4_ick,
1806 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1807 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1808 .clkdm_name = "core_l4_clkdm",
1809 .recalc = &followparent_recalc,
1810};
1811
1812static struct clk aes2_ick = {
1813 .name = "aes2_ick",
1814 .ops = &clkops_omap2_iclk_dflt_wait,
1815 .parent = &core_l4_ick,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1817 .enable_bit = OMAP3430_EN_AES2_SHIFT,
1818 .clkdm_name = "core_l4_clkdm",
1819 .recalc = &followparent_recalc,
1820};
1821
1822static struct clk sha12_ick = {
1823 .name = "sha12_ick",
1824 .ops = &clkops_omap2_iclk_dflt_wait,
1825 .parent = &core_l4_ick,
1826 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1827 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
1828 .clkdm_name = "core_l4_clkdm",
1829 .recalc = &followparent_recalc,
1830};
1831
1832static struct clk des2_ick = {
1833 .name = "des2_ick",
1834 .ops = &clkops_omap2_iclk_dflt_wait,
1835 .parent = &core_l4_ick,
1836 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1837 .enable_bit = OMAP3430_EN_DES2_SHIFT,
1838 .clkdm_name = "core_l4_clkdm",
1839 .recalc = &followparent_recalc,
1840};
1841
1842static struct clk mmchs2_ick = {
1843 .name = "mmchs2_ick",
1844 .ops = &clkops_omap2_iclk_dflt_wait,
1845 .parent = &core_l4_ick,
1846 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1847 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1848 .clkdm_name = "core_l4_clkdm",
1849 .recalc = &followparent_recalc,
1850};
1851
1852static struct clk mmchs1_ick = {
1853 .name = "mmchs1_ick",
1854 .ops = &clkops_omap2_iclk_dflt_wait,
1855 .parent = &core_l4_ick,
1856 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1857 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1858 .clkdm_name = "core_l4_clkdm",
1859 .recalc = &followparent_recalc,
1860};
1861
1862static struct clk mspro_ick = {
1863 .name = "mspro_ick",
1864 .ops = &clkops_omap2_iclk_dflt_wait,
1865 .parent = &core_l4_ick,
1866 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1867 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1868 .clkdm_name = "core_l4_clkdm",
1869 .recalc = &followparent_recalc,
1870};
1871
1872static struct clk hdq_ick = {
1873 .name = "hdq_ick",
1874 .ops = &clkops_omap2_iclk_dflt_wait,
1875 .parent = &core_l4_ick,
1876 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1877 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1878 .clkdm_name = "core_l4_clkdm",
1879 .recalc = &followparent_recalc,
1880};
1881
1882static struct clk mcspi4_ick = {
1883 .name = "mcspi4_ick",
1884 .ops = &clkops_omap2_iclk_dflt_wait,
1885 .parent = &core_l4_ick,
1886 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1887 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1888 .clkdm_name = "core_l4_clkdm",
1889 .recalc = &followparent_recalc,
1890};
1891
1892static struct clk mcspi3_ick = {
1893 .name = "mcspi3_ick",
1894 .ops = &clkops_omap2_iclk_dflt_wait,
1895 .parent = &core_l4_ick,
1896 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1897 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1898 .clkdm_name = "core_l4_clkdm",
1899 .recalc = &followparent_recalc,
1900};
1901
1902static struct clk mcspi2_ick = {
1903 .name = "mcspi2_ick",
1904 .ops = &clkops_omap2_iclk_dflt_wait,
1905 .parent = &core_l4_ick,
1906 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1907 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1908 .clkdm_name = "core_l4_clkdm",
1909 .recalc = &followparent_recalc,
1910};
1911
1912static struct clk mcspi1_ick = {
1913 .name = "mcspi1_ick",
1914 .ops = &clkops_omap2_iclk_dflt_wait,
1915 .parent = &core_l4_ick,
1916 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1917 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1918 .clkdm_name = "core_l4_clkdm",
1919 .recalc = &followparent_recalc,
1920};
1921
1922static struct clk i2c3_ick = {
1923 .name = "i2c3_ick",
1924 .ops = &clkops_omap2_iclk_dflt_wait,
1925 .parent = &core_l4_ick,
1926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1927 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1928 .clkdm_name = "core_l4_clkdm",
1929 .recalc = &followparent_recalc,
1930};
1931
1932static struct clk i2c2_ick = {
1933 .name = "i2c2_ick",
1934 .ops = &clkops_omap2_iclk_dflt_wait,
1935 .parent = &core_l4_ick,
1936 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1937 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1938 .clkdm_name = "core_l4_clkdm",
1939 .recalc = &followparent_recalc,
1940};
1941
1942static struct clk i2c1_ick = {
1943 .name = "i2c1_ick",
1944 .ops = &clkops_omap2_iclk_dflt_wait,
1945 .parent = &core_l4_ick,
1946 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1947 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1948 .clkdm_name = "core_l4_clkdm",
1949 .recalc = &followparent_recalc,
1950};
1951
1952static struct clk uart2_ick = {
1953 .name = "uart2_ick",
1954 .ops = &clkops_omap2_iclk_dflt_wait,
1955 .parent = &core_l4_ick,
1956 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1957 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1958 .clkdm_name = "core_l4_clkdm",
1959 .recalc = &followparent_recalc,
1960};
1961
1962static struct clk uart1_ick = {
1963 .name = "uart1_ick",
1964 .ops = &clkops_omap2_iclk_dflt_wait,
1965 .parent = &core_l4_ick,
1966 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1967 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1968 .clkdm_name = "core_l4_clkdm",
1969 .recalc = &followparent_recalc,
1970};
1971
1972static struct clk gpt11_ick = {
1973 .name = "gpt11_ick",
1974 .ops = &clkops_omap2_iclk_dflt_wait,
1975 .parent = &core_l4_ick,
1976 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1977 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1978 .clkdm_name = "core_l4_clkdm",
1979 .recalc = &followparent_recalc,
1980};
1981
1982static struct clk gpt10_ick = {
1983 .name = "gpt10_ick",
1984 .ops = &clkops_omap2_iclk_dflt_wait,
1985 .parent = &core_l4_ick,
1986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1987 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1988 .clkdm_name = "core_l4_clkdm",
1989 .recalc = &followparent_recalc,
1990};
1991
1992static struct clk mcbsp5_ick = {
1993 .name = "mcbsp5_ick",
1994 .ops = &clkops_omap2_iclk_dflt_wait,
1995 .parent = &core_l4_ick,
1996 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1997 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1998 .clkdm_name = "core_l4_clkdm",
1999 .recalc = &followparent_recalc,
2000};
2001
2002static struct clk mcbsp1_ick = {
2003 .name = "mcbsp1_ick",
2004 .ops = &clkops_omap2_iclk_dflt_wait,
2005 .parent = &core_l4_ick,
2006 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2007 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2008 .clkdm_name = "core_l4_clkdm",
2009 .recalc = &followparent_recalc,
2010};
2011
2012static struct clk fac_ick = {
2013 .name = "fac_ick",
2014 .ops = &clkops_omap2_iclk_dflt_wait,
2015 .parent = &core_l4_ick,
2016 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2017 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
2018 .clkdm_name = "core_l4_clkdm",
2019 .recalc = &followparent_recalc,
2020};
2021
2022static struct clk mailboxes_ick = {
2023 .name = "mailboxes_ick",
2024 .ops = &clkops_omap2_iclk_dflt_wait,
2025 .parent = &core_l4_ick,
2026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2027 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2028 .clkdm_name = "core_l4_clkdm",
2029 .recalc = &followparent_recalc,
2030};
2031
2032static struct clk omapctrl_ick = {
2033 .name = "omapctrl_ick",
2034 .ops = &clkops_omap2_iclk_dflt_wait,
2035 .parent = &core_l4_ick,
2036 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2037 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2038 .flags = ENABLE_ON_INIT,
2039 .clkdm_name = "core_l4_clkdm",
2040 .recalc = &followparent_recalc,
2041};
2042
2043/* SSI_L4_ICK based clocks */
2044
2045static struct clk ssi_l4_ick = {
2046 .name = "ssi_l4_ick",
2047 .ops = &clkops_null,
2048 .parent = &l4_ick,
2049 .clkdm_name = "core_l4_clkdm",
2050 .recalc = &followparent_recalc,
2051};
2052
2053static struct clk ssi_ick_3430es1 = {
2054 .name = "ssi_ick",
2055 .ops = &clkops_omap2_iclk_dflt,
2056 .parent = &ssi_l4_ick,
2057 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2058 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2059 .clkdm_name = "core_l4_clkdm",
2060 .recalc = &followparent_recalc,
2061};
2062
2063static struct clk ssi_ick_3430es2 = {
2064 .name = "ssi_ick",
2065 .ops = &clkops_omap3430es2_iclk_ssi_wait,
2066 .parent = &ssi_l4_ick,
2067 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2068 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2069 .clkdm_name = "core_l4_clkdm",
2070 .recalc = &followparent_recalc,
2071};
2072
2073/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
2074 * but l4_ick makes more sense to me */
2075
2076static const struct clksel usb_l4_clksel[] = {
2077 { .parent = &l4_ick, .rates = div2_rates },
2078 { .parent = NULL },
2079};
2080
2081static struct clk usb_l4_ick = {
2082 .name = "usb_l4_ick",
2083 .ops = &clkops_omap2_iclk_dflt_wait,
2084 .parent = &l4_ick,
2085 .init = &omap2_init_clksel_parent,
2086 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2087 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2088 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2089 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2090 .clksel = usb_l4_clksel,
2091 .clkdm_name = "core_l4_clkdm",
2092 .recalc = &omap2_clksel_recalc,
2093};
2094
2095/* SECURITY_L4_ICK2 based clocks */
2096
2097static struct clk security_l4_ick2 = {
2098 .name = "security_l4_ick2",
2099 .ops = &clkops_null,
2100 .parent = &l4_ick,
2101 .recalc = &followparent_recalc,
2102};
2103
2104static struct clk aes1_ick = {
2105 .name = "aes1_ick",
2106 .ops = &clkops_omap2_iclk_dflt_wait,
2107 .parent = &security_l4_ick2,
2108 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2109 .enable_bit = OMAP3430_EN_AES1_SHIFT,
2110 .recalc = &followparent_recalc,
2111};
2112
2113static struct clk rng_ick = {
2114 .name = "rng_ick",
2115 .ops = &clkops_omap2_iclk_dflt_wait,
2116 .parent = &security_l4_ick2,
2117 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2118 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2119 .recalc = &followparent_recalc,
2120};
2121
2122static struct clk sha11_ick = {
2123 .name = "sha11_ick",
2124 .ops = &clkops_omap2_iclk_dflt_wait,
2125 .parent = &security_l4_ick2,
2126 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2127 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2128 .recalc = &followparent_recalc,
2129};
2130
2131static struct clk des1_ick = {
2132 .name = "des1_ick",
2133 .ops = &clkops_omap2_iclk_dflt_wait,
2134 .parent = &security_l4_ick2,
2135 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2136 .enable_bit = OMAP3430_EN_DES1_SHIFT,
2137 .recalc = &followparent_recalc,
2138};
2139
2140/* DSS */
2141static struct clk dss1_alwon_fck_3430es1 = {
2142 .name = "dss1_alwon_fck",
2143 .ops = &clkops_omap2_dflt,
2144 .parent = &dpll4_m4x2_ck,
2145 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2146 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2147 .clkdm_name = "dss_clkdm",
2148 .recalc = &followparent_recalc,
2149};
2150
2151static struct clk dss1_alwon_fck_3430es2 = {
2152 .name = "dss1_alwon_fck",
2153 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2154 .parent = &dpll4_m4x2_ck,
2155 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2156 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2157 .clkdm_name = "dss_clkdm",
2158 .recalc = &followparent_recalc,
2159};
2160
2161static struct clk dss_tv_fck = {
2162 .name = "dss_tv_fck",
2163 .ops = &clkops_omap2_dflt,
2164 .parent = &omap_54m_fck,
2165 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2166 .enable_bit = OMAP3430_EN_TV_SHIFT,
2167 .clkdm_name = "dss_clkdm",
2168 .recalc = &followparent_recalc,
2169};
2170
2171static struct clk dss_96m_fck = {
2172 .name = "dss_96m_fck",
2173 .ops = &clkops_omap2_dflt,
2174 .parent = &omap_96m_fck,
2175 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2176 .enable_bit = OMAP3430_EN_TV_SHIFT,
2177 .clkdm_name = "dss_clkdm",
2178 .recalc = &followparent_recalc,
2179};
2180
2181static struct clk dss2_alwon_fck = {
2182 .name = "dss2_alwon_fck",
2183 .ops = &clkops_omap2_dflt,
2184 .parent = &sys_ck,
2185 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2186 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
2187 .clkdm_name = "dss_clkdm",
2188 .recalc = &followparent_recalc,
2189};
2190
2191static struct clk dss_ick_3430es1 = {
2192 /* Handles both L3 and L4 clocks */
2193 .name = "dss_ick",
2194 .ops = &clkops_omap2_iclk_dflt,
2195 .parent = &l4_ick,
2196 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2197 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2198 .clkdm_name = "dss_clkdm",
2199 .recalc = &followparent_recalc,
2200};
2201
2202static struct clk dss_ick_3430es2 = {
2203 /* Handles both L3 and L4 clocks */
2204 .name = "dss_ick",
2205 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2206 .parent = &l4_ick,
2207 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2208 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2209 .clkdm_name = "dss_clkdm",
2210 .recalc = &followparent_recalc,
2211};
2212
2213/* CAM */
2214
2215static struct clk cam_mclk = {
2216 .name = "cam_mclk",
2217 .ops = &clkops_omap2_dflt,
2218 .parent = &dpll4_m5x2_ck,
2219 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2220 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2221 .clkdm_name = "cam_clkdm",
2222 .recalc = &followparent_recalc,
2223};
2224
2225static struct clk cam_ick = {
2226 /* Handles both L3 and L4 clocks */
2227 .name = "cam_ick",
2228 .ops = &clkops_omap2_iclk_dflt,
2229 .parent = &l4_ick,
2230 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2231 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2232 .clkdm_name = "cam_clkdm",
2233 .recalc = &followparent_recalc,
2234};
2235
2236static struct clk csi2_96m_fck = {
2237 .name = "csi2_96m_fck",
2238 .ops = &clkops_omap2_dflt,
2239 .parent = &core_96m_fck,
2240 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2241 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
2242 .clkdm_name = "cam_clkdm",
2243 .recalc = &followparent_recalc,
2244};
2245
2246/* USBHOST - 3430ES2 only */
2247
2248static struct clk usbhost_120m_fck = {
2249 .name = "usbhost_120m_fck",
2250 .ops = &clkops_omap2_dflt,
2251 .parent = &dpll5_m2_ck,
2252 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2253 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2254 .clkdm_name = "usbhost_clkdm",
2255 .recalc = &followparent_recalc,
2256};
2257
2258static struct clk usbhost_48m_fck = {
2259 .name = "usbhost_48m_fck",
2260 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2261 .parent = &omap_48m_fck,
2262 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2263 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
2264 .clkdm_name = "usbhost_clkdm",
2265 .recalc = &followparent_recalc,
2266};
2267
2268static struct clk usbhost_ick = {
2269 /* Handles both L3 and L4 clocks */
2270 .name = "usbhost_ick",
2271 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2272 .parent = &l4_ick,
2273 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2274 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
2275 .clkdm_name = "usbhost_clkdm",
2276 .recalc = &followparent_recalc,
2277};
2278
2279/* WKUP */
2280
2281static const struct clksel_rate usim_96m_rates[] = {
2282 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
2283 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2284 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
2285 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
2286 { .div = 0 },
2287};
2288
2289static const struct clksel_rate usim_120m_rates[] = {
2290 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
2291 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2292 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
2293 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
2294 { .div = 0 },
2295};
2296
2297static const struct clksel usim_clksel[] = {
2298 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
2299 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
2300 { .parent = &sys_ck, .rates = div2_rates },
2301 { .parent = NULL },
2302};
2303
2304/* 3430ES2 only */
2305static struct clk usim_fck = {
2306 .name = "usim_fck",
2307 .ops = &clkops_omap2_dflt_wait,
2308 .init = &omap2_init_clksel_parent,
2309 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2310 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2311 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2312 .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK,
2313 .clksel = usim_clksel,
2314 .recalc = &omap2_clksel_recalc,
2315};
2316
2317/* XXX should gpt1's clksel have wkup_32k_fck as the 32k opt? */
2318static struct clk gpt1_fck = {
2319 .name = "gpt1_fck",
2320 .ops = &clkops_omap2_dflt_wait,
2321 .init = &omap2_init_clksel_parent,
2322 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2323 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2324 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2325 .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK,
2326 .clksel = omap343x_gpt_clksel,
2327 .clkdm_name = "wkup_clkdm",
2328 .recalc = &omap2_clksel_recalc,
2329};
2330
2331static struct clk wkup_32k_fck = {
2332 .name = "wkup_32k_fck",
2333 .ops = &clkops_null,
2334 .parent = &omap_32k_fck,
2335 .clkdm_name = "wkup_clkdm",
2336 .recalc = &followparent_recalc,
2337};
2338
2339static struct clk gpio1_dbck = {
2340 .name = "gpio1_dbck",
2341 .ops = &clkops_omap2_dflt,
2342 .parent = &wkup_32k_fck,
2343 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2344 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2345 .clkdm_name = "wkup_clkdm",
2346 .recalc = &followparent_recalc,
2347};
2348
2349static struct clk wdt2_fck = {
2350 .name = "wdt2_fck",
2351 .ops = &clkops_omap2_dflt_wait,
2352 .parent = &wkup_32k_fck,
2353 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2354 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2355 .clkdm_name = "wkup_clkdm",
2356 .recalc = &followparent_recalc,
2357};
2358
2359static struct clk wkup_l4_ick = {
2360 .name = "wkup_l4_ick",
2361 .ops = &clkops_null,
2362 .parent = &sys_ck,
2363 .clkdm_name = "wkup_clkdm",
2364 .recalc = &followparent_recalc,
2365};
2366
2367/* 3430ES2 only */
2368/* Never specifically named in the TRM, so we have to infer a likely name */
2369static struct clk usim_ick = {
2370 .name = "usim_ick",
2371 .ops = &clkops_omap2_iclk_dflt_wait,
2372 .parent = &wkup_l4_ick,
2373 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2374 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2375 .clkdm_name = "wkup_clkdm",
2376 .recalc = &followparent_recalc,
2377};
2378
2379static struct clk wdt2_ick = {
2380 .name = "wdt2_ick",
2381 .ops = &clkops_omap2_iclk_dflt_wait,
2382 .parent = &wkup_l4_ick,
2383 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2384 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2385 .clkdm_name = "wkup_clkdm",
2386 .recalc = &followparent_recalc,
2387};
2388
2389static struct clk wdt1_ick = {
2390 .name = "wdt1_ick",
2391 .ops = &clkops_omap2_iclk_dflt_wait,
2392 .parent = &wkup_l4_ick,
2393 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2394 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
2395 .clkdm_name = "wkup_clkdm",
2396 .recalc = &followparent_recalc,
2397};
2398
2399static struct clk gpio1_ick = {
2400 .name = "gpio1_ick",
2401 .ops = &clkops_omap2_iclk_dflt_wait,
2402 .parent = &wkup_l4_ick,
2403 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2404 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2405 .clkdm_name = "wkup_clkdm",
2406 .recalc = &followparent_recalc,
2407};
2408
2409static struct clk omap_32ksync_ick = {
2410 .name = "omap_32ksync_ick",
2411 .ops = &clkops_omap2_iclk_dflt_wait,
2412 .parent = &wkup_l4_ick,
2413 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2414 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2415 .clkdm_name = "wkup_clkdm",
2416 .recalc = &followparent_recalc,
2417};
2418
2419/* XXX This clock no longer exists in 3430 TRM rev F */
2420static struct clk gpt12_ick = {
2421 .name = "gpt12_ick",
2422 .ops = &clkops_omap2_iclk_dflt_wait,
2423 .parent = &wkup_l4_ick,
2424 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2425 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
2426 .clkdm_name = "wkup_clkdm",
2427 .recalc = &followparent_recalc,
2428};
2429
2430static struct clk gpt1_ick = {
2431 .name = "gpt1_ick",
2432 .ops = &clkops_omap2_iclk_dflt_wait,
2433 .parent = &wkup_l4_ick,
2434 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2435 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2436 .clkdm_name = "wkup_clkdm",
2437 .recalc = &followparent_recalc,
2438};
2439
2440
2441
2442/* PER clock domain */
2443
2444static struct clk per_96m_fck = {
2445 .name = "per_96m_fck",
2446 .ops = &clkops_null,
2447 .parent = &omap_96m_alwon_fck,
2448 .clkdm_name = "per_clkdm",
2449 .recalc = &followparent_recalc,
2450};
2451
2452static struct clk per_48m_fck = {
2453 .name = "per_48m_fck",
2454 .ops = &clkops_null,
2455 .parent = &omap_48m_fck,
2456 .clkdm_name = "per_clkdm",
2457 .recalc = &followparent_recalc,
2458};
2459
2460static struct clk uart3_fck = {
2461 .name = "uart3_fck",
2462 .ops = &clkops_omap2_dflt_wait,
2463 .parent = &per_48m_fck,
2464 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2465 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2466 .clkdm_name = "per_clkdm",
2467 .recalc = &followparent_recalc,
2468};
2469
2470static struct clk uart4_fck = {
2471 .name = "uart4_fck",
2472 .ops = &clkops_omap2_dflt_wait,
2473 .parent = &per_48m_fck,
2474 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2475 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2476 .clkdm_name = "per_clkdm",
2477 .recalc = &followparent_recalc,
2478};
2479
2480static struct clk uart4_fck_am35xx = {
2481 .name = "uart4_fck",
2482 .ops = &clkops_omap2_dflt_wait,
2483 .parent = &core_48m_fck,
2484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2485 .enable_bit = AM35XX_EN_UART4_SHIFT,
2486 .clkdm_name = "core_l4_clkdm",
2487 .recalc = &followparent_recalc,
2488};
2489
2490static struct clk gpt2_fck = {
2491 .name = "gpt2_fck",
2492 .ops = &clkops_omap2_dflt_wait,
2493 .init = &omap2_init_clksel_parent,
2494 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2495 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2496 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2497 .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK,
2498 .clksel = omap343x_gpt_clksel,
2499 .clkdm_name = "per_clkdm",
2500 .recalc = &omap2_clksel_recalc,
2501};
2502
2503static struct clk gpt3_fck = {
2504 .name = "gpt3_fck",
2505 .ops = &clkops_omap2_dflt_wait,
2506 .init = &omap2_init_clksel_parent,
2507 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2508 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2509 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2510 .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK,
2511 .clksel = omap343x_gpt_clksel,
2512 .clkdm_name = "per_clkdm",
2513 .recalc = &omap2_clksel_recalc,
2514};
2515
2516static struct clk gpt4_fck = {
2517 .name = "gpt4_fck",
2518 .ops = &clkops_omap2_dflt_wait,
2519 .init = &omap2_init_clksel_parent,
2520 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2521 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2522 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2523 .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK,
2524 .clksel = omap343x_gpt_clksel,
2525 .clkdm_name = "per_clkdm",
2526 .recalc = &omap2_clksel_recalc,
2527};
2528
2529static struct clk gpt5_fck = {
2530 .name = "gpt5_fck",
2531 .ops = &clkops_omap2_dflt_wait,
2532 .init = &omap2_init_clksel_parent,
2533 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2534 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2535 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2536 .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK,
2537 .clksel = omap343x_gpt_clksel,
2538 .clkdm_name = "per_clkdm",
2539 .recalc = &omap2_clksel_recalc,
2540};
2541
2542static struct clk gpt6_fck = {
2543 .name = "gpt6_fck",
2544 .ops = &clkops_omap2_dflt_wait,
2545 .init = &omap2_init_clksel_parent,
2546 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2547 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2548 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2549 .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK,
2550 .clksel = omap343x_gpt_clksel,
2551 .clkdm_name = "per_clkdm",
2552 .recalc = &omap2_clksel_recalc,
2553};
2554
2555static struct clk gpt7_fck = {
2556 .name = "gpt7_fck",
2557 .ops = &clkops_omap2_dflt_wait,
2558 .init = &omap2_init_clksel_parent,
2559 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2560 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2561 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2562 .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK,
2563 .clksel = omap343x_gpt_clksel,
2564 .clkdm_name = "per_clkdm",
2565 .recalc = &omap2_clksel_recalc,
2566};
2567
2568static struct clk gpt8_fck = {
2569 .name = "gpt8_fck",
2570 .ops = &clkops_omap2_dflt_wait,
2571 .init = &omap2_init_clksel_parent,
2572 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2573 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2574 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2575 .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK,
2576 .clksel = omap343x_gpt_clksel,
2577 .clkdm_name = "per_clkdm",
2578 .recalc = &omap2_clksel_recalc,
2579};
2580
2581static struct clk gpt9_fck = {
2582 .name = "gpt9_fck",
2583 .ops = &clkops_omap2_dflt_wait,
2584 .init = &omap2_init_clksel_parent,
2585 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2586 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2587 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2588 .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK,
2589 .clksel = omap343x_gpt_clksel,
2590 .clkdm_name = "per_clkdm",
2591 .recalc = &omap2_clksel_recalc,
2592};
2593
2594static struct clk per_32k_alwon_fck = {
2595 .name = "per_32k_alwon_fck",
2596 .ops = &clkops_null,
2597 .parent = &omap_32k_fck,
2598 .clkdm_name = "per_clkdm",
2599 .recalc = &followparent_recalc,
2600};
2601
2602static struct clk gpio6_dbck = {
2603 .name = "gpio6_dbck",
2604 .ops = &clkops_omap2_dflt,
2605 .parent = &per_32k_alwon_fck,
2606 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2607 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2608 .clkdm_name = "per_clkdm",
2609 .recalc = &followparent_recalc,
2610};
2611
2612static struct clk gpio5_dbck = {
2613 .name = "gpio5_dbck",
2614 .ops = &clkops_omap2_dflt,
2615 .parent = &per_32k_alwon_fck,
2616 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2617 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2618 .clkdm_name = "per_clkdm",
2619 .recalc = &followparent_recalc,
2620};
2621
2622static struct clk gpio4_dbck = {
2623 .name = "gpio4_dbck",
2624 .ops = &clkops_omap2_dflt,
2625 .parent = &per_32k_alwon_fck,
2626 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2627 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2628 .clkdm_name = "per_clkdm",
2629 .recalc = &followparent_recalc,
2630};
2631
2632static struct clk gpio3_dbck = {
2633 .name = "gpio3_dbck",
2634 .ops = &clkops_omap2_dflt,
2635 .parent = &per_32k_alwon_fck,
2636 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2637 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2638 .clkdm_name = "per_clkdm",
2639 .recalc = &followparent_recalc,
2640};
2641
2642static struct clk gpio2_dbck = {
2643 .name = "gpio2_dbck",
2644 .ops = &clkops_omap2_dflt,
2645 .parent = &per_32k_alwon_fck,
2646 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2647 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2648 .clkdm_name = "per_clkdm",
2649 .recalc = &followparent_recalc,
2650};
2651
2652static struct clk wdt3_fck = {
2653 .name = "wdt3_fck",
2654 .ops = &clkops_omap2_dflt_wait,
2655 .parent = &per_32k_alwon_fck,
2656 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2657 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2658 .clkdm_name = "per_clkdm",
2659 .recalc = &followparent_recalc,
2660};
2661
2662static struct clk per_l4_ick = {
2663 .name = "per_l4_ick",
2664 .ops = &clkops_null,
2665 .parent = &l4_ick,
2666 .clkdm_name = "per_clkdm",
2667 .recalc = &followparent_recalc,
2668};
2669
2670static struct clk gpio6_ick = {
2671 .name = "gpio6_ick",
2672 .ops = &clkops_omap2_iclk_dflt_wait,
2673 .parent = &per_l4_ick,
2674 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2675 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2676 .clkdm_name = "per_clkdm",
2677 .recalc = &followparent_recalc,
2678};
2679
2680static struct clk gpio5_ick = {
2681 .name = "gpio5_ick",
2682 .ops = &clkops_omap2_iclk_dflt_wait,
2683 .parent = &per_l4_ick,
2684 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2685 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2686 .clkdm_name = "per_clkdm",
2687 .recalc = &followparent_recalc,
2688};
2689
2690static struct clk gpio4_ick = {
2691 .name = "gpio4_ick",
2692 .ops = &clkops_omap2_iclk_dflt_wait,
2693 .parent = &per_l4_ick,
2694 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2695 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2696 .clkdm_name = "per_clkdm",
2697 .recalc = &followparent_recalc,
2698};
2699
2700static struct clk gpio3_ick = {
2701 .name = "gpio3_ick",
2702 .ops = &clkops_omap2_iclk_dflt_wait,
2703 .parent = &per_l4_ick,
2704 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2705 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2706 .clkdm_name = "per_clkdm",
2707 .recalc = &followparent_recalc,
2708};
2709
2710static struct clk gpio2_ick = {
2711 .name = "gpio2_ick",
2712 .ops = &clkops_omap2_iclk_dflt_wait,
2713 .parent = &per_l4_ick,
2714 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2715 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2716 .clkdm_name = "per_clkdm",
2717 .recalc = &followparent_recalc,
2718};
2719
2720static struct clk wdt3_ick = {
2721 .name = "wdt3_ick",
2722 .ops = &clkops_omap2_iclk_dflt_wait,
2723 .parent = &per_l4_ick,
2724 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2725 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2726 .clkdm_name = "per_clkdm",
2727 .recalc = &followparent_recalc,
2728};
2729
2730static struct clk uart3_ick = {
2731 .name = "uart3_ick",
2732 .ops = &clkops_omap2_iclk_dflt_wait,
2733 .parent = &per_l4_ick,
2734 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2735 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2736 .clkdm_name = "per_clkdm",
2737 .recalc = &followparent_recalc,
2738};
2739
2740static struct clk uart4_ick = {
2741 .name = "uart4_ick",
2742 .ops = &clkops_omap2_iclk_dflt_wait,
2743 .parent = &per_l4_ick,
2744 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2745 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2746 .clkdm_name = "per_clkdm",
2747 .recalc = &followparent_recalc,
2748};
2749
2750static struct clk gpt9_ick = {
2751 .name = "gpt9_ick",
2752 .ops = &clkops_omap2_iclk_dflt_wait,
2753 .parent = &per_l4_ick,
2754 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2755 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2756 .clkdm_name = "per_clkdm",
2757 .recalc = &followparent_recalc,
2758};
2759
2760static struct clk gpt8_ick = {
2761 .name = "gpt8_ick",
2762 .ops = &clkops_omap2_iclk_dflt_wait,
2763 .parent = &per_l4_ick,
2764 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2765 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2766 .clkdm_name = "per_clkdm",
2767 .recalc = &followparent_recalc,
2768};
2769
2770static struct clk gpt7_ick = {
2771 .name = "gpt7_ick",
2772 .ops = &clkops_omap2_iclk_dflt_wait,
2773 .parent = &per_l4_ick,
2774 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2775 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2776 .clkdm_name = "per_clkdm",
2777 .recalc = &followparent_recalc,
2778};
2779
2780static struct clk gpt6_ick = {
2781 .name = "gpt6_ick",
2782 .ops = &clkops_omap2_iclk_dflt_wait,
2783 .parent = &per_l4_ick,
2784 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2785 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2786 .clkdm_name = "per_clkdm",
2787 .recalc = &followparent_recalc,
2788};
2789
2790static struct clk gpt5_ick = {
2791 .name = "gpt5_ick",
2792 .ops = &clkops_omap2_iclk_dflt_wait,
2793 .parent = &per_l4_ick,
2794 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2795 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2796 .clkdm_name = "per_clkdm",
2797 .recalc = &followparent_recalc,
2798};
2799
2800static struct clk gpt4_ick = {
2801 .name = "gpt4_ick",
2802 .ops = &clkops_omap2_iclk_dflt_wait,
2803 .parent = &per_l4_ick,
2804 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2805 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2806 .clkdm_name = "per_clkdm",
2807 .recalc = &followparent_recalc,
2808};
2809
2810static struct clk gpt3_ick = {
2811 .name = "gpt3_ick",
2812 .ops = &clkops_omap2_iclk_dflt_wait,
2813 .parent = &per_l4_ick,
2814 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2815 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2816 .clkdm_name = "per_clkdm",
2817 .recalc = &followparent_recalc,
2818};
2819
2820static struct clk gpt2_ick = {
2821 .name = "gpt2_ick",
2822 .ops = &clkops_omap2_iclk_dflt_wait,
2823 .parent = &per_l4_ick,
2824 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2825 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2826 .clkdm_name = "per_clkdm",
2827 .recalc = &followparent_recalc,
2828};
2829
2830static struct clk mcbsp2_ick = {
2831 .name = "mcbsp2_ick",
2832 .ops = &clkops_omap2_iclk_dflt_wait,
2833 .parent = &per_l4_ick,
2834 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2835 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2836 .clkdm_name = "per_clkdm",
2837 .recalc = &followparent_recalc,
2838};
2839
2840static struct clk mcbsp3_ick = {
2841 .name = "mcbsp3_ick",
2842 .ops = &clkops_omap2_iclk_dflt_wait,
2843 .parent = &per_l4_ick,
2844 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2845 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2846 .clkdm_name = "per_clkdm",
2847 .recalc = &followparent_recalc,
2848};
2849
2850static struct clk mcbsp4_ick = {
2851 .name = "mcbsp4_ick",
2852 .ops = &clkops_omap2_iclk_dflt_wait,
2853 .parent = &per_l4_ick,
2854 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2855 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2856 .clkdm_name = "per_clkdm",
2857 .recalc = &followparent_recalc,
2858};
2859
2860static const struct clksel mcbsp_234_clksel[] = {
2861 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2862 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2863 { .parent = NULL }
2864};
2865
2866static struct clk mcbsp2_fck = {
2867 .name = "mcbsp2_fck",
2868 .ops = &clkops_omap2_dflt_wait,
2869 .init = &omap2_init_clksel_parent,
2870 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2871 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2872 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2873 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
2874 .clksel = mcbsp_234_clksel,
2875 .clkdm_name = "per_clkdm",
2876 .recalc = &omap2_clksel_recalc,
2877};
2878
2879static struct clk mcbsp3_fck = {
2880 .name = "mcbsp3_fck",
2881 .ops = &clkops_omap2_dflt_wait,
2882 .init = &omap2_init_clksel_parent,
2883 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2884 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2885 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2886 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
2887 .clksel = mcbsp_234_clksel,
2888 .clkdm_name = "per_clkdm",
2889 .recalc = &omap2_clksel_recalc,
2890};
2891
2892static struct clk mcbsp4_fck = {
2893 .name = "mcbsp4_fck",
2894 .ops = &clkops_omap2_dflt_wait,
2895 .init = &omap2_init_clksel_parent,
2896 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2897 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2898 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2899 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
2900 .clksel = mcbsp_234_clksel,
2901 .clkdm_name = "per_clkdm",
2902 .recalc = &omap2_clksel_recalc,
2903};
2904
2905/* EMU clocks */
2906
2907/* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */
2908
2909static const struct clksel_rate emu_src_sys_rates[] = {
2910 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2911 { .div = 0 },
2912};
2913
2914static const struct clksel_rate emu_src_core_rates[] = {
2915 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2916 { .div = 0 },
2917};
2918
2919static const struct clksel_rate emu_src_per_rates[] = {
2920 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
2921 { .div = 0 },
2922};
2923
2924static const struct clksel_rate emu_src_mpu_rates[] = {
2925 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2926 { .div = 0 },
2927};
2928
2929static const struct clksel emu_src_clksel[] = {
2930 { .parent = &sys_ck, .rates = emu_src_sys_rates },
2931 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
2932 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
2933 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
2934 { .parent = NULL },
2935};
2936
2937/*
2938 * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only
2939 * to switch the source of some of the EMU clocks.
2940 * XXX Are there CLKEN bits for these EMU clks?
2941 */
2942static struct clk emu_src_ck = {
2943 .name = "emu_src_ck",
2944 .ops = &clkops_null,
2945 .init = &omap2_init_clksel_parent,
2946 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2947 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
2948 .clksel = emu_src_clksel,
2949 .clkdm_name = "emu_clkdm",
2950 .recalc = &omap2_clksel_recalc,
2951};
2952
2953static const struct clksel_rate pclk_emu_rates[] = {
2954 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2955 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2956 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2957 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2958 { .div = 0 },
2959};
2960
2961static const struct clksel pclk_emu_clksel[] = {
2962 { .parent = &emu_src_ck, .rates = pclk_emu_rates },
2963 { .parent = NULL },
2964};
2965
2966static struct clk pclk_fck = {
2967 .name = "pclk_fck",
2968 .ops = &clkops_null,
2969 .init = &omap2_init_clksel_parent,
2970 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2971 .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK,
2972 .clksel = pclk_emu_clksel,
2973 .clkdm_name = "emu_clkdm",
2974 .recalc = &omap2_clksel_recalc,
2975};
2976
2977static const struct clksel_rate pclkx2_emu_rates[] = {
2978 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2979 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2980 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2981 { .div = 0 },
2982};
2983
2984static const struct clksel pclkx2_emu_clksel[] = {
2985 { .parent = &emu_src_ck, .rates = pclkx2_emu_rates },
2986 { .parent = NULL },
2987};
2988
2989static struct clk pclkx2_fck = {
2990 .name = "pclkx2_fck",
2991 .ops = &clkops_null,
2992 .init = &omap2_init_clksel_parent,
2993 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2994 .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK,
2995 .clksel = pclkx2_emu_clksel,
2996 .clkdm_name = "emu_clkdm",
2997 .recalc = &omap2_clksel_recalc,
2998};
2999
3000static const struct clksel atclk_emu_clksel[] = {
3001 { .parent = &emu_src_ck, .rates = div2_rates },
3002 { .parent = NULL },
3003};
3004
3005static struct clk atclk_fck = {
3006 .name = "atclk_fck",
3007 .ops = &clkops_null,
3008 .init = &omap2_init_clksel_parent,
3009 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3010 .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK,
3011 .clksel = atclk_emu_clksel,
3012 .clkdm_name = "emu_clkdm",
3013 .recalc = &omap2_clksel_recalc,
3014};
3015
3016static struct clk traceclk_src_fck = {
3017 .name = "traceclk_src_fck",
3018 .ops = &clkops_null,
3019 .init = &omap2_init_clksel_parent,
3020 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3021 .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK,
3022 .clksel = emu_src_clksel,
3023 .clkdm_name = "emu_clkdm",
3024 .recalc = &omap2_clksel_recalc,
3025};
3026
3027static const struct clksel_rate traceclk_rates[] = {
3028 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
3029 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
3030 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3031 { .div = 0 },
3032};
3033
3034static const struct clksel traceclk_clksel[] = {
3035 { .parent = &traceclk_src_fck, .rates = traceclk_rates },
3036 { .parent = NULL },
3037};
3038
3039static struct clk traceclk_fck = {
3040 .name = "traceclk_fck",
3041 .ops = &clkops_null,
3042 .init = &omap2_init_clksel_parent,
3043 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3044 .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK,
3045 .clksel = traceclk_clksel,
3046 .clkdm_name = "emu_clkdm",
3047 .recalc = &omap2_clksel_recalc,
3048};
3049
3050/* SR clocks */
3051
3052/* SmartReflex fclk (VDD1) */
3053static struct clk smartreflex_mpu_iva_fck = {
3054 .name = "smartreflex_mpu_iva_fck",
3055 .ops = &clkops_omap2_dflt_wait,
3056 .parent = &sys_ck,
3057 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3058 .enable_bit = OMAP3430_EN_SR1_SHIFT,
3059 .clkdm_name = "wkup_clkdm",
3060 .recalc = &followparent_recalc,
3061};
3062
3063/* SmartReflex fclk (VDD2) */
3064static struct clk smartreflex_core_fck = {
3065 .name = "smartreflex_core_fck",
3066 .ops = &clkops_omap2_dflt_wait,
3067 .parent = &sys_ck,
3068 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3069 .enable_bit = OMAP3430_EN_SR2_SHIFT,
3070 .clkdm_name = "wkup_clkdm",
3071 .recalc = &followparent_recalc,
3072};
3073
3074static struct clk sr_l4_ick = {
3075 .name = "sr_l4_ick",
3076 .ops = &clkops_null, /* RMK: missing? */
3077 .parent = &l4_ick,
3078 .clkdm_name = "core_l4_clkdm",
3079 .recalc = &followparent_recalc,
3080};
3081
3082/* SECURE_32K_FCK clocks */
3083
3084static struct clk gpt12_fck = {
3085 .name = "gpt12_fck",
3086 .ops = &clkops_null,
3087 .parent = &secure_32k_fck,
3088 .clkdm_name = "wkup_clkdm",
3089 .recalc = &followparent_recalc,
3090};
3091
3092static struct clk wdt1_fck = {
3093 .name = "wdt1_fck",
3094 .ops = &clkops_null,
3095 .parent = &secure_32k_fck,
3096 .clkdm_name = "wkup_clkdm",
3097 .recalc = &followparent_recalc,
3098};
3099
3100/* Clocks for AM35XX */
3101static struct clk ipss_ick = {
3102 .name = "ipss_ick",
3103 .ops = &clkops_am35xx_ipss_wait,
3104 .parent = &core_l3_ick,
3105 .clkdm_name = "core_l3_clkdm",
3106 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3107 .enable_bit = AM35XX_EN_IPSS_SHIFT,
3108 .recalc = &followparent_recalc,
3109};
3110
3111static struct clk emac_ick = {
3112 .name = "emac_ick",
3113 .ops = &clkops_am35xx_ipss_module_wait,
3114 .parent = &ipss_ick,
3115 .clkdm_name = "core_l3_clkdm",
3116 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3117 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
3118 .recalc = &followparent_recalc,
3119};
3120
3121static struct clk rmii_ck = {
3122 .name = "rmii_ck",
3123 .ops = &clkops_null,
3124 .rate = 50000000,
3125};
3126
3127static struct clk emac_fck = {
3128 .name = "emac_fck",
3129 .ops = &clkops_omap2_dflt,
3130 .parent = &rmii_ck,
3131 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3132 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
3133 .recalc = &followparent_recalc,
3134};
3135
3136static struct clk hsotgusb_ick_am35xx = {
3137 .name = "hsotgusb_ick",
3138 .ops = &clkops_am35xx_ipss_module_wait,
3139 .parent = &ipss_ick,
3140 .clkdm_name = "core_l3_clkdm",
3141 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3142 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
3143 .recalc = &followparent_recalc,
3144};
3145
3146static struct clk hsotgusb_fck_am35xx = {
3147 .name = "hsotgusb_fck",
3148 .ops = &clkops_omap2_dflt,
3149 .parent = &sys_ck,
3150 .clkdm_name = "core_l3_clkdm",
3151 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3152 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
3153 .recalc = &followparent_recalc,
3154};
3155
3156static struct clk hecc_ck = {
3157 .name = "hecc_ck",
3158 .ops = &clkops_am35xx_ipss_module_wait,
3159 .parent = &sys_ck,
3160 .clkdm_name = "core_l3_clkdm",
3161 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3162 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
3163 .recalc = &followparent_recalc,
3164};
3165
3166static struct clk vpfe_ick = {
3167 .name = "vpfe_ick",
3168 .ops = &clkops_am35xx_ipss_module_wait,
3169 .parent = &ipss_ick,
3170 .clkdm_name = "core_l3_clkdm",
3171 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3172 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3173 .recalc = &followparent_recalc,
3174};
3175
3176static struct clk pclk_ck = {
3177 .name = "pclk_ck",
3178 .ops = &clkops_null,
3179 .rate = 27000000,
3180};
3181
3182static struct clk vpfe_fck = {
3183 .name = "vpfe_fck",
3184 .ops = &clkops_omap2_dflt,
3185 .parent = &pclk_ck,
3186 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3187 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3188 .recalc = &followparent_recalc,
3189};
3190
3191/*
3192 * The UART1/2 functional clock acts as the functional clock for
3193 * UART4. No separate fclk control available. XXX Well now we have a
3194 * uart4_fck that is apparently used as the UART4 functional clock,
3195 * but it also seems that uart1_fck or uart2_fck are still needed, at
3196 * least for UART4 softresets to complete. This really needs
3197 * clarification.
3198 */
3199static struct clk uart4_ick_am35xx = {
3200 .name = "uart4_ick",
3201 .ops = &clkops_omap2_iclk_dflt_wait,
3202 .parent = &core_l4_ick,
3203 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3204 .enable_bit = AM35XX_EN_UART4_SHIFT,
3205 .clkdm_name = "core_l4_clkdm",
3206 .recalc = &followparent_recalc,
3207};
3208
3209static struct clk dummy_apb_pclk = {
3210 .name = "apb_pclk",
3211 .ops = &clkops_null,
3212};
3213
3214/*
3215 * clkdev
3216 */
3217
3218static struct omap_clk omap3xxx_clks[] = {
3219 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3220 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3221 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3222 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3223 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3224 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3225 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3226 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3227 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3228 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3229 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3230 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3231 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3232 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3233 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3234 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3235 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3236 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3237 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3238 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3239 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3241 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3242 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3243 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3244 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3245 CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3246 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3247 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3248 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3249 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3250 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3251 CLK(NULL, "omap_96m_alwon_fck_3630", &omap_96m_alwon_fck_3630, CK_36XX),
3252 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3253 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3254 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3255 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3256 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3257 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3261 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3262 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3263 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3264 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3265 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3266 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3267 CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3268 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3269 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3270 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3271 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3272 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3273 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3274 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3275 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3276 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3277 CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3278 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3279 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3280 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3281 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3282 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3283 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3284 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3285 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3286 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3287 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3288 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3289 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3292 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3293 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3294 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3295 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3296 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3297 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3298 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3299 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3300 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3301 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3302 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3303 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3304 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3305 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3306 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3307 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3308 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3309 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3310 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3311 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3312 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3313 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3314 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3315 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3316 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3317 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3318 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3319 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3320 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3321 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3322 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3323 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3324 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3325 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3326 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3327 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3328 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3329 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3330 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3331 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3332 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3333 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3334 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3335 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3336 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3337 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3338 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3339 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3340 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3341 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3342 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3343 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3344 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3345 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3346 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3347 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3348 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3349 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3350 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3351 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3352 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3353 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3354 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3355 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3356 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3357 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3358 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3359 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3360 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3361 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3362 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3363 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3364 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3365 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3366 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3367 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3368 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3369 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3370 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3371 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3372 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3373 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3374 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3375 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3376 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3378 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3379 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3380 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3381 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3382 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3383 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3384 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3385 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3386 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3387 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3388 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3389 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3390 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3391 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3392 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3393 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3394 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3396 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3397 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3398 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3399 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3400 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3401 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3402 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3403 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3404 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3407 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3408 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3409 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3410 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3411 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3412 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3413 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3414 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3415 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3416 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3417 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3418 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3419 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3420 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3421 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3422 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3423 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3424 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3425 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3426 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3427 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3428 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3429 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3430 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3431 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3432 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3433 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3434 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3435 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3436 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3437 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3438 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3439 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3440 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3441 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3442 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3443 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3444 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3445 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3446 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3447 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3448 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3449 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3450 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3451 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3452 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3453 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3454 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3455 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3456 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3457 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3458 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3459 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3460 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3461 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3462 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3463 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3464 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3465 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3466 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3467 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3468 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3469 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3470 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3471 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3472 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3473 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3474 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3475 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3476 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3477 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3478 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3479 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3480 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3481 CLK(NULL, "smartreflex_mpu_iva_fck", &smartreflex_mpu_iva_fck, CK_34XX | CK_36XX),
3482 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_34XX | CK_36XX),
3483 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3484 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3485 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3486 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3487 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3488 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3489 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3490 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3491 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3492 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3493 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3494 CLK(NULL, "vpfe_ick", &emac_ick, CK_AM35XX),
3495 CLK(NULL, "vpfe_fck", &emac_fck, CK_AM35XX),
3496 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3497 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3498 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3499 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3500 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3501 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3502 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3503 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3504 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3505};
3506
3507
3508int __init omap3xxx_clk_init(void)
3509{
3510 struct omap_clk *c;
3511 u32 cpu_clkflg = 0;
3512
3513 if (soc_is_am35xx()) {
3514 cpu_mask = RATE_IN_34XX;
3515 cpu_clkflg = CK_AM35XX;
3516 } else if (cpu_is_omap3630()) {
3517 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3518 cpu_clkflg = CK_36XX;
3519 } else if (cpu_is_ti816x()) {
3520 cpu_mask = RATE_IN_TI816X;
3521 cpu_clkflg = CK_TI816X;
3522 } else if (soc_is_am33xx()) {
3523 cpu_mask = RATE_IN_AM33XX;
3524 } else if (cpu_is_ti814x()) {
3525 cpu_mask = RATE_IN_TI814X;
3526 } else if (cpu_is_omap34xx()) {
3527 if (omap_rev() == OMAP3430_REV_ES1_0) {
3528 cpu_mask = RATE_IN_3430ES1;
3529 cpu_clkflg = CK_3430ES1;
3530 } else {
3531 /*
3532 * Assume that anything that we haven't matched yet
3533 * has 3430ES2-type clocks.
3534 */
3535 cpu_mask = RATE_IN_3430ES2PLUS;
3536 cpu_clkflg = CK_3430ES2PLUS;
3537 }
3538 } else {
3539 WARN(1, "clock: could not identify OMAP3 variant\n");
3540 }
3541
3542 if (omap3_has_192mhz_clk())
3543 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3544
3545 if (cpu_is_omap3630()) {
3546 /*
3547 * XXX This type of dynamic rewriting of the clock tree is
3548 * deprecated and should be revised soon.
3549 *
3550 * For 3630: override clkops_omap2_dflt_wait for the
3551 * clocks affected from PWRDN reset Limitation
3552 */
3553 dpll3_m3x2_ck.ops =
3554 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3555 dpll4_m2x2_ck.ops =
3556 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3557 dpll4_m3x2_ck.ops =
3558 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3559 dpll4_m4x2_ck.ops =
3560 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3561 dpll4_m5x2_ck.ops =
3562 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3563 dpll4_m6x2_ck.ops =
3564 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3565 }
3566
3567 /*
3568 * XXX This type of dynamic rewriting of the clock tree is
3569 * deprecated and should be revised soon.
3570 */
3571 if (cpu_is_omap3630())
3572 dpll4_dd = dpll4_dd_3630;
3573 else
3574 dpll4_dd = dpll4_dd_34xx;
3575
3576 clk_init(&omap2_clk_functions);
3577
3578 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3579 c++)
3580 clk_preinit(c->lk.clk);
3581
3582 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3583 c++)
3584 if (c->cpu & cpu_clkflg) {
3585 clkdev_add(&c->lk);
3586 clk_register(c->lk.clk);
3587 omap2_init_clk_clkdm(c->lk.clk);
3588 }
3589
3590 /* Disable autoidle on all clocks; let the PM code enable it later */
3591 omap_clk_disable_autoidle_all();
3592
3593 recalculate_root_clocks();
3594
3595 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3596 (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
3597 (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
3598
3599 /*
3600 * Only enable those clocks we will need, let the drivers
3601 * enable other clocks as necessary
3602 */
3603 clk_enable_init_clocks();
3604
3605 /*
3606 * Lock DPLL5 -- here only until other device init code can
3607 * handle this
3608 */
3609 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3610 omap3_clk_lock_dpll5();
3611
3612 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3613 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3614 arm_fck_p = clk_get(NULL, "arm_fck");
3615
3616 return 0;
3617}
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
deleted file mode 100644
index dc92e5f4e78e..000000000000
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ /dev/null
@@ -1,3402 +0,0 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.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 * XXX Some of the ES1 clocks have been removed/changed; once support
22 * is added for discriminating clocks by ES level, these should be added back
23 * in.
24 */
25
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/clk.h>
29#include <linux/io.h>
30
31#include <plat/clkdev_omap.h>
32
33#include "soc.h"
34#include "iomap.h"
35#include "clock.h"
36#include "clock44xx.h"
37#include "cm1_44xx.h"
38#include "cm2_44xx.h"
39#include "cm-regbits-44xx.h"
40#include "prm44xx.h"
41#include "prm-regbits-44xx.h"
42#include "control.h"
43#include "scrm44xx.h"
44
45/* OMAP4 modulemode control */
46#define OMAP4430_MODULEMODE_HWCTRL 0
47#define OMAP4430_MODULEMODE_SWCTRL 1
48
49/* Root clocks */
50
51static struct clk extalt_clkin_ck = {
52 .name = "extalt_clkin_ck",
53 .rate = 59000000,
54 .ops = &clkops_null,
55};
56
57static struct clk pad_clks_ck = {
58 .name = "pad_clks_ck",
59 .rate = 12000000,
60 .ops = &clkops_omap2_dflt,
61 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
62 .enable_bit = OMAP4430_PAD_CLKS_GATE_SHIFT,
63};
64
65static struct clk pad_slimbus_core_clks_ck = {
66 .name = "pad_slimbus_core_clks_ck",
67 .rate = 12000000,
68 .ops = &clkops_null,
69};
70
71static struct clk secure_32k_clk_src_ck = {
72 .name = "secure_32k_clk_src_ck",
73 .rate = 32768,
74 .ops = &clkops_null,
75};
76
77static struct clk slimbus_clk = {
78 .name = "slimbus_clk",
79 .rate = 12000000,
80 .ops = &clkops_omap2_dflt,
81 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
82 .enable_bit = OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
83};
84
85static struct clk sys_32k_ck = {
86 .name = "sys_32k_ck",
87 .clkdm_name = "prm_clkdm",
88 .rate = 32768,
89 .ops = &clkops_null,
90};
91
92static struct clk virt_12000000_ck = {
93 .name = "virt_12000000_ck",
94 .ops = &clkops_null,
95 .rate = 12000000,
96};
97
98static struct clk virt_13000000_ck = {
99 .name = "virt_13000000_ck",
100 .ops = &clkops_null,
101 .rate = 13000000,
102};
103
104static struct clk virt_16800000_ck = {
105 .name = "virt_16800000_ck",
106 .ops = &clkops_null,
107 .rate = 16800000,
108};
109
110static struct clk virt_27000000_ck = {
111 .name = "virt_27000000_ck",
112 .ops = &clkops_null,
113 .rate = 27000000,
114};
115
116static struct clk virt_38400000_ck = {
117 .name = "virt_38400000_ck",
118 .ops = &clkops_null,
119 .rate = 38400000,
120};
121
122static const struct clksel_rate div_1_5_rates[] = {
123 { .div = 1, .val = 5, .flags = RATE_IN_4430 },
124 { .div = 0 },
125};
126
127static const struct clksel_rate div_1_6_rates[] = {
128 { .div = 1, .val = 6, .flags = RATE_IN_4430 },
129 { .div = 0 },
130};
131
132static const struct clksel_rate div_1_7_rates[] = {
133 { .div = 1, .val = 7, .flags = RATE_IN_4430 },
134 { .div = 0 },
135};
136
137static const struct clksel sys_clkin_sel[] = {
138 { .parent = &virt_12000000_ck, .rates = div_1_1_rates },
139 { .parent = &virt_13000000_ck, .rates = div_1_2_rates },
140 { .parent = &virt_16800000_ck, .rates = div_1_3_rates },
141 { .parent = &virt_19200000_ck, .rates = div_1_4_rates },
142 { .parent = &virt_26000000_ck, .rates = div_1_5_rates },
143 { .parent = &virt_27000000_ck, .rates = div_1_6_rates },
144 { .parent = &virt_38400000_ck, .rates = div_1_7_rates },
145 { .parent = NULL },
146};
147
148static struct clk sys_clkin_ck = {
149 .name = "sys_clkin_ck",
150 .rate = 38400000,
151 .clksel = sys_clkin_sel,
152 .init = &omap2_init_clksel_parent,
153 .clksel_reg = OMAP4430_CM_SYS_CLKSEL,
154 .clksel_mask = OMAP4430_SYS_CLKSEL_MASK,
155 .ops = &clkops_null,
156 .recalc = &omap2_clksel_recalc,
157};
158
159static struct clk tie_low_clock_ck = {
160 .name = "tie_low_clock_ck",
161 .rate = 0,
162 .ops = &clkops_null,
163};
164
165static struct clk utmi_phy_clkout_ck = {
166 .name = "utmi_phy_clkout_ck",
167 .rate = 60000000,
168 .ops = &clkops_null,
169};
170
171static struct clk xclk60mhsp1_ck = {
172 .name = "xclk60mhsp1_ck",
173 .rate = 60000000,
174 .ops = &clkops_null,
175};
176
177static struct clk xclk60mhsp2_ck = {
178 .name = "xclk60mhsp2_ck",
179 .rate = 60000000,
180 .ops = &clkops_null,
181};
182
183static struct clk xclk60motg_ck = {
184 .name = "xclk60motg_ck",
185 .rate = 60000000,
186 .ops = &clkops_null,
187};
188
189/* Module clocks and DPLL outputs */
190
191static const struct clksel abe_dpll_bypass_clk_mux_sel[] = {
192 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
193 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
194 { .parent = NULL },
195};
196
197static struct clk abe_dpll_bypass_clk_mux_ck = {
198 .name = "abe_dpll_bypass_clk_mux_ck",
199 .parent = &sys_clkin_ck,
200 .ops = &clkops_null,
201 .recalc = &followparent_recalc,
202};
203
204static struct clk abe_dpll_refclk_mux_ck = {
205 .name = "abe_dpll_refclk_mux_ck",
206 .parent = &sys_clkin_ck,
207 .clksel = abe_dpll_bypass_clk_mux_sel,
208 .init = &omap2_init_clksel_parent,
209 .clksel_reg = OMAP4430_CM_ABE_PLL_REF_CLKSEL,
210 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
211 .ops = &clkops_null,
212 .recalc = &omap2_clksel_recalc,
213};
214
215/* DPLL_ABE */
216static struct dpll_data dpll_abe_dd = {
217 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
218 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
219 .clk_ref = &abe_dpll_refclk_mux_ck,
220 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
221 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
222 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
223 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
224 .mult_mask = OMAP4430_DPLL_MULT_MASK,
225 .div1_mask = OMAP4430_DPLL_DIV_MASK,
226 .enable_mask = OMAP4430_DPLL_EN_MASK,
227 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
228 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
229 .max_multiplier = 2047,
230 .max_divider = 128,
231 .min_divider = 1,
232};
233
234
235static struct clk dpll_abe_ck = {
236 .name = "dpll_abe_ck",
237 .parent = &abe_dpll_refclk_mux_ck,
238 .dpll_data = &dpll_abe_dd,
239 .init = &omap2_init_dpll_parent,
240 .ops = &clkops_omap3_noncore_dpll_ops,
241 .recalc = &omap4_dpll_regm4xen_recalc,
242 .round_rate = &omap4_dpll_regm4xen_round_rate,
243 .set_rate = &omap3_noncore_dpll_set_rate,
244};
245
246static struct clk dpll_abe_x2_ck = {
247 .name = "dpll_abe_x2_ck",
248 .parent = &dpll_abe_ck,
249 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
250 .flags = CLOCK_CLKOUTX2,
251 .ops = &clkops_omap4_dpllmx_ops,
252 .recalc = &omap3_clkoutx2_recalc,
253};
254
255static const struct clksel dpll_abe_m2x2_div[] = {
256 { .parent = &dpll_abe_x2_ck, .rates = div31_1to31_rates },
257 { .parent = NULL },
258};
259
260static struct clk dpll_abe_m2x2_ck = {
261 .name = "dpll_abe_m2x2_ck",
262 .parent = &dpll_abe_x2_ck,
263 .clksel = dpll_abe_m2x2_div,
264 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
265 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
266 .ops = &clkops_omap4_dpllmx_ops,
267 .recalc = &omap2_clksel_recalc,
268 .round_rate = &omap2_clksel_round_rate,
269 .set_rate = &omap2_clksel_set_rate,
270};
271
272static struct clk abe_24m_fclk = {
273 .name = "abe_24m_fclk",
274 .parent = &dpll_abe_m2x2_ck,
275 .ops = &clkops_null,
276 .fixed_div = 8,
277 .recalc = &omap_fixed_divisor_recalc,
278};
279
280static const struct clksel_rate div3_1to4_rates[] = {
281 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
282 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
283 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
284 { .div = 0 },
285};
286
287static const struct clksel abe_clk_div[] = {
288 { .parent = &dpll_abe_m2x2_ck, .rates = div3_1to4_rates },
289 { .parent = NULL },
290};
291
292static struct clk abe_clk = {
293 .name = "abe_clk",
294 .parent = &dpll_abe_m2x2_ck,
295 .clksel = abe_clk_div,
296 .clksel_reg = OMAP4430_CM_CLKSEL_ABE,
297 .clksel_mask = OMAP4430_CLKSEL_OPP_MASK,
298 .ops = &clkops_null,
299 .recalc = &omap2_clksel_recalc,
300 .round_rate = &omap2_clksel_round_rate,
301 .set_rate = &omap2_clksel_set_rate,
302};
303
304static const struct clksel_rate div2_1to2_rates[] = {
305 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
306 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
307 { .div = 0 },
308};
309
310static const struct clksel aess_fclk_div[] = {
311 { .parent = &abe_clk, .rates = div2_1to2_rates },
312 { .parent = NULL },
313};
314
315static struct clk aess_fclk = {
316 .name = "aess_fclk",
317 .parent = &abe_clk,
318 .clksel = aess_fclk_div,
319 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
320 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
321 .ops = &clkops_null,
322 .recalc = &omap2_clksel_recalc,
323 .round_rate = &omap2_clksel_round_rate,
324 .set_rate = &omap2_clksel_set_rate,
325};
326
327static struct clk dpll_abe_m3x2_ck = {
328 .name = "dpll_abe_m3x2_ck",
329 .parent = &dpll_abe_x2_ck,
330 .clksel = dpll_abe_m2x2_div,
331 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE,
332 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
333 .ops = &clkops_omap4_dpllmx_ops,
334 .recalc = &omap2_clksel_recalc,
335 .round_rate = &omap2_clksel_round_rate,
336 .set_rate = &omap2_clksel_set_rate,
337};
338
339static const struct clksel core_hsd_byp_clk_mux_sel[] = {
340 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
341 { .parent = &dpll_abe_m3x2_ck, .rates = div_1_1_rates },
342 { .parent = NULL },
343};
344
345static struct clk core_hsd_byp_clk_mux_ck = {
346 .name = "core_hsd_byp_clk_mux_ck",
347 .parent = &sys_clkin_ck,
348 .clksel = core_hsd_byp_clk_mux_sel,
349 .init = &omap2_init_clksel_parent,
350 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
351 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
352 .ops = &clkops_null,
353 .recalc = &omap2_clksel_recalc,
354};
355
356/* DPLL_CORE */
357static struct dpll_data dpll_core_dd = {
358 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
359 .clk_bypass = &core_hsd_byp_clk_mux_ck,
360 .clk_ref = &sys_clkin_ck,
361 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
362 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
363 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
364 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
365 .mult_mask = OMAP4430_DPLL_MULT_MASK,
366 .div1_mask = OMAP4430_DPLL_DIV_MASK,
367 .enable_mask = OMAP4430_DPLL_EN_MASK,
368 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
369 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
370 .max_multiplier = 2047,
371 .max_divider = 128,
372 .min_divider = 1,
373};
374
375
376static struct clk dpll_core_ck = {
377 .name = "dpll_core_ck",
378 .parent = &sys_clkin_ck,
379 .dpll_data = &dpll_core_dd,
380 .init = &omap2_init_dpll_parent,
381 .ops = &clkops_omap3_core_dpll_ops,
382 .recalc = &omap3_dpll_recalc,
383};
384
385static struct clk dpll_core_x2_ck = {
386 .name = "dpll_core_x2_ck",
387 .parent = &dpll_core_ck,
388 .flags = CLOCK_CLKOUTX2,
389 .ops = &clkops_null,
390 .recalc = &omap3_clkoutx2_recalc,
391};
392
393static const struct clksel dpll_core_m6x2_div[] = {
394 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
395 { .parent = NULL },
396};
397
398static struct clk dpll_core_m6x2_ck = {
399 .name = "dpll_core_m6x2_ck",
400 .parent = &dpll_core_x2_ck,
401 .clksel = dpll_core_m6x2_div,
402 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE,
403 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
404 .ops = &clkops_omap4_dpllmx_ops,
405 .recalc = &omap2_clksel_recalc,
406 .round_rate = &omap2_clksel_round_rate,
407 .set_rate = &omap2_clksel_set_rate,
408};
409
410static const struct clksel dbgclk_mux_sel[] = {
411 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
412 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
413 { .parent = NULL },
414};
415
416static struct clk dbgclk_mux_ck = {
417 .name = "dbgclk_mux_ck",
418 .parent = &sys_clkin_ck,
419 .ops = &clkops_null,
420 .recalc = &followparent_recalc,
421};
422
423static const struct clksel dpll_core_m2_div[] = {
424 { .parent = &dpll_core_ck, .rates = div31_1to31_rates },
425 { .parent = NULL },
426};
427
428static struct clk dpll_core_m2_ck = {
429 .name = "dpll_core_m2_ck",
430 .parent = &dpll_core_ck,
431 .clksel = dpll_core_m2_div,
432 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE,
433 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
434 .ops = &clkops_omap4_dpllmx_ops,
435 .recalc = &omap2_clksel_recalc,
436 .round_rate = &omap2_clksel_round_rate,
437 .set_rate = &omap2_clksel_set_rate,
438};
439
440static struct clk ddrphy_ck = {
441 .name = "ddrphy_ck",
442 .parent = &dpll_core_m2_ck,
443 .ops = &clkops_null,
444 .clkdm_name = "l3_emif_clkdm",
445 .fixed_div = 2,
446 .recalc = &omap_fixed_divisor_recalc,
447};
448
449static struct clk dpll_core_m5x2_ck = {
450 .name = "dpll_core_m5x2_ck",
451 .parent = &dpll_core_x2_ck,
452 .clksel = dpll_core_m6x2_div,
453 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE,
454 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
455 .ops = &clkops_omap4_dpllmx_ops,
456 .recalc = &omap2_clksel_recalc,
457 .round_rate = &omap2_clksel_round_rate,
458 .set_rate = &omap2_clksel_set_rate,
459};
460
461static const struct clksel div_core_div[] = {
462 { .parent = &dpll_core_m5x2_ck, .rates = div2_1to2_rates },
463 { .parent = NULL },
464};
465
466static struct clk div_core_ck = {
467 .name = "div_core_ck",
468 .parent = &dpll_core_m5x2_ck,
469 .clksel = div_core_div,
470 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
471 .clksel_mask = OMAP4430_CLKSEL_CORE_MASK,
472 .ops = &clkops_null,
473 .recalc = &omap2_clksel_recalc,
474 .round_rate = &omap2_clksel_round_rate,
475 .set_rate = &omap2_clksel_set_rate,
476};
477
478static const struct clksel_rate div4_1to8_rates[] = {
479 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
480 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
481 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
482 { .div = 8, .val = 3, .flags = RATE_IN_4430 },
483 { .div = 0 },
484};
485
486static const struct clksel div_iva_hs_clk_div[] = {
487 { .parent = &dpll_core_m5x2_ck, .rates = div4_1to8_rates },
488 { .parent = NULL },
489};
490
491static struct clk div_iva_hs_clk = {
492 .name = "div_iva_hs_clk",
493 .parent = &dpll_core_m5x2_ck,
494 .clksel = div_iva_hs_clk_div,
495 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_IVA,
496 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
497 .ops = &clkops_null,
498 .recalc = &omap2_clksel_recalc,
499 .round_rate = &omap2_clksel_round_rate,
500 .set_rate = &omap2_clksel_set_rate,
501};
502
503static struct clk div_mpu_hs_clk = {
504 .name = "div_mpu_hs_clk",
505 .parent = &dpll_core_m5x2_ck,
506 .clksel = div_iva_hs_clk_div,
507 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_MPU,
508 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
509 .ops = &clkops_null,
510 .recalc = &omap2_clksel_recalc,
511 .round_rate = &omap2_clksel_round_rate,
512 .set_rate = &omap2_clksel_set_rate,
513};
514
515static struct clk dpll_core_m4x2_ck = {
516 .name = "dpll_core_m4x2_ck",
517 .parent = &dpll_core_x2_ck,
518 .clksel = dpll_core_m6x2_div,
519 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE,
520 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
521 .ops = &clkops_omap4_dpllmx_ops,
522 .recalc = &omap2_clksel_recalc,
523 .round_rate = &omap2_clksel_round_rate,
524 .set_rate = &omap2_clksel_set_rate,
525};
526
527static struct clk dll_clk_div_ck = {
528 .name = "dll_clk_div_ck",
529 .parent = &dpll_core_m4x2_ck,
530 .ops = &clkops_null,
531 .fixed_div = 2,
532 .recalc = &omap_fixed_divisor_recalc,
533};
534
535static const struct clksel dpll_abe_m2_div[] = {
536 { .parent = &dpll_abe_ck, .rates = div31_1to31_rates },
537 { .parent = NULL },
538};
539
540static struct clk dpll_abe_m2_ck = {
541 .name = "dpll_abe_m2_ck",
542 .parent = &dpll_abe_ck,
543 .clksel = dpll_abe_m2_div,
544 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
545 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
546 .ops = &clkops_omap4_dpllmx_ops,
547 .recalc = &omap2_clksel_recalc,
548 .round_rate = &omap2_clksel_round_rate,
549 .set_rate = &omap2_clksel_set_rate,
550};
551
552static struct clk dpll_core_m3x2_ck = {
553 .name = "dpll_core_m3x2_ck",
554 .parent = &dpll_core_x2_ck,
555 .clksel = dpll_core_m6x2_div,
556 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
557 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
558 .ops = &clkops_omap2_dflt,
559 .recalc = &omap2_clksel_recalc,
560 .round_rate = &omap2_clksel_round_rate,
561 .set_rate = &omap2_clksel_set_rate,
562 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
563 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
564};
565
566static struct clk dpll_core_m7x2_ck = {
567 .name = "dpll_core_m7x2_ck",
568 .parent = &dpll_core_x2_ck,
569 .clksel = dpll_core_m6x2_div,
570 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE,
571 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
572 .ops = &clkops_omap4_dpllmx_ops,
573 .recalc = &omap2_clksel_recalc,
574 .round_rate = &omap2_clksel_round_rate,
575 .set_rate = &omap2_clksel_set_rate,
576};
577
578static const struct clksel iva_hsd_byp_clk_mux_sel[] = {
579 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
580 { .parent = &div_iva_hs_clk, .rates = div_1_1_rates },
581 { .parent = NULL },
582};
583
584static struct clk iva_hsd_byp_clk_mux_ck = {
585 .name = "iva_hsd_byp_clk_mux_ck",
586 .parent = &sys_clkin_ck,
587 .clksel = iva_hsd_byp_clk_mux_sel,
588 .init = &omap2_init_clksel_parent,
589 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
590 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
591 .ops = &clkops_null,
592 .recalc = &omap2_clksel_recalc,
593};
594
595/* DPLL_IVA */
596static struct dpll_data dpll_iva_dd = {
597 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
598 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
599 .clk_ref = &sys_clkin_ck,
600 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
601 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
602 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
603 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
604 .mult_mask = OMAP4430_DPLL_MULT_MASK,
605 .div1_mask = OMAP4430_DPLL_DIV_MASK,
606 .enable_mask = OMAP4430_DPLL_EN_MASK,
607 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
608 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
609 .max_multiplier = 2047,
610 .max_divider = 128,
611 .min_divider = 1,
612};
613
614
615static struct clk dpll_iva_ck = {
616 .name = "dpll_iva_ck",
617 .parent = &sys_clkin_ck,
618 .dpll_data = &dpll_iva_dd,
619 .init = &omap2_init_dpll_parent,
620 .ops = &clkops_omap3_noncore_dpll_ops,
621 .recalc = &omap3_dpll_recalc,
622 .round_rate = &omap2_dpll_round_rate,
623 .set_rate = &omap3_noncore_dpll_set_rate,
624};
625
626static struct clk dpll_iva_x2_ck = {
627 .name = "dpll_iva_x2_ck",
628 .parent = &dpll_iva_ck,
629 .flags = CLOCK_CLKOUTX2,
630 .ops = &clkops_null,
631 .recalc = &omap3_clkoutx2_recalc,
632};
633
634static const struct clksel dpll_iva_m4x2_div[] = {
635 { .parent = &dpll_iva_x2_ck, .rates = div31_1to31_rates },
636 { .parent = NULL },
637};
638
639static struct clk dpll_iva_m4x2_ck = {
640 .name = "dpll_iva_m4x2_ck",
641 .parent = &dpll_iva_x2_ck,
642 .clksel = dpll_iva_m4x2_div,
643 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA,
644 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
645 .ops = &clkops_omap4_dpllmx_ops,
646 .recalc = &omap2_clksel_recalc,
647 .round_rate = &omap2_clksel_round_rate,
648 .set_rate = &omap2_clksel_set_rate,
649};
650
651static struct clk dpll_iva_m5x2_ck = {
652 .name = "dpll_iva_m5x2_ck",
653 .parent = &dpll_iva_x2_ck,
654 .clksel = dpll_iva_m4x2_div,
655 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA,
656 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
657 .ops = &clkops_omap4_dpllmx_ops,
658 .recalc = &omap2_clksel_recalc,
659 .round_rate = &omap2_clksel_round_rate,
660 .set_rate = &omap2_clksel_set_rate,
661};
662
663/* DPLL_MPU */
664static struct dpll_data dpll_mpu_dd = {
665 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
666 .clk_bypass = &div_mpu_hs_clk,
667 .clk_ref = &sys_clkin_ck,
668 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
669 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
670 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
671 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
672 .mult_mask = OMAP4430_DPLL_MULT_MASK,
673 .div1_mask = OMAP4430_DPLL_DIV_MASK,
674 .enable_mask = OMAP4430_DPLL_EN_MASK,
675 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
676 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
677 .max_multiplier = 2047,
678 .max_divider = 128,
679 .min_divider = 1,
680};
681
682
683static struct clk dpll_mpu_ck = {
684 .name = "dpll_mpu_ck",
685 .parent = &sys_clkin_ck,
686 .dpll_data = &dpll_mpu_dd,
687 .init = &omap2_init_dpll_parent,
688 .ops = &clkops_omap3_noncore_dpll_ops,
689 .recalc = &omap3_dpll_recalc,
690 .round_rate = &omap2_dpll_round_rate,
691 .set_rate = &omap3_noncore_dpll_set_rate,
692};
693
694static const struct clksel dpll_mpu_m2_div[] = {
695 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
696 { .parent = NULL },
697};
698
699static struct clk dpll_mpu_m2_ck = {
700 .name = "dpll_mpu_m2_ck",
701 .parent = &dpll_mpu_ck,
702 .clkdm_name = "cm_clkdm",
703 .clksel = dpll_mpu_m2_div,
704 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
705 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
706 .ops = &clkops_omap4_dpllmx_ops,
707 .recalc = &omap2_clksel_recalc,
708 .round_rate = &omap2_clksel_round_rate,
709 .set_rate = &omap2_clksel_set_rate,
710};
711
712static struct clk per_hs_clk_div_ck = {
713 .name = "per_hs_clk_div_ck",
714 .parent = &dpll_abe_m3x2_ck,
715 .ops = &clkops_null,
716 .fixed_div = 2,
717 .recalc = &omap_fixed_divisor_recalc,
718};
719
720static const struct clksel per_hsd_byp_clk_mux_sel[] = {
721 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
722 { .parent = &per_hs_clk_div_ck, .rates = div_1_1_rates },
723 { .parent = NULL },
724};
725
726static struct clk per_hsd_byp_clk_mux_ck = {
727 .name = "per_hsd_byp_clk_mux_ck",
728 .parent = &sys_clkin_ck,
729 .clksel = per_hsd_byp_clk_mux_sel,
730 .init = &omap2_init_clksel_parent,
731 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
732 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
733 .ops = &clkops_null,
734 .recalc = &omap2_clksel_recalc,
735};
736
737/* DPLL_PER */
738static struct dpll_data dpll_per_dd = {
739 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
740 .clk_bypass = &per_hsd_byp_clk_mux_ck,
741 .clk_ref = &sys_clkin_ck,
742 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
743 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
744 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
745 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
746 .mult_mask = OMAP4430_DPLL_MULT_MASK,
747 .div1_mask = OMAP4430_DPLL_DIV_MASK,
748 .enable_mask = OMAP4430_DPLL_EN_MASK,
749 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
750 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
751 .max_multiplier = 2047,
752 .max_divider = 128,
753 .min_divider = 1,
754};
755
756
757static struct clk dpll_per_ck = {
758 .name = "dpll_per_ck",
759 .parent = &sys_clkin_ck,
760 .dpll_data = &dpll_per_dd,
761 .init = &omap2_init_dpll_parent,
762 .ops = &clkops_omap3_noncore_dpll_ops,
763 .recalc = &omap3_dpll_recalc,
764 .round_rate = &omap2_dpll_round_rate,
765 .set_rate = &omap3_noncore_dpll_set_rate,
766};
767
768static const struct clksel dpll_per_m2_div[] = {
769 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
770 { .parent = NULL },
771};
772
773static struct clk dpll_per_m2_ck = {
774 .name = "dpll_per_m2_ck",
775 .parent = &dpll_per_ck,
776 .clksel = dpll_per_m2_div,
777 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
778 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
779 .ops = &clkops_omap4_dpllmx_ops,
780 .recalc = &omap2_clksel_recalc,
781 .round_rate = &omap2_clksel_round_rate,
782 .set_rate = &omap2_clksel_set_rate,
783};
784
785static struct clk dpll_per_x2_ck = {
786 .name = "dpll_per_x2_ck",
787 .parent = &dpll_per_ck,
788 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
789 .flags = CLOCK_CLKOUTX2,
790 .ops = &clkops_omap4_dpllmx_ops,
791 .recalc = &omap3_clkoutx2_recalc,
792};
793
794static const struct clksel dpll_per_m2x2_div[] = {
795 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
796 { .parent = NULL },
797};
798
799static struct clk dpll_per_m2x2_ck = {
800 .name = "dpll_per_m2x2_ck",
801 .parent = &dpll_per_x2_ck,
802 .clksel = dpll_per_m2x2_div,
803 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
804 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
805 .ops = &clkops_omap4_dpllmx_ops,
806 .recalc = &omap2_clksel_recalc,
807 .round_rate = &omap2_clksel_round_rate,
808 .set_rate = &omap2_clksel_set_rate,
809};
810
811static struct clk dpll_per_m3x2_ck = {
812 .name = "dpll_per_m3x2_ck",
813 .parent = &dpll_per_x2_ck,
814 .clksel = dpll_per_m2x2_div,
815 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
816 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
817 .ops = &clkops_omap2_dflt,
818 .recalc = &omap2_clksel_recalc,
819 .round_rate = &omap2_clksel_round_rate,
820 .set_rate = &omap2_clksel_set_rate,
821 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
822 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
823};
824
825static struct clk dpll_per_m4x2_ck = {
826 .name = "dpll_per_m4x2_ck",
827 .parent = &dpll_per_x2_ck,
828 .clksel = dpll_per_m2x2_div,
829 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER,
830 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
831 .ops = &clkops_omap4_dpllmx_ops,
832 .recalc = &omap2_clksel_recalc,
833 .round_rate = &omap2_clksel_round_rate,
834 .set_rate = &omap2_clksel_set_rate,
835};
836
837static struct clk dpll_per_m5x2_ck = {
838 .name = "dpll_per_m5x2_ck",
839 .parent = &dpll_per_x2_ck,
840 .clksel = dpll_per_m2x2_div,
841 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER,
842 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
843 .ops = &clkops_omap4_dpllmx_ops,
844 .recalc = &omap2_clksel_recalc,
845 .round_rate = &omap2_clksel_round_rate,
846 .set_rate = &omap2_clksel_set_rate,
847};
848
849static struct clk dpll_per_m6x2_ck = {
850 .name = "dpll_per_m6x2_ck",
851 .parent = &dpll_per_x2_ck,
852 .clksel = dpll_per_m2x2_div,
853 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER,
854 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
855 .ops = &clkops_omap4_dpllmx_ops,
856 .recalc = &omap2_clksel_recalc,
857 .round_rate = &omap2_clksel_round_rate,
858 .set_rate = &omap2_clksel_set_rate,
859};
860
861static struct clk dpll_per_m7x2_ck = {
862 .name = "dpll_per_m7x2_ck",
863 .parent = &dpll_per_x2_ck,
864 .clksel = dpll_per_m2x2_div,
865 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER,
866 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
867 .ops = &clkops_omap4_dpllmx_ops,
868 .recalc = &omap2_clksel_recalc,
869 .round_rate = &omap2_clksel_round_rate,
870 .set_rate = &omap2_clksel_set_rate,
871};
872
873static struct clk usb_hs_clk_div_ck = {
874 .name = "usb_hs_clk_div_ck",
875 .parent = &dpll_abe_m3x2_ck,
876 .ops = &clkops_null,
877 .fixed_div = 3,
878 .recalc = &omap_fixed_divisor_recalc,
879};
880
881/* DPLL_USB */
882static struct dpll_data dpll_usb_dd = {
883 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
884 .clk_bypass = &usb_hs_clk_div_ck,
885 .flags = DPLL_J_TYPE,
886 .clk_ref = &sys_clkin_ck,
887 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
888 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
889 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
890 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
891 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
892 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
893 .enable_mask = OMAP4430_DPLL_EN_MASK,
894 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
895 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
896 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
897 .max_multiplier = 4095,
898 .max_divider = 256,
899 .min_divider = 1,
900};
901
902
903static struct clk dpll_usb_ck = {
904 .name = "dpll_usb_ck",
905 .parent = &sys_clkin_ck,
906 .dpll_data = &dpll_usb_dd,
907 .init = &omap2_init_dpll_parent,
908 .ops = &clkops_omap3_noncore_dpll_ops,
909 .recalc = &omap3_dpll_recalc,
910 .round_rate = &omap2_dpll_round_rate,
911 .set_rate = &omap3_noncore_dpll_set_rate,
912 .clkdm_name = "l3_init_clkdm",
913};
914
915static struct clk dpll_usb_clkdcoldo_ck = {
916 .name = "dpll_usb_clkdcoldo_ck",
917 .parent = &dpll_usb_ck,
918 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
919 .ops = &clkops_omap4_dpllmx_ops,
920 .recalc = &followparent_recalc,
921};
922
923static const struct clksel dpll_usb_m2_div[] = {
924 { .parent = &dpll_usb_ck, .rates = div31_1to31_rates },
925 { .parent = NULL },
926};
927
928static struct clk dpll_usb_m2_ck = {
929 .name = "dpll_usb_m2_ck",
930 .parent = &dpll_usb_ck,
931 .clksel = dpll_usb_m2_div,
932 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB,
933 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK,
934 .ops = &clkops_omap4_dpllmx_ops,
935 .recalc = &omap2_clksel_recalc,
936 .round_rate = &omap2_clksel_round_rate,
937 .set_rate = &omap2_clksel_set_rate,
938};
939
940static const struct clksel ducati_clk_mux_sel[] = {
941 { .parent = &div_core_ck, .rates = div_1_0_rates },
942 { .parent = &dpll_per_m6x2_ck, .rates = div_1_1_rates },
943 { .parent = NULL },
944};
945
946static struct clk ducati_clk_mux_ck = {
947 .name = "ducati_clk_mux_ck",
948 .parent = &div_core_ck,
949 .clksel = ducati_clk_mux_sel,
950 .init = &omap2_init_clksel_parent,
951 .clksel_reg = OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT,
952 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
953 .ops = &clkops_null,
954 .recalc = &omap2_clksel_recalc,
955};
956
957static struct clk func_12m_fclk = {
958 .name = "func_12m_fclk",
959 .parent = &dpll_per_m2x2_ck,
960 .ops = &clkops_null,
961 .fixed_div = 16,
962 .recalc = &omap_fixed_divisor_recalc,
963};
964
965static struct clk func_24m_clk = {
966 .name = "func_24m_clk",
967 .parent = &dpll_per_m2_ck,
968 .ops = &clkops_null,
969 .fixed_div = 4,
970 .recalc = &omap_fixed_divisor_recalc,
971};
972
973static struct clk func_24mc_fclk = {
974 .name = "func_24mc_fclk",
975 .parent = &dpll_per_m2x2_ck,
976 .ops = &clkops_null,
977 .fixed_div = 8,
978 .recalc = &omap_fixed_divisor_recalc,
979};
980
981static const struct clksel_rate div2_4to8_rates[] = {
982 { .div = 4, .val = 0, .flags = RATE_IN_4430 },
983 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
984 { .div = 0 },
985};
986
987static const struct clksel func_48m_fclk_div[] = {
988 { .parent = &dpll_per_m2x2_ck, .rates = div2_4to8_rates },
989 { .parent = NULL },
990};
991
992static struct clk func_48m_fclk = {
993 .name = "func_48m_fclk",
994 .parent = &dpll_per_m2x2_ck,
995 .clksel = func_48m_fclk_div,
996 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
997 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
998 .ops = &clkops_null,
999 .recalc = &omap2_clksel_recalc,
1000 .round_rate = &omap2_clksel_round_rate,
1001 .set_rate = &omap2_clksel_set_rate,
1002};
1003
1004static struct clk func_48mc_fclk = {
1005 .name = "func_48mc_fclk",
1006 .parent = &dpll_per_m2x2_ck,
1007 .ops = &clkops_null,
1008 .fixed_div = 4,
1009 .recalc = &omap_fixed_divisor_recalc,
1010};
1011
1012static const struct clksel_rate div2_2to4_rates[] = {
1013 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1014 { .div = 4, .val = 1, .flags = RATE_IN_4430 },
1015 { .div = 0 },
1016};
1017
1018static const struct clksel func_64m_fclk_div[] = {
1019 { .parent = &dpll_per_m4x2_ck, .rates = div2_2to4_rates },
1020 { .parent = NULL },
1021};
1022
1023static struct clk func_64m_fclk = {
1024 .name = "func_64m_fclk",
1025 .parent = &dpll_per_m4x2_ck,
1026 .clksel = func_64m_fclk_div,
1027 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1028 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1029 .ops = &clkops_null,
1030 .recalc = &omap2_clksel_recalc,
1031 .round_rate = &omap2_clksel_round_rate,
1032 .set_rate = &omap2_clksel_set_rate,
1033};
1034
1035static const struct clksel func_96m_fclk_div[] = {
1036 { .parent = &dpll_per_m2x2_ck, .rates = div2_2to4_rates },
1037 { .parent = NULL },
1038};
1039
1040static struct clk func_96m_fclk = {
1041 .name = "func_96m_fclk",
1042 .parent = &dpll_per_m2x2_ck,
1043 .clksel = func_96m_fclk_div,
1044 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1045 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1046 .ops = &clkops_null,
1047 .recalc = &omap2_clksel_recalc,
1048 .round_rate = &omap2_clksel_round_rate,
1049 .set_rate = &omap2_clksel_set_rate,
1050};
1051
1052static const struct clksel_rate div2_1to8_rates[] = {
1053 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
1054 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
1055 { .div = 0 },
1056};
1057
1058static const struct clksel init_60m_fclk_div[] = {
1059 { .parent = &dpll_usb_m2_ck, .rates = div2_1to8_rates },
1060 { .parent = NULL },
1061};
1062
1063static struct clk init_60m_fclk = {
1064 .name = "init_60m_fclk",
1065 .parent = &dpll_usb_m2_ck,
1066 .clksel = init_60m_fclk_div,
1067 .clksel_reg = OMAP4430_CM_CLKSEL_USB_60MHZ,
1068 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1069 .ops = &clkops_null,
1070 .recalc = &omap2_clksel_recalc,
1071 .round_rate = &omap2_clksel_round_rate,
1072 .set_rate = &omap2_clksel_set_rate,
1073};
1074
1075static const struct clksel l3_div_div[] = {
1076 { .parent = &div_core_ck, .rates = div2_1to2_rates },
1077 { .parent = NULL },
1078};
1079
1080static struct clk l3_div_ck = {
1081 .name = "l3_div_ck",
1082 .parent = &div_core_ck,
1083 .clkdm_name = "cm_clkdm",
1084 .clksel = l3_div_div,
1085 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1086 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
1087 .ops = &clkops_null,
1088 .recalc = &omap2_clksel_recalc,
1089 .round_rate = &omap2_clksel_round_rate,
1090 .set_rate = &omap2_clksel_set_rate,
1091};
1092
1093static const struct clksel l4_div_div[] = {
1094 { .parent = &l3_div_ck, .rates = div2_1to2_rates },
1095 { .parent = NULL },
1096};
1097
1098static struct clk l4_div_ck = {
1099 .name = "l4_div_ck",
1100 .parent = &l3_div_ck,
1101 .clksel = l4_div_div,
1102 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1103 .clksel_mask = OMAP4430_CLKSEL_L4_MASK,
1104 .ops = &clkops_null,
1105 .recalc = &omap2_clksel_recalc,
1106 .round_rate = &omap2_clksel_round_rate,
1107 .set_rate = &omap2_clksel_set_rate,
1108};
1109
1110static struct clk lp_clk_div_ck = {
1111 .name = "lp_clk_div_ck",
1112 .parent = &dpll_abe_m2x2_ck,
1113 .ops = &clkops_null,
1114 .fixed_div = 16,
1115 .recalc = &omap_fixed_divisor_recalc,
1116};
1117
1118static const struct clksel l4_wkup_clk_mux_sel[] = {
1119 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1120 { .parent = &lp_clk_div_ck, .rates = div_1_1_rates },
1121 { .parent = NULL },
1122};
1123
1124static struct clk l4_wkup_clk_mux_ck = {
1125 .name = "l4_wkup_clk_mux_ck",
1126 .parent = &sys_clkin_ck,
1127 .clksel = l4_wkup_clk_mux_sel,
1128 .init = &omap2_init_clksel_parent,
1129 .clksel_reg = OMAP4430_CM_L4_WKUP_CLKSEL,
1130 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1131 .ops = &clkops_null,
1132 .recalc = &omap2_clksel_recalc,
1133};
1134
1135static const struct clksel_rate div2_2to1_rates[] = {
1136 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
1137 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1138 { .div = 0 },
1139};
1140
1141static const struct clksel ocp_abe_iclk_div[] = {
1142 { .parent = &aess_fclk, .rates = div2_2to1_rates },
1143 { .parent = NULL },
1144};
1145
1146static struct clk mpu_periphclk = {
1147 .name = "mpu_periphclk",
1148 .parent = &dpll_mpu_ck,
1149 .ops = &clkops_null,
1150 .fixed_div = 2,
1151 .recalc = &omap_fixed_divisor_recalc,
1152};
1153
1154static struct clk ocp_abe_iclk = {
1155 .name = "ocp_abe_iclk",
1156 .parent = &aess_fclk,
1157 .clksel = ocp_abe_iclk_div,
1158 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1159 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
1160 .ops = &clkops_null,
1161 .recalc = &omap2_clksel_recalc,
1162};
1163
1164static struct clk per_abe_24m_fclk = {
1165 .name = "per_abe_24m_fclk",
1166 .parent = &dpll_abe_m2_ck,
1167 .ops = &clkops_null,
1168 .fixed_div = 4,
1169 .recalc = &omap_fixed_divisor_recalc,
1170};
1171
1172static const struct clksel per_abe_nc_fclk_div[] = {
1173 { .parent = &dpll_abe_m2_ck, .rates = div2_1to2_rates },
1174 { .parent = NULL },
1175};
1176
1177static struct clk per_abe_nc_fclk = {
1178 .name = "per_abe_nc_fclk",
1179 .parent = &dpll_abe_m2_ck,
1180 .clksel = per_abe_nc_fclk_div,
1181 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1182 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1183 .ops = &clkops_null,
1184 .recalc = &omap2_clksel_recalc,
1185 .round_rate = &omap2_clksel_round_rate,
1186 .set_rate = &omap2_clksel_set_rate,
1187};
1188
1189static const struct clksel pmd_stm_clock_mux_sel[] = {
1190 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1191 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
1192 { .parent = &tie_low_clock_ck, .rates = div_1_2_rates },
1193 { .parent = NULL },
1194};
1195
1196static struct clk pmd_stm_clock_mux_ck = {
1197 .name = "pmd_stm_clock_mux_ck",
1198 .parent = &sys_clkin_ck,
1199 .ops = &clkops_null,
1200 .recalc = &followparent_recalc,
1201};
1202
1203static struct clk pmd_trace_clk_mux_ck = {
1204 .name = "pmd_trace_clk_mux_ck",
1205 .parent = &sys_clkin_ck,
1206 .ops = &clkops_null,
1207 .recalc = &followparent_recalc,
1208};
1209
1210static const struct clksel syc_clk_div_div[] = {
1211 { .parent = &sys_clkin_ck, .rates = div2_1to2_rates },
1212 { .parent = NULL },
1213};
1214
1215static struct clk syc_clk_div_ck = {
1216 .name = "syc_clk_div_ck",
1217 .parent = &sys_clkin_ck,
1218 .clksel = syc_clk_div_div,
1219 .clksel_reg = OMAP4430_CM_ABE_DSS_SYS_CLKSEL,
1220 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1221 .ops = &clkops_null,
1222 .recalc = &omap2_clksel_recalc,
1223 .round_rate = &omap2_clksel_round_rate,
1224 .set_rate = &omap2_clksel_set_rate,
1225};
1226
1227/* Leaf clocks controlled by modules */
1228
1229static struct clk aes1_fck = {
1230 .name = "aes1_fck",
1231 .ops = &clkops_omap2_dflt,
1232 .enable_reg = OMAP4430_CM_L4SEC_AES1_CLKCTRL,
1233 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1234 .clkdm_name = "l4_secure_clkdm",
1235 .parent = &l3_div_ck,
1236 .recalc = &followparent_recalc,
1237};
1238
1239static struct clk aes2_fck = {
1240 .name = "aes2_fck",
1241 .ops = &clkops_omap2_dflt,
1242 .enable_reg = OMAP4430_CM_L4SEC_AES2_CLKCTRL,
1243 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1244 .clkdm_name = "l4_secure_clkdm",
1245 .parent = &l3_div_ck,
1246 .recalc = &followparent_recalc,
1247};
1248
1249static struct clk aess_fck = {
1250 .name = "aess_fck",
1251 .ops = &clkops_omap2_dflt,
1252 .enable_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1253 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1254 .clkdm_name = "abe_clkdm",
1255 .parent = &aess_fclk,
1256 .recalc = &followparent_recalc,
1257};
1258
1259static struct clk bandgap_fclk = {
1260 .name = "bandgap_fclk",
1261 .ops = &clkops_omap2_dflt,
1262 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1263 .enable_bit = OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT,
1264 .clkdm_name = "l4_wkup_clkdm",
1265 .parent = &sys_32k_ck,
1266 .recalc = &followparent_recalc,
1267};
1268
1269static struct clk des3des_fck = {
1270 .name = "des3des_fck",
1271 .ops = &clkops_omap2_dflt,
1272 .enable_reg = OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
1273 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1274 .clkdm_name = "l4_secure_clkdm",
1275 .parent = &l4_div_ck,
1276 .recalc = &followparent_recalc,
1277};
1278
1279static const struct clksel dmic_sync_mux_sel[] = {
1280 { .parent = &abe_24m_fclk, .rates = div_1_0_rates },
1281 { .parent = &syc_clk_div_ck, .rates = div_1_1_rates },
1282 { .parent = &func_24m_clk, .rates = div_1_2_rates },
1283 { .parent = NULL },
1284};
1285
1286static struct clk dmic_sync_mux_ck = {
1287 .name = "dmic_sync_mux_ck",
1288 .parent = &abe_24m_fclk,
1289 .clksel = dmic_sync_mux_sel,
1290 .init = &omap2_init_clksel_parent,
1291 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1292 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1293 .ops = &clkops_null,
1294 .recalc = &omap2_clksel_recalc,
1295};
1296
1297static const struct clksel func_dmic_abe_gfclk_sel[] = {
1298 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
1299 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1300 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1301 { .parent = NULL },
1302};
1303
1304/* Merged func_dmic_abe_gfclk into dmic */
1305static struct clk dmic_fck = {
1306 .name = "dmic_fck",
1307 .parent = &dmic_sync_mux_ck,
1308 .clksel = func_dmic_abe_gfclk_sel,
1309 .init = &omap2_init_clksel_parent,
1310 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1311 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1312 .ops = &clkops_omap2_dflt,
1313 .recalc = &omap2_clksel_recalc,
1314 .enable_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1315 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1316 .clkdm_name = "abe_clkdm",
1317};
1318
1319static struct clk dsp_fck = {
1320 .name = "dsp_fck",
1321 .ops = &clkops_omap2_dflt,
1322 .enable_reg = OMAP4430_CM_TESLA_TESLA_CLKCTRL,
1323 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1324 .clkdm_name = "tesla_clkdm",
1325 .parent = &dpll_iva_m4x2_ck,
1326 .recalc = &followparent_recalc,
1327};
1328
1329static struct clk dss_sys_clk = {
1330 .name = "dss_sys_clk",
1331 .ops = &clkops_omap2_dflt,
1332 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1333 .enable_bit = OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT,
1334 .clkdm_name = "l3_dss_clkdm",
1335 .parent = &syc_clk_div_ck,
1336 .recalc = &followparent_recalc,
1337};
1338
1339static struct clk dss_tv_clk = {
1340 .name = "dss_tv_clk",
1341 .ops = &clkops_omap2_dflt,
1342 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1343 .enable_bit = OMAP4430_OPTFCLKEN_TV_CLK_SHIFT,
1344 .clkdm_name = "l3_dss_clkdm",
1345 .parent = &extalt_clkin_ck,
1346 .recalc = &followparent_recalc,
1347};
1348
1349static struct clk dss_dss_clk = {
1350 .name = "dss_dss_clk",
1351 .ops = &clkops_omap2_dflt,
1352 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1353 .enable_bit = OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
1354 .clkdm_name = "l3_dss_clkdm",
1355 .parent = &dpll_per_m5x2_ck,
1356 .recalc = &followparent_recalc,
1357};
1358
1359static const struct clksel_rate div3_8to32_rates[] = {
1360 { .div = 8, .val = 0, .flags = RATE_IN_4460 },
1361 { .div = 16, .val = 1, .flags = RATE_IN_4460 },
1362 { .div = 32, .val = 2, .flags = RATE_IN_4460 },
1363 { .div = 0 },
1364};
1365
1366static const struct clksel div_ts_div[] = {
1367 { .parent = &l4_wkup_clk_mux_ck, .rates = div3_8to32_rates },
1368 { .parent = NULL },
1369};
1370
1371static struct clk div_ts_ck = {
1372 .name = "div_ts_ck",
1373 .parent = &l4_wkup_clk_mux_ck,
1374 .clksel = div_ts_div,
1375 .clksel_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1376 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1377 .ops = &clkops_null,
1378 .recalc = &omap2_clksel_recalc,
1379 .round_rate = &omap2_clksel_round_rate,
1380 .set_rate = &omap2_clksel_set_rate,
1381};
1382
1383static struct clk bandgap_ts_fclk = {
1384 .name = "bandgap_ts_fclk",
1385 .ops = &clkops_omap2_dflt,
1386 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1387 .enable_bit = OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
1388 .clkdm_name = "l4_wkup_clkdm",
1389 .parent = &div_ts_ck,
1390 .recalc = &followparent_recalc,
1391};
1392
1393static struct clk dss_48mhz_clk = {
1394 .name = "dss_48mhz_clk",
1395 .ops = &clkops_omap2_dflt,
1396 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1397 .enable_bit = OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
1398 .clkdm_name = "l3_dss_clkdm",
1399 .parent = &func_48mc_fclk,
1400 .recalc = &followparent_recalc,
1401};
1402
1403static struct clk dss_fck = {
1404 .name = "dss_fck",
1405 .ops = &clkops_omap2_dflt,
1406 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1407 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1408 .clkdm_name = "l3_dss_clkdm",
1409 .parent = &l3_div_ck,
1410 .recalc = &followparent_recalc,
1411};
1412
1413static struct clk efuse_ctrl_cust_fck = {
1414 .name = "efuse_ctrl_cust_fck",
1415 .ops = &clkops_omap2_dflt,
1416 .enable_reg = OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
1417 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1418 .clkdm_name = "l4_cefuse_clkdm",
1419 .parent = &sys_clkin_ck,
1420 .recalc = &followparent_recalc,
1421};
1422
1423static struct clk emif1_fck = {
1424 .name = "emif1_fck",
1425 .ops = &clkops_omap2_dflt,
1426 .enable_reg = OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
1427 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1428 .flags = ENABLE_ON_INIT,
1429 .clkdm_name = "l3_emif_clkdm",
1430 .parent = &ddrphy_ck,
1431 .recalc = &followparent_recalc,
1432};
1433
1434static struct clk emif2_fck = {
1435 .name = "emif2_fck",
1436 .ops = &clkops_omap2_dflt,
1437 .enable_reg = OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
1438 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1439 .flags = ENABLE_ON_INIT,
1440 .clkdm_name = "l3_emif_clkdm",
1441 .parent = &ddrphy_ck,
1442 .recalc = &followparent_recalc,
1443};
1444
1445static const struct clksel fdif_fclk_div[] = {
1446 { .parent = &dpll_per_m4x2_ck, .rates = div3_1to4_rates },
1447 { .parent = NULL },
1448};
1449
1450/* Merged fdif_fclk into fdif */
1451static struct clk fdif_fck = {
1452 .name = "fdif_fck",
1453 .parent = &dpll_per_m4x2_ck,
1454 .clksel = fdif_fclk_div,
1455 .clksel_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1456 .clksel_mask = OMAP4430_CLKSEL_FCLK_MASK,
1457 .ops = &clkops_omap2_dflt,
1458 .recalc = &omap2_clksel_recalc,
1459 .round_rate = &omap2_clksel_round_rate,
1460 .set_rate = &omap2_clksel_set_rate,
1461 .enable_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1462 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1463 .clkdm_name = "iss_clkdm",
1464};
1465
1466static struct clk fpka_fck = {
1467 .name = "fpka_fck",
1468 .ops = &clkops_omap2_dflt,
1469 .enable_reg = OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
1470 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1471 .clkdm_name = "l4_secure_clkdm",
1472 .parent = &l4_div_ck,
1473 .recalc = &followparent_recalc,
1474};
1475
1476static struct clk gpio1_dbclk = {
1477 .name = "gpio1_dbclk",
1478 .ops = &clkops_omap2_dflt,
1479 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1480 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1481 .clkdm_name = "l4_wkup_clkdm",
1482 .parent = &sys_32k_ck,
1483 .recalc = &followparent_recalc,
1484};
1485
1486static struct clk gpio1_ick = {
1487 .name = "gpio1_ick",
1488 .ops = &clkops_omap2_dflt,
1489 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1490 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1491 .clkdm_name = "l4_wkup_clkdm",
1492 .parent = &l4_wkup_clk_mux_ck,
1493 .recalc = &followparent_recalc,
1494};
1495
1496static struct clk gpio2_dbclk = {
1497 .name = "gpio2_dbclk",
1498 .ops = &clkops_omap2_dflt,
1499 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1500 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1501 .clkdm_name = "l4_per_clkdm",
1502 .parent = &sys_32k_ck,
1503 .recalc = &followparent_recalc,
1504};
1505
1506static struct clk gpio2_ick = {
1507 .name = "gpio2_ick",
1508 .ops = &clkops_omap2_dflt,
1509 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1510 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1511 .clkdm_name = "l4_per_clkdm",
1512 .parent = &l4_div_ck,
1513 .recalc = &followparent_recalc,
1514};
1515
1516static struct clk gpio3_dbclk = {
1517 .name = "gpio3_dbclk",
1518 .ops = &clkops_omap2_dflt,
1519 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1520 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1521 .clkdm_name = "l4_per_clkdm",
1522 .parent = &sys_32k_ck,
1523 .recalc = &followparent_recalc,
1524};
1525
1526static struct clk gpio3_ick = {
1527 .name = "gpio3_ick",
1528 .ops = &clkops_omap2_dflt,
1529 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1530 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1531 .clkdm_name = "l4_per_clkdm",
1532 .parent = &l4_div_ck,
1533 .recalc = &followparent_recalc,
1534};
1535
1536static struct clk gpio4_dbclk = {
1537 .name = "gpio4_dbclk",
1538 .ops = &clkops_omap2_dflt,
1539 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1540 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1541 .clkdm_name = "l4_per_clkdm",
1542 .parent = &sys_32k_ck,
1543 .recalc = &followparent_recalc,
1544};
1545
1546static struct clk gpio4_ick = {
1547 .name = "gpio4_ick",
1548 .ops = &clkops_omap2_dflt,
1549 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1550 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1551 .clkdm_name = "l4_per_clkdm",
1552 .parent = &l4_div_ck,
1553 .recalc = &followparent_recalc,
1554};
1555
1556static struct clk gpio5_dbclk = {
1557 .name = "gpio5_dbclk",
1558 .ops = &clkops_omap2_dflt,
1559 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1560 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1561 .clkdm_name = "l4_per_clkdm",
1562 .parent = &sys_32k_ck,
1563 .recalc = &followparent_recalc,
1564};
1565
1566static struct clk gpio5_ick = {
1567 .name = "gpio5_ick",
1568 .ops = &clkops_omap2_dflt,
1569 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1570 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1571 .clkdm_name = "l4_per_clkdm",
1572 .parent = &l4_div_ck,
1573 .recalc = &followparent_recalc,
1574};
1575
1576static struct clk gpio6_dbclk = {
1577 .name = "gpio6_dbclk",
1578 .ops = &clkops_omap2_dflt,
1579 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1580 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1581 .clkdm_name = "l4_per_clkdm",
1582 .parent = &sys_32k_ck,
1583 .recalc = &followparent_recalc,
1584};
1585
1586static struct clk gpio6_ick = {
1587 .name = "gpio6_ick",
1588 .ops = &clkops_omap2_dflt,
1589 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1590 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1591 .clkdm_name = "l4_per_clkdm",
1592 .parent = &l4_div_ck,
1593 .recalc = &followparent_recalc,
1594};
1595
1596static struct clk gpmc_ick = {
1597 .name = "gpmc_ick",
1598 .ops = &clkops_omap2_dflt,
1599 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL,
1600 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1601 .flags = ENABLE_ON_INIT,
1602 .clkdm_name = "l3_2_clkdm",
1603 .parent = &l3_div_ck,
1604 .recalc = &followparent_recalc,
1605};
1606
1607static const struct clksel sgx_clk_mux_sel[] = {
1608 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
1609 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
1610 { .parent = NULL },
1611};
1612
1613/* Merged sgx_clk_mux into gpu */
1614static struct clk gpu_fck = {
1615 .name = "gpu_fck",
1616 .parent = &dpll_core_m7x2_ck,
1617 .clksel = sgx_clk_mux_sel,
1618 .init = &omap2_init_clksel_parent,
1619 .clksel_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1620 .clksel_mask = OMAP4430_CLKSEL_SGX_FCLK_MASK,
1621 .ops = &clkops_omap2_dflt,
1622 .recalc = &omap2_clksel_recalc,
1623 .enable_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1624 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1625 .clkdm_name = "l3_gfx_clkdm",
1626};
1627
1628static struct clk hdq1w_fck = {
1629 .name = "hdq1w_fck",
1630 .ops = &clkops_omap2_dflt,
1631 .enable_reg = OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
1632 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1633 .clkdm_name = "l4_per_clkdm",
1634 .parent = &func_12m_fclk,
1635 .recalc = &followparent_recalc,
1636};
1637
1638static const struct clksel hsi_fclk_div[] = {
1639 { .parent = &dpll_per_m2x2_ck, .rates = div3_1to4_rates },
1640 { .parent = NULL },
1641};
1642
1643/* Merged hsi_fclk into hsi */
1644static struct clk hsi_fck = {
1645 .name = "hsi_fck",
1646 .parent = &dpll_per_m2x2_ck,
1647 .clksel = hsi_fclk_div,
1648 .clksel_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1649 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1650 .ops = &clkops_omap2_dflt,
1651 .recalc = &omap2_clksel_recalc,
1652 .round_rate = &omap2_clksel_round_rate,
1653 .set_rate = &omap2_clksel_set_rate,
1654 .enable_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1655 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1656 .clkdm_name = "l3_init_clkdm",
1657};
1658
1659static struct clk i2c1_fck = {
1660 .name = "i2c1_fck",
1661 .ops = &clkops_omap2_dflt,
1662 .enable_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL,
1663 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1664 .clkdm_name = "l4_per_clkdm",
1665 .parent = &func_96m_fclk,
1666 .recalc = &followparent_recalc,
1667};
1668
1669static struct clk i2c2_fck = {
1670 .name = "i2c2_fck",
1671 .ops = &clkops_omap2_dflt,
1672 .enable_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL,
1673 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1674 .clkdm_name = "l4_per_clkdm",
1675 .parent = &func_96m_fclk,
1676 .recalc = &followparent_recalc,
1677};
1678
1679static struct clk i2c3_fck = {
1680 .name = "i2c3_fck",
1681 .ops = &clkops_omap2_dflt,
1682 .enable_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL,
1683 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1684 .clkdm_name = "l4_per_clkdm",
1685 .parent = &func_96m_fclk,
1686 .recalc = &followparent_recalc,
1687};
1688
1689static struct clk i2c4_fck = {
1690 .name = "i2c4_fck",
1691 .ops = &clkops_omap2_dflt,
1692 .enable_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL,
1693 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1694 .clkdm_name = "l4_per_clkdm",
1695 .parent = &func_96m_fclk,
1696 .recalc = &followparent_recalc,
1697};
1698
1699static struct clk ipu_fck = {
1700 .name = "ipu_fck",
1701 .ops = &clkops_omap2_dflt,
1702 .enable_reg = OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
1703 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1704 .clkdm_name = "ducati_clkdm",
1705 .parent = &ducati_clk_mux_ck,
1706 .recalc = &followparent_recalc,
1707};
1708
1709static struct clk iss_ctrlclk = {
1710 .name = "iss_ctrlclk",
1711 .ops = &clkops_omap2_dflt,
1712 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1713 .enable_bit = OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
1714 .clkdm_name = "iss_clkdm",
1715 .parent = &func_96m_fclk,
1716 .recalc = &followparent_recalc,
1717};
1718
1719static struct clk iss_fck = {
1720 .name = "iss_fck",
1721 .ops = &clkops_omap2_dflt,
1722 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1723 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1724 .clkdm_name = "iss_clkdm",
1725 .parent = &ducati_clk_mux_ck,
1726 .recalc = &followparent_recalc,
1727};
1728
1729static struct clk iva_fck = {
1730 .name = "iva_fck",
1731 .ops = &clkops_omap2_dflt,
1732 .enable_reg = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
1733 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1734 .clkdm_name = "ivahd_clkdm",
1735 .parent = &dpll_iva_m5x2_ck,
1736 .recalc = &followparent_recalc,
1737};
1738
1739static struct clk kbd_fck = {
1740 .name = "kbd_fck",
1741 .ops = &clkops_omap2_dflt,
1742 .enable_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
1743 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1744 .clkdm_name = "l4_wkup_clkdm",
1745 .parent = &sys_32k_ck,
1746 .recalc = &followparent_recalc,
1747};
1748
1749static struct clk l3_instr_ick = {
1750 .name = "l3_instr_ick",
1751 .ops = &clkops_omap2_dflt,
1752 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
1753 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1754 .flags = ENABLE_ON_INIT,
1755 .clkdm_name = "l3_instr_clkdm",
1756 .parent = &l3_div_ck,
1757 .recalc = &followparent_recalc,
1758};
1759
1760static struct clk l3_main_3_ick = {
1761 .name = "l3_main_3_ick",
1762 .ops = &clkops_omap2_dflt,
1763 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
1764 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1765 .flags = ENABLE_ON_INIT,
1766 .clkdm_name = "l3_instr_clkdm",
1767 .parent = &l3_div_ck,
1768 .recalc = &followparent_recalc,
1769};
1770
1771static struct clk mcasp_sync_mux_ck = {
1772 .name = "mcasp_sync_mux_ck",
1773 .parent = &abe_24m_fclk,
1774 .clksel = dmic_sync_mux_sel,
1775 .init = &omap2_init_clksel_parent,
1776 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1777 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1778 .ops = &clkops_null,
1779 .recalc = &omap2_clksel_recalc,
1780};
1781
1782static const struct clksel func_mcasp_abe_gfclk_sel[] = {
1783 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
1784 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1785 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1786 { .parent = NULL },
1787};
1788
1789/* Merged func_mcasp_abe_gfclk into mcasp */
1790static struct clk mcasp_fck = {
1791 .name = "mcasp_fck",
1792 .parent = &mcasp_sync_mux_ck,
1793 .clksel = func_mcasp_abe_gfclk_sel,
1794 .init = &omap2_init_clksel_parent,
1795 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1796 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1797 .ops = &clkops_omap2_dflt,
1798 .recalc = &omap2_clksel_recalc,
1799 .enable_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1800 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1801 .clkdm_name = "abe_clkdm",
1802};
1803
1804static struct clk mcbsp1_sync_mux_ck = {
1805 .name = "mcbsp1_sync_mux_ck",
1806 .parent = &abe_24m_fclk,
1807 .clksel = dmic_sync_mux_sel,
1808 .init = &omap2_init_clksel_parent,
1809 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1810 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1811 .ops = &clkops_null,
1812 .recalc = &omap2_clksel_recalc,
1813};
1814
1815static const struct clksel func_mcbsp1_gfclk_sel[] = {
1816 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1817 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1818 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1819 { .parent = NULL },
1820};
1821
1822/* Merged func_mcbsp1_gfclk into mcbsp1 */
1823static struct clk mcbsp1_fck = {
1824 .name = "mcbsp1_fck",
1825 .parent = &mcbsp1_sync_mux_ck,
1826 .clksel = func_mcbsp1_gfclk_sel,
1827 .init = &omap2_init_clksel_parent,
1828 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1829 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1830 .ops = &clkops_omap2_dflt,
1831 .recalc = &omap2_clksel_recalc,
1832 .enable_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1833 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1834 .clkdm_name = "abe_clkdm",
1835};
1836
1837static struct clk mcbsp2_sync_mux_ck = {
1838 .name = "mcbsp2_sync_mux_ck",
1839 .parent = &abe_24m_fclk,
1840 .clksel = dmic_sync_mux_sel,
1841 .init = &omap2_init_clksel_parent,
1842 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1843 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1844 .ops = &clkops_null,
1845 .recalc = &omap2_clksel_recalc,
1846};
1847
1848static const struct clksel func_mcbsp2_gfclk_sel[] = {
1849 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1850 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1851 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1852 { .parent = NULL },
1853};
1854
1855/* Merged func_mcbsp2_gfclk into mcbsp2 */
1856static struct clk mcbsp2_fck = {
1857 .name = "mcbsp2_fck",
1858 .parent = &mcbsp2_sync_mux_ck,
1859 .clksel = func_mcbsp2_gfclk_sel,
1860 .init = &omap2_init_clksel_parent,
1861 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1862 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1863 .ops = &clkops_omap2_dflt,
1864 .recalc = &omap2_clksel_recalc,
1865 .enable_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1866 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1867 .clkdm_name = "abe_clkdm",
1868};
1869
1870static struct clk mcbsp3_sync_mux_ck = {
1871 .name = "mcbsp3_sync_mux_ck",
1872 .parent = &abe_24m_fclk,
1873 .clksel = dmic_sync_mux_sel,
1874 .init = &omap2_init_clksel_parent,
1875 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1876 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1877 .ops = &clkops_null,
1878 .recalc = &omap2_clksel_recalc,
1879};
1880
1881static const struct clksel func_mcbsp3_gfclk_sel[] = {
1882 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1883 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1884 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1885 { .parent = NULL },
1886};
1887
1888/* Merged func_mcbsp3_gfclk into mcbsp3 */
1889static struct clk mcbsp3_fck = {
1890 .name = "mcbsp3_fck",
1891 .parent = &mcbsp3_sync_mux_ck,
1892 .clksel = func_mcbsp3_gfclk_sel,
1893 .init = &omap2_init_clksel_parent,
1894 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1895 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1896 .ops = &clkops_omap2_dflt,
1897 .recalc = &omap2_clksel_recalc,
1898 .enable_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1899 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1900 .clkdm_name = "abe_clkdm",
1901};
1902
1903static const struct clksel mcbsp4_sync_mux_sel[] = {
1904 { .parent = &func_96m_fclk, .rates = div_1_0_rates },
1905 { .parent = &per_abe_nc_fclk, .rates = div_1_1_rates },
1906 { .parent = NULL },
1907};
1908
1909static struct clk mcbsp4_sync_mux_ck = {
1910 .name = "mcbsp4_sync_mux_ck",
1911 .parent = &func_96m_fclk,
1912 .clksel = mcbsp4_sync_mux_sel,
1913 .init = &omap2_init_clksel_parent,
1914 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1915 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1916 .ops = &clkops_null,
1917 .recalc = &omap2_clksel_recalc,
1918};
1919
1920static const struct clksel per_mcbsp4_gfclk_sel[] = {
1921 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1922 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1923 { .parent = NULL },
1924};
1925
1926/* Merged per_mcbsp4_gfclk into mcbsp4 */
1927static struct clk mcbsp4_fck = {
1928 .name = "mcbsp4_fck",
1929 .parent = &mcbsp4_sync_mux_ck,
1930 .clksel = per_mcbsp4_gfclk_sel,
1931 .init = &omap2_init_clksel_parent,
1932 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1933 .clksel_mask = OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1934 .ops = &clkops_omap2_dflt,
1935 .recalc = &omap2_clksel_recalc,
1936 .enable_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1937 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1938 .clkdm_name = "l4_per_clkdm",
1939};
1940
1941static struct clk mcpdm_fck = {
1942 .name = "mcpdm_fck",
1943 .ops = &clkops_omap2_dflt,
1944 .enable_reg = OMAP4430_CM1_ABE_PDM_CLKCTRL,
1945 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1946 .clkdm_name = "abe_clkdm",
1947 .parent = &pad_clks_ck,
1948 .recalc = &followparent_recalc,
1949};
1950
1951static struct clk mcspi1_fck = {
1952 .name = "mcspi1_fck",
1953 .ops = &clkops_omap2_dflt,
1954 .enable_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1955 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1956 .clkdm_name = "l4_per_clkdm",
1957 .parent = &func_48m_fclk,
1958 .recalc = &followparent_recalc,
1959};
1960
1961static struct clk mcspi2_fck = {
1962 .name = "mcspi2_fck",
1963 .ops = &clkops_omap2_dflt,
1964 .enable_reg = OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1965 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1966 .clkdm_name = "l4_per_clkdm",
1967 .parent = &func_48m_fclk,
1968 .recalc = &followparent_recalc,
1969};
1970
1971static struct clk mcspi3_fck = {
1972 .name = "mcspi3_fck",
1973 .ops = &clkops_omap2_dflt,
1974 .enable_reg = OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1975 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1976 .clkdm_name = "l4_per_clkdm",
1977 .parent = &func_48m_fclk,
1978 .recalc = &followparent_recalc,
1979};
1980
1981static struct clk mcspi4_fck = {
1982 .name = "mcspi4_fck",
1983 .ops = &clkops_omap2_dflt,
1984 .enable_reg = OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1985 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1986 .clkdm_name = "l4_per_clkdm",
1987 .parent = &func_48m_fclk,
1988 .recalc = &followparent_recalc,
1989};
1990
1991static const struct clksel hsmmc1_fclk_sel[] = {
1992 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1993 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1994 { .parent = NULL },
1995};
1996
1997/* Merged hsmmc1_fclk into mmc1 */
1998static struct clk mmc1_fck = {
1999 .name = "mmc1_fck",
2000 .parent = &func_64m_fclk,
2001 .clksel = hsmmc1_fclk_sel,
2002 .init = &omap2_init_clksel_parent,
2003 .clksel_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2004 .clksel_mask = OMAP4430_CLKSEL_MASK,
2005 .ops = &clkops_omap2_dflt,
2006 .recalc = &omap2_clksel_recalc,
2007 .enable_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2008 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2009 .clkdm_name = "l3_init_clkdm",
2010};
2011
2012/* Merged hsmmc2_fclk into mmc2 */
2013static struct clk mmc2_fck = {
2014 .name = "mmc2_fck",
2015 .parent = &func_64m_fclk,
2016 .clksel = hsmmc1_fclk_sel,
2017 .init = &omap2_init_clksel_parent,
2018 .clksel_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2019 .clksel_mask = OMAP4430_CLKSEL_MASK,
2020 .ops = &clkops_omap2_dflt,
2021 .recalc = &omap2_clksel_recalc,
2022 .enable_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2023 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2024 .clkdm_name = "l3_init_clkdm",
2025};
2026
2027static struct clk mmc3_fck = {
2028 .name = "mmc3_fck",
2029 .ops = &clkops_omap2_dflt,
2030 .enable_reg = OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
2031 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2032 .clkdm_name = "l4_per_clkdm",
2033 .parent = &func_48m_fclk,
2034 .recalc = &followparent_recalc,
2035};
2036
2037static struct clk mmc4_fck = {
2038 .name = "mmc4_fck",
2039 .ops = &clkops_omap2_dflt,
2040 .enable_reg = OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
2041 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2042 .clkdm_name = "l4_per_clkdm",
2043 .parent = &func_48m_fclk,
2044 .recalc = &followparent_recalc,
2045};
2046
2047static struct clk mmc5_fck = {
2048 .name = "mmc5_fck",
2049 .ops = &clkops_omap2_dflt,
2050 .enable_reg = OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
2051 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2052 .clkdm_name = "l4_per_clkdm",
2053 .parent = &func_48m_fclk,
2054 .recalc = &followparent_recalc,
2055};
2056
2057static struct clk ocp2scp_usb_phy_phy_48m = {
2058 .name = "ocp2scp_usb_phy_phy_48m",
2059 .ops = &clkops_omap2_dflt,
2060 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2061 .enable_bit = OMAP4430_OPTFCLKEN_PHY_48M_SHIFT,
2062 .clkdm_name = "l3_init_clkdm",
2063 .parent = &func_48m_fclk,
2064 .recalc = &followparent_recalc,
2065};
2066
2067static struct clk ocp2scp_usb_phy_ick = {
2068 .name = "ocp2scp_usb_phy_ick",
2069 .ops = &clkops_omap2_dflt,
2070 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2071 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2072 .clkdm_name = "l3_init_clkdm",
2073 .parent = &l4_div_ck,
2074 .recalc = &followparent_recalc,
2075};
2076
2077static struct clk ocp_wp_noc_ick = {
2078 .name = "ocp_wp_noc_ick",
2079 .ops = &clkops_omap2_dflt,
2080 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
2081 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2082 .flags = ENABLE_ON_INIT,
2083 .clkdm_name = "l3_instr_clkdm",
2084 .parent = &l3_div_ck,
2085 .recalc = &followparent_recalc,
2086};
2087
2088static struct clk rng_ick = {
2089 .name = "rng_ick",
2090 .ops = &clkops_omap2_dflt,
2091 .enable_reg = OMAP4430_CM_L4SEC_RNG_CLKCTRL,
2092 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2093 .clkdm_name = "l4_secure_clkdm",
2094 .parent = &l4_div_ck,
2095 .recalc = &followparent_recalc,
2096};
2097
2098static struct clk sha2md5_fck = {
2099 .name = "sha2md5_fck",
2100 .ops = &clkops_omap2_dflt,
2101 .enable_reg = OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
2102 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2103 .clkdm_name = "l4_secure_clkdm",
2104 .parent = &l3_div_ck,
2105 .recalc = &followparent_recalc,
2106};
2107
2108static struct clk sl2if_ick = {
2109 .name = "sl2if_ick",
2110 .ops = &clkops_omap2_dflt,
2111 .enable_reg = OMAP4430_CM_IVAHD_SL2_CLKCTRL,
2112 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2113 .clkdm_name = "ivahd_clkdm",
2114 .parent = &dpll_iva_m5x2_ck,
2115 .recalc = &followparent_recalc,
2116};
2117
2118static struct clk slimbus1_fclk_1 = {
2119 .name = "slimbus1_fclk_1",
2120 .ops = &clkops_omap2_dflt,
2121 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2122 .enable_bit = OMAP4430_OPTFCLKEN_FCLK1_SHIFT,
2123 .clkdm_name = "abe_clkdm",
2124 .parent = &func_24m_clk,
2125 .recalc = &followparent_recalc,
2126};
2127
2128static struct clk slimbus1_fclk_0 = {
2129 .name = "slimbus1_fclk_0",
2130 .ops = &clkops_omap2_dflt,
2131 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2132 .enable_bit = OMAP4430_OPTFCLKEN_FCLK0_SHIFT,
2133 .clkdm_name = "abe_clkdm",
2134 .parent = &abe_24m_fclk,
2135 .recalc = &followparent_recalc,
2136};
2137
2138static struct clk slimbus1_fclk_2 = {
2139 .name = "slimbus1_fclk_2",
2140 .ops = &clkops_omap2_dflt,
2141 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2142 .enable_bit = OMAP4430_OPTFCLKEN_FCLK2_SHIFT,
2143 .clkdm_name = "abe_clkdm",
2144 .parent = &pad_clks_ck,
2145 .recalc = &followparent_recalc,
2146};
2147
2148static struct clk slimbus1_slimbus_clk = {
2149 .name = "slimbus1_slimbus_clk",
2150 .ops = &clkops_omap2_dflt,
2151 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2152 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT,
2153 .clkdm_name = "abe_clkdm",
2154 .parent = &slimbus_clk,
2155 .recalc = &followparent_recalc,
2156};
2157
2158static struct clk slimbus1_fck = {
2159 .name = "slimbus1_fck",
2160 .ops = &clkops_omap2_dflt,
2161 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2162 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2163 .clkdm_name = "abe_clkdm",
2164 .parent = &ocp_abe_iclk,
2165 .recalc = &followparent_recalc,
2166};
2167
2168static struct clk slimbus2_fclk_1 = {
2169 .name = "slimbus2_fclk_1",
2170 .ops = &clkops_omap2_dflt,
2171 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2172 .enable_bit = OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT,
2173 .clkdm_name = "l4_per_clkdm",
2174 .parent = &per_abe_24m_fclk,
2175 .recalc = &followparent_recalc,
2176};
2177
2178static struct clk slimbus2_fclk_0 = {
2179 .name = "slimbus2_fclk_0",
2180 .ops = &clkops_omap2_dflt,
2181 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2182 .enable_bit = OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT,
2183 .clkdm_name = "l4_per_clkdm",
2184 .parent = &func_24mc_fclk,
2185 .recalc = &followparent_recalc,
2186};
2187
2188static struct clk slimbus2_slimbus_clk = {
2189 .name = "slimbus2_slimbus_clk",
2190 .ops = &clkops_omap2_dflt,
2191 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2192 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT,
2193 .clkdm_name = "l4_per_clkdm",
2194 .parent = &pad_slimbus_core_clks_ck,
2195 .recalc = &followparent_recalc,
2196};
2197
2198static struct clk slimbus2_fck = {
2199 .name = "slimbus2_fck",
2200 .ops = &clkops_omap2_dflt,
2201 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2202 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2203 .clkdm_name = "l4_per_clkdm",
2204 .parent = &l4_div_ck,
2205 .recalc = &followparent_recalc,
2206};
2207
2208static struct clk smartreflex_core_fck = {
2209 .name = "smartreflex_core_fck",
2210 .ops = &clkops_omap2_dflt,
2211 .enable_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
2212 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2213 .clkdm_name = "l4_ao_clkdm",
2214 .parent = &l4_wkup_clk_mux_ck,
2215 .recalc = &followparent_recalc,
2216};
2217
2218static struct clk smartreflex_iva_fck = {
2219 .name = "smartreflex_iva_fck",
2220 .ops = &clkops_omap2_dflt,
2221 .enable_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
2222 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2223 .clkdm_name = "l4_ao_clkdm",
2224 .parent = &l4_wkup_clk_mux_ck,
2225 .recalc = &followparent_recalc,
2226};
2227
2228static struct clk smartreflex_mpu_fck = {
2229 .name = "smartreflex_mpu_fck",
2230 .ops = &clkops_omap2_dflt,
2231 .enable_reg = OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
2232 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2233 .clkdm_name = "l4_ao_clkdm",
2234 .parent = &l4_wkup_clk_mux_ck,
2235 .recalc = &followparent_recalc,
2236};
2237
2238/* Merged dmt1_clk_mux into timer1 */
2239static struct clk timer1_fck = {
2240 .name = "timer1_fck",
2241 .parent = &sys_clkin_ck,
2242 .clksel = abe_dpll_bypass_clk_mux_sel,
2243 .init = &omap2_init_clksel_parent,
2244 .clksel_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2245 .clksel_mask = OMAP4430_CLKSEL_MASK,
2246 .ops = &clkops_omap2_dflt,
2247 .recalc = &omap2_clksel_recalc,
2248 .enable_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2249 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2250 .clkdm_name = "l4_wkup_clkdm",
2251};
2252
2253/* Merged cm2_dm10_mux into timer10 */
2254static struct clk timer10_fck = {
2255 .name = "timer10_fck",
2256 .parent = &sys_clkin_ck,
2257 .clksel = abe_dpll_bypass_clk_mux_sel,
2258 .init = &omap2_init_clksel_parent,
2259 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2260 .clksel_mask = OMAP4430_CLKSEL_MASK,
2261 .ops = &clkops_omap2_dflt,
2262 .recalc = &omap2_clksel_recalc,
2263 .enable_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2264 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2265 .clkdm_name = "l4_per_clkdm",
2266};
2267
2268/* Merged cm2_dm11_mux into timer11 */
2269static struct clk timer11_fck = {
2270 .name = "timer11_fck",
2271 .parent = &sys_clkin_ck,
2272 .clksel = abe_dpll_bypass_clk_mux_sel,
2273 .init = &omap2_init_clksel_parent,
2274 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2275 .clksel_mask = OMAP4430_CLKSEL_MASK,
2276 .ops = &clkops_omap2_dflt,
2277 .recalc = &omap2_clksel_recalc,
2278 .enable_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2279 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2280 .clkdm_name = "l4_per_clkdm",
2281};
2282
2283/* Merged cm2_dm2_mux into timer2 */
2284static struct clk timer2_fck = {
2285 .name = "timer2_fck",
2286 .parent = &sys_clkin_ck,
2287 .clksel = abe_dpll_bypass_clk_mux_sel,
2288 .init = &omap2_init_clksel_parent,
2289 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2290 .clksel_mask = OMAP4430_CLKSEL_MASK,
2291 .ops = &clkops_omap2_dflt,
2292 .recalc = &omap2_clksel_recalc,
2293 .enable_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2294 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2295 .clkdm_name = "l4_per_clkdm",
2296};
2297
2298/* Merged cm2_dm3_mux into timer3 */
2299static struct clk timer3_fck = {
2300 .name = "timer3_fck",
2301 .parent = &sys_clkin_ck,
2302 .clksel = abe_dpll_bypass_clk_mux_sel,
2303 .init = &omap2_init_clksel_parent,
2304 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2305 .clksel_mask = OMAP4430_CLKSEL_MASK,
2306 .ops = &clkops_omap2_dflt,
2307 .recalc = &omap2_clksel_recalc,
2308 .enable_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2309 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2310 .clkdm_name = "l4_per_clkdm",
2311};
2312
2313/* Merged cm2_dm4_mux into timer4 */
2314static struct clk timer4_fck = {
2315 .name = "timer4_fck",
2316 .parent = &sys_clkin_ck,
2317 .clksel = abe_dpll_bypass_clk_mux_sel,
2318 .init = &omap2_init_clksel_parent,
2319 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2320 .clksel_mask = OMAP4430_CLKSEL_MASK,
2321 .ops = &clkops_omap2_dflt,
2322 .recalc = &omap2_clksel_recalc,
2323 .enable_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2324 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2325 .clkdm_name = "l4_per_clkdm",
2326};
2327
2328static const struct clksel timer5_sync_mux_sel[] = {
2329 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
2330 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
2331 { .parent = NULL },
2332};
2333
2334/* Merged timer5_sync_mux into timer5 */
2335static struct clk timer5_fck = {
2336 .name = "timer5_fck",
2337 .parent = &syc_clk_div_ck,
2338 .clksel = timer5_sync_mux_sel,
2339 .init = &omap2_init_clksel_parent,
2340 .clksel_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2341 .clksel_mask = OMAP4430_CLKSEL_MASK,
2342 .ops = &clkops_omap2_dflt,
2343 .recalc = &omap2_clksel_recalc,
2344 .enable_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2345 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2346 .clkdm_name = "abe_clkdm",
2347};
2348
2349/* Merged timer6_sync_mux into timer6 */
2350static struct clk timer6_fck = {
2351 .name = "timer6_fck",
2352 .parent = &syc_clk_div_ck,
2353 .clksel = timer5_sync_mux_sel,
2354 .init = &omap2_init_clksel_parent,
2355 .clksel_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2356 .clksel_mask = OMAP4430_CLKSEL_MASK,
2357 .ops = &clkops_omap2_dflt,
2358 .recalc = &omap2_clksel_recalc,
2359 .enable_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2360 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2361 .clkdm_name = "abe_clkdm",
2362};
2363
2364/* Merged timer7_sync_mux into timer7 */
2365static struct clk timer7_fck = {
2366 .name = "timer7_fck",
2367 .parent = &syc_clk_div_ck,
2368 .clksel = timer5_sync_mux_sel,
2369 .init = &omap2_init_clksel_parent,
2370 .clksel_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2371 .clksel_mask = OMAP4430_CLKSEL_MASK,
2372 .ops = &clkops_omap2_dflt,
2373 .recalc = &omap2_clksel_recalc,
2374 .enable_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2375 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2376 .clkdm_name = "abe_clkdm",
2377};
2378
2379/* Merged timer8_sync_mux into timer8 */
2380static struct clk timer8_fck = {
2381 .name = "timer8_fck",
2382 .parent = &syc_clk_div_ck,
2383 .clksel = timer5_sync_mux_sel,
2384 .init = &omap2_init_clksel_parent,
2385 .clksel_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2386 .clksel_mask = OMAP4430_CLKSEL_MASK,
2387 .ops = &clkops_omap2_dflt,
2388 .recalc = &omap2_clksel_recalc,
2389 .enable_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2390 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2391 .clkdm_name = "abe_clkdm",
2392};
2393
2394/* Merged cm2_dm9_mux into timer9 */
2395static struct clk timer9_fck = {
2396 .name = "timer9_fck",
2397 .parent = &sys_clkin_ck,
2398 .clksel = abe_dpll_bypass_clk_mux_sel,
2399 .init = &omap2_init_clksel_parent,
2400 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2401 .clksel_mask = OMAP4430_CLKSEL_MASK,
2402 .ops = &clkops_omap2_dflt,
2403 .recalc = &omap2_clksel_recalc,
2404 .enable_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2405 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2406 .clkdm_name = "l4_per_clkdm",
2407};
2408
2409static struct clk uart1_fck = {
2410 .name = "uart1_fck",
2411 .ops = &clkops_omap2_dflt,
2412 .enable_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL,
2413 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2414 .clkdm_name = "l4_per_clkdm",
2415 .parent = &func_48m_fclk,
2416 .recalc = &followparent_recalc,
2417};
2418
2419static struct clk uart2_fck = {
2420 .name = "uart2_fck",
2421 .ops = &clkops_omap2_dflt,
2422 .enable_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL,
2423 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2424 .clkdm_name = "l4_per_clkdm",
2425 .parent = &func_48m_fclk,
2426 .recalc = &followparent_recalc,
2427};
2428
2429static struct clk uart3_fck = {
2430 .name = "uart3_fck",
2431 .ops = &clkops_omap2_dflt,
2432 .enable_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL,
2433 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2434 .clkdm_name = "l4_per_clkdm",
2435 .parent = &func_48m_fclk,
2436 .recalc = &followparent_recalc,
2437};
2438
2439static struct clk uart4_fck = {
2440 .name = "uart4_fck",
2441 .ops = &clkops_omap2_dflt,
2442 .enable_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL,
2443 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2444 .clkdm_name = "l4_per_clkdm",
2445 .parent = &func_48m_fclk,
2446 .recalc = &followparent_recalc,
2447};
2448
2449static struct clk usb_host_fs_fck = {
2450 .name = "usb_host_fs_fck",
2451 .ops = &clkops_omap2_dflt,
2452 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
2453 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2454 .clkdm_name = "l3_init_clkdm",
2455 .parent = &func_48mc_fclk,
2456 .recalc = &followparent_recalc,
2457};
2458
2459static const struct clksel utmi_p1_gfclk_sel[] = {
2460 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2461 { .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
2462 { .parent = NULL },
2463};
2464
2465static struct clk utmi_p1_gfclk = {
2466 .name = "utmi_p1_gfclk",
2467 .parent = &init_60m_fclk,
2468 .clksel = utmi_p1_gfclk_sel,
2469 .init = &omap2_init_clksel_parent,
2470 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2471 .clksel_mask = OMAP4430_CLKSEL_UTMI_P1_MASK,
2472 .ops = &clkops_null,
2473 .recalc = &omap2_clksel_recalc,
2474};
2475
2476static struct clk usb_host_hs_utmi_p1_clk = {
2477 .name = "usb_host_hs_utmi_p1_clk",
2478 .ops = &clkops_omap2_dflt,
2479 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2480 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT,
2481 .clkdm_name = "l3_init_clkdm",
2482 .parent = &utmi_p1_gfclk,
2483 .recalc = &followparent_recalc,
2484};
2485
2486static const struct clksel utmi_p2_gfclk_sel[] = {
2487 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2488 { .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
2489 { .parent = NULL },
2490};
2491
2492static struct clk utmi_p2_gfclk = {
2493 .name = "utmi_p2_gfclk",
2494 .parent = &init_60m_fclk,
2495 .clksel = utmi_p2_gfclk_sel,
2496 .init = &omap2_init_clksel_parent,
2497 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2498 .clksel_mask = OMAP4430_CLKSEL_UTMI_P2_MASK,
2499 .ops = &clkops_null,
2500 .recalc = &omap2_clksel_recalc,
2501};
2502
2503static struct clk usb_host_hs_utmi_p2_clk = {
2504 .name = "usb_host_hs_utmi_p2_clk",
2505 .ops = &clkops_omap2_dflt,
2506 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2507 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT,
2508 .clkdm_name = "l3_init_clkdm",
2509 .parent = &utmi_p2_gfclk,
2510 .recalc = &followparent_recalc,
2511};
2512
2513static struct clk usb_host_hs_utmi_p3_clk = {
2514 .name = "usb_host_hs_utmi_p3_clk",
2515 .ops = &clkops_omap2_dflt,
2516 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2517 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT,
2518 .clkdm_name = "l3_init_clkdm",
2519 .parent = &init_60m_fclk,
2520 .recalc = &followparent_recalc,
2521};
2522
2523static struct clk usb_host_hs_hsic480m_p1_clk = {
2524 .name = "usb_host_hs_hsic480m_p1_clk",
2525 .ops = &clkops_omap2_dflt,
2526 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2527 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT,
2528 .clkdm_name = "l3_init_clkdm",
2529 .parent = &dpll_usb_m2_ck,
2530 .recalc = &followparent_recalc,
2531};
2532
2533static struct clk usb_host_hs_hsic60m_p1_clk = {
2534 .name = "usb_host_hs_hsic60m_p1_clk",
2535 .ops = &clkops_omap2_dflt,
2536 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2537 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT,
2538 .clkdm_name = "l3_init_clkdm",
2539 .parent = &init_60m_fclk,
2540 .recalc = &followparent_recalc,
2541};
2542
2543static struct clk usb_host_hs_hsic60m_p2_clk = {
2544 .name = "usb_host_hs_hsic60m_p2_clk",
2545 .ops = &clkops_omap2_dflt,
2546 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2547 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT,
2548 .clkdm_name = "l3_init_clkdm",
2549 .parent = &init_60m_fclk,
2550 .recalc = &followparent_recalc,
2551};
2552
2553static struct clk usb_host_hs_hsic480m_p2_clk = {
2554 .name = "usb_host_hs_hsic480m_p2_clk",
2555 .ops = &clkops_omap2_dflt,
2556 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2557 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT,
2558 .clkdm_name = "l3_init_clkdm",
2559 .parent = &dpll_usb_m2_ck,
2560 .recalc = &followparent_recalc,
2561};
2562
2563static struct clk usb_host_hs_func48mclk = {
2564 .name = "usb_host_hs_func48mclk",
2565 .ops = &clkops_omap2_dflt,
2566 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2567 .enable_bit = OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT,
2568 .clkdm_name = "l3_init_clkdm",
2569 .parent = &func_48mc_fclk,
2570 .recalc = &followparent_recalc,
2571};
2572
2573static struct clk usb_host_hs_fck = {
2574 .name = "usb_host_hs_fck",
2575 .ops = &clkops_omap2_dflt,
2576 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2577 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2578 .clkdm_name = "l3_init_clkdm",
2579 .parent = &init_60m_fclk,
2580 .recalc = &followparent_recalc,
2581};
2582
2583static const struct clksel otg_60m_gfclk_sel[] = {
2584 { .parent = &utmi_phy_clkout_ck, .rates = div_1_0_rates },
2585 { .parent = &xclk60motg_ck, .rates = div_1_1_rates },
2586 { .parent = NULL },
2587};
2588
2589static struct clk otg_60m_gfclk = {
2590 .name = "otg_60m_gfclk",
2591 .parent = &utmi_phy_clkout_ck,
2592 .clksel = otg_60m_gfclk_sel,
2593 .init = &omap2_init_clksel_parent,
2594 .clksel_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2595 .clksel_mask = OMAP4430_CLKSEL_60M_MASK,
2596 .ops = &clkops_null,
2597 .recalc = &omap2_clksel_recalc,
2598};
2599
2600static struct clk usb_otg_hs_xclk = {
2601 .name = "usb_otg_hs_xclk",
2602 .ops = &clkops_omap2_dflt,
2603 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2604 .enable_bit = OMAP4430_OPTFCLKEN_XCLK_SHIFT,
2605 .clkdm_name = "l3_init_clkdm",
2606 .parent = &otg_60m_gfclk,
2607 .recalc = &followparent_recalc,
2608};
2609
2610static struct clk usb_otg_hs_ick = {
2611 .name = "usb_otg_hs_ick",
2612 .ops = &clkops_omap2_dflt,
2613 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2614 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2615 .clkdm_name = "l3_init_clkdm",
2616 .parent = &l3_div_ck,
2617 .recalc = &followparent_recalc,
2618};
2619
2620static struct clk usb_phy_cm_clk32k = {
2621 .name = "usb_phy_cm_clk32k",
2622 .ops = &clkops_omap2_dflt,
2623 .enable_reg = OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
2624 .enable_bit = OMAP4430_OPTFCLKEN_CLK32K_SHIFT,
2625 .clkdm_name = "l4_ao_clkdm",
2626 .parent = &sys_32k_ck,
2627 .recalc = &followparent_recalc,
2628};
2629
2630static struct clk usb_tll_hs_usb_ch2_clk = {
2631 .name = "usb_tll_hs_usb_ch2_clk",
2632 .ops = &clkops_omap2_dflt,
2633 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2634 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT,
2635 .clkdm_name = "l3_init_clkdm",
2636 .parent = &init_60m_fclk,
2637 .recalc = &followparent_recalc,
2638};
2639
2640static struct clk usb_tll_hs_usb_ch0_clk = {
2641 .name = "usb_tll_hs_usb_ch0_clk",
2642 .ops = &clkops_omap2_dflt,
2643 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2644 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT,
2645 .clkdm_name = "l3_init_clkdm",
2646 .parent = &init_60m_fclk,
2647 .recalc = &followparent_recalc,
2648};
2649
2650static struct clk usb_tll_hs_usb_ch1_clk = {
2651 .name = "usb_tll_hs_usb_ch1_clk",
2652 .ops = &clkops_omap2_dflt,
2653 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2654 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT,
2655 .clkdm_name = "l3_init_clkdm",
2656 .parent = &init_60m_fclk,
2657 .recalc = &followparent_recalc,
2658};
2659
2660static struct clk usb_tll_hs_ick = {
2661 .name = "usb_tll_hs_ick",
2662 .ops = &clkops_omap2_dflt,
2663 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2664 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2665 .clkdm_name = "l3_init_clkdm",
2666 .parent = &l4_div_ck,
2667 .recalc = &followparent_recalc,
2668};
2669
2670static const struct clksel_rate div2_14to18_rates[] = {
2671 { .div = 14, .val = 0, .flags = RATE_IN_4430 },
2672 { .div = 18, .val = 1, .flags = RATE_IN_4430 },
2673 { .div = 0 },
2674};
2675
2676static const struct clksel usim_fclk_div[] = {
2677 { .parent = &dpll_per_m4x2_ck, .rates = div2_14to18_rates },
2678 { .parent = NULL },
2679};
2680
2681static struct clk usim_ck = {
2682 .name = "usim_ck",
2683 .parent = &dpll_per_m4x2_ck,
2684 .clksel = usim_fclk_div,
2685 .clksel_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2686 .clksel_mask = OMAP4430_CLKSEL_DIV_MASK,
2687 .ops = &clkops_null,
2688 .recalc = &omap2_clksel_recalc,
2689 .round_rate = &omap2_clksel_round_rate,
2690 .set_rate = &omap2_clksel_set_rate,
2691};
2692
2693static struct clk usim_fclk = {
2694 .name = "usim_fclk",
2695 .ops = &clkops_omap2_dflt,
2696 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2697 .enable_bit = OMAP4430_OPTFCLKEN_FCLK_SHIFT,
2698 .clkdm_name = "l4_wkup_clkdm",
2699 .parent = &usim_ck,
2700 .recalc = &followparent_recalc,
2701};
2702
2703static struct clk usim_fck = {
2704 .name = "usim_fck",
2705 .ops = &clkops_omap2_dflt,
2706 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2707 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2708 .clkdm_name = "l4_wkup_clkdm",
2709 .parent = &sys_32k_ck,
2710 .recalc = &followparent_recalc,
2711};
2712
2713static struct clk wd_timer2_fck = {
2714 .name = "wd_timer2_fck",
2715 .ops = &clkops_omap2_dflt,
2716 .enable_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL,
2717 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2718 .clkdm_name = "l4_wkup_clkdm",
2719 .parent = &sys_32k_ck,
2720 .recalc = &followparent_recalc,
2721};
2722
2723static struct clk wd_timer3_fck = {
2724 .name = "wd_timer3_fck",
2725 .ops = &clkops_omap2_dflt,
2726 .enable_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL,
2727 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2728 .clkdm_name = "abe_clkdm",
2729 .parent = &sys_32k_ck,
2730 .recalc = &followparent_recalc,
2731};
2732
2733/* Remaining optional clocks */
2734static const struct clksel stm_clk_div_div[] = {
2735 { .parent = &pmd_stm_clock_mux_ck, .rates = div3_1to4_rates },
2736 { .parent = NULL },
2737};
2738
2739static struct clk stm_clk_div_ck = {
2740 .name = "stm_clk_div_ck",
2741 .parent = &pmd_stm_clock_mux_ck,
2742 .clksel = stm_clk_div_div,
2743 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2744 .clksel_mask = OMAP4430_CLKSEL_PMD_STM_CLK_MASK,
2745 .ops = &clkops_null,
2746 .recalc = &omap2_clksel_recalc,
2747 .round_rate = &omap2_clksel_round_rate,
2748 .set_rate = &omap2_clksel_set_rate,
2749};
2750
2751static const struct clksel trace_clk_div_div[] = {
2752 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
2753 { .parent = NULL },
2754};
2755
2756static struct clk trace_clk_div_ck = {
2757 .name = "trace_clk_div_ck",
2758 .parent = &pmd_trace_clk_mux_ck,
2759 .clkdm_name = "emu_sys_clkdm",
2760 .clksel = trace_clk_div_div,
2761 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2762 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
2763 .ops = &clkops_null,
2764 .recalc = &omap2_clksel_recalc,
2765 .round_rate = &omap2_clksel_round_rate,
2766 .set_rate = &omap2_clksel_set_rate,
2767};
2768
2769/* SCRM aux clk nodes */
2770
2771static const struct clksel auxclk_src_sel[] = {
2772 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
2773 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
2774 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
2775 { .parent = NULL },
2776};
2777
2778static const struct clksel_rate div16_1to16_rates[] = {
2779 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
2780 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
2781 { .div = 3, .val = 2, .flags = RATE_IN_4430 },
2782 { .div = 4, .val = 3, .flags = RATE_IN_4430 },
2783 { .div = 5, .val = 4, .flags = RATE_IN_4430 },
2784 { .div = 6, .val = 5, .flags = RATE_IN_4430 },
2785 { .div = 7, .val = 6, .flags = RATE_IN_4430 },
2786 { .div = 8, .val = 7, .flags = RATE_IN_4430 },
2787 { .div = 9, .val = 8, .flags = RATE_IN_4430 },
2788 { .div = 10, .val = 9, .flags = RATE_IN_4430 },
2789 { .div = 11, .val = 10, .flags = RATE_IN_4430 },
2790 { .div = 12, .val = 11, .flags = RATE_IN_4430 },
2791 { .div = 13, .val = 12, .flags = RATE_IN_4430 },
2792 { .div = 14, .val = 13, .flags = RATE_IN_4430 },
2793 { .div = 15, .val = 14, .flags = RATE_IN_4430 },
2794 { .div = 16, .val = 15, .flags = RATE_IN_4430 },
2795 { .div = 0 },
2796};
2797
2798static struct clk auxclk0_src_ck = {
2799 .name = "auxclk0_src_ck",
2800 .parent = &sys_clkin_ck,
2801 .init = &omap2_init_clksel_parent,
2802 .ops = &clkops_omap2_dflt,
2803 .clksel = auxclk_src_sel,
2804 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2805 .clksel_mask = OMAP4_SRCSELECT_MASK,
2806 .recalc = &omap2_clksel_recalc,
2807 .enable_reg = OMAP4_SCRM_AUXCLK0,
2808 .enable_bit = OMAP4_ENABLE_SHIFT,
2809};
2810
2811static const struct clksel auxclk0_sel[] = {
2812 { .parent = &auxclk0_src_ck, .rates = div16_1to16_rates },
2813 { .parent = NULL },
2814};
2815
2816static struct clk auxclk0_ck = {
2817 .name = "auxclk0_ck",
2818 .parent = &auxclk0_src_ck,
2819 .clksel = auxclk0_sel,
2820 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2821 .clksel_mask = OMAP4_CLKDIV_MASK,
2822 .ops = &clkops_null,
2823 .recalc = &omap2_clksel_recalc,
2824 .round_rate = &omap2_clksel_round_rate,
2825 .set_rate = &omap2_clksel_set_rate,
2826};
2827
2828static struct clk auxclk1_src_ck = {
2829 .name = "auxclk1_src_ck",
2830 .parent = &sys_clkin_ck,
2831 .init = &omap2_init_clksel_parent,
2832 .ops = &clkops_omap2_dflt,
2833 .clksel = auxclk_src_sel,
2834 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2835 .clksel_mask = OMAP4_SRCSELECT_MASK,
2836 .recalc = &omap2_clksel_recalc,
2837 .enable_reg = OMAP4_SCRM_AUXCLK1,
2838 .enable_bit = OMAP4_ENABLE_SHIFT,
2839};
2840
2841static const struct clksel auxclk1_sel[] = {
2842 { .parent = &auxclk1_src_ck, .rates = div16_1to16_rates },
2843 { .parent = NULL },
2844};
2845
2846static struct clk auxclk1_ck = {
2847 .name = "auxclk1_ck",
2848 .parent = &auxclk1_src_ck,
2849 .clksel = auxclk1_sel,
2850 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2851 .clksel_mask = OMAP4_CLKDIV_MASK,
2852 .ops = &clkops_null,
2853 .recalc = &omap2_clksel_recalc,
2854 .round_rate = &omap2_clksel_round_rate,
2855 .set_rate = &omap2_clksel_set_rate,
2856};
2857
2858static struct clk auxclk2_src_ck = {
2859 .name = "auxclk2_src_ck",
2860 .parent = &sys_clkin_ck,
2861 .init = &omap2_init_clksel_parent,
2862 .ops = &clkops_omap2_dflt,
2863 .clksel = auxclk_src_sel,
2864 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2865 .clksel_mask = OMAP4_SRCSELECT_MASK,
2866 .recalc = &omap2_clksel_recalc,
2867 .enable_reg = OMAP4_SCRM_AUXCLK2,
2868 .enable_bit = OMAP4_ENABLE_SHIFT,
2869};
2870
2871static const struct clksel auxclk2_sel[] = {
2872 { .parent = &auxclk2_src_ck, .rates = div16_1to16_rates },
2873 { .parent = NULL },
2874};
2875
2876static struct clk auxclk2_ck = {
2877 .name = "auxclk2_ck",
2878 .parent = &auxclk2_src_ck,
2879 .clksel = auxclk2_sel,
2880 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2881 .clksel_mask = OMAP4_CLKDIV_MASK,
2882 .ops = &clkops_null,
2883 .recalc = &omap2_clksel_recalc,
2884 .round_rate = &omap2_clksel_round_rate,
2885 .set_rate = &omap2_clksel_set_rate,
2886};
2887
2888static struct clk auxclk3_src_ck = {
2889 .name = "auxclk3_src_ck",
2890 .parent = &sys_clkin_ck,
2891 .init = &omap2_init_clksel_parent,
2892 .ops = &clkops_omap2_dflt,
2893 .clksel = auxclk_src_sel,
2894 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2895 .clksel_mask = OMAP4_SRCSELECT_MASK,
2896 .recalc = &omap2_clksel_recalc,
2897 .enable_reg = OMAP4_SCRM_AUXCLK3,
2898 .enable_bit = OMAP4_ENABLE_SHIFT,
2899};
2900
2901static const struct clksel auxclk3_sel[] = {
2902 { .parent = &auxclk3_src_ck, .rates = div16_1to16_rates },
2903 { .parent = NULL },
2904};
2905
2906static struct clk auxclk3_ck = {
2907 .name = "auxclk3_ck",
2908 .parent = &auxclk3_src_ck,
2909 .clksel = auxclk3_sel,
2910 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2911 .clksel_mask = OMAP4_CLKDIV_MASK,
2912 .ops = &clkops_null,
2913 .recalc = &omap2_clksel_recalc,
2914 .round_rate = &omap2_clksel_round_rate,
2915 .set_rate = &omap2_clksel_set_rate,
2916};
2917
2918static struct clk auxclk4_src_ck = {
2919 .name = "auxclk4_src_ck",
2920 .parent = &sys_clkin_ck,
2921 .init = &omap2_init_clksel_parent,
2922 .ops = &clkops_omap2_dflt,
2923 .clksel = auxclk_src_sel,
2924 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2925 .clksel_mask = OMAP4_SRCSELECT_MASK,
2926 .recalc = &omap2_clksel_recalc,
2927 .enable_reg = OMAP4_SCRM_AUXCLK4,
2928 .enable_bit = OMAP4_ENABLE_SHIFT,
2929};
2930
2931static const struct clksel auxclk4_sel[] = {
2932 { .parent = &auxclk4_src_ck, .rates = div16_1to16_rates },
2933 { .parent = NULL },
2934};
2935
2936static struct clk auxclk4_ck = {
2937 .name = "auxclk4_ck",
2938 .parent = &auxclk4_src_ck,
2939 .clksel = auxclk4_sel,
2940 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2941 .clksel_mask = OMAP4_CLKDIV_MASK,
2942 .ops = &clkops_null,
2943 .recalc = &omap2_clksel_recalc,
2944 .round_rate = &omap2_clksel_round_rate,
2945 .set_rate = &omap2_clksel_set_rate,
2946};
2947
2948static struct clk auxclk5_src_ck = {
2949 .name = "auxclk5_src_ck",
2950 .parent = &sys_clkin_ck,
2951 .init = &omap2_init_clksel_parent,
2952 .ops = &clkops_omap2_dflt,
2953 .clksel = auxclk_src_sel,
2954 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2955 .clksel_mask = OMAP4_SRCSELECT_MASK,
2956 .recalc = &omap2_clksel_recalc,
2957 .enable_reg = OMAP4_SCRM_AUXCLK5,
2958 .enable_bit = OMAP4_ENABLE_SHIFT,
2959};
2960
2961static const struct clksel auxclk5_sel[] = {
2962 { .parent = &auxclk5_src_ck, .rates = div16_1to16_rates },
2963 { .parent = NULL },
2964};
2965
2966static struct clk auxclk5_ck = {
2967 .name = "auxclk5_ck",
2968 .parent = &auxclk5_src_ck,
2969 .clksel = auxclk5_sel,
2970 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2971 .clksel_mask = OMAP4_CLKDIV_MASK,
2972 .ops = &clkops_null,
2973 .recalc = &omap2_clksel_recalc,
2974 .round_rate = &omap2_clksel_round_rate,
2975 .set_rate = &omap2_clksel_set_rate,
2976};
2977
2978static const struct clksel auxclkreq_sel[] = {
2979 { .parent = &auxclk0_ck, .rates = div_1_0_rates },
2980 { .parent = &auxclk1_ck, .rates = div_1_1_rates },
2981 { .parent = &auxclk2_ck, .rates = div_1_2_rates },
2982 { .parent = &auxclk3_ck, .rates = div_1_3_rates },
2983 { .parent = &auxclk4_ck, .rates = div_1_4_rates },
2984 { .parent = &auxclk5_ck, .rates = div_1_5_rates },
2985 { .parent = NULL },
2986};
2987
2988static struct clk auxclkreq0_ck = {
2989 .name = "auxclkreq0_ck",
2990 .parent = &auxclk0_ck,
2991 .init = &omap2_init_clksel_parent,
2992 .ops = &clkops_null,
2993 .clksel = auxclkreq_sel,
2994 .clksel_reg = OMAP4_SCRM_AUXCLKREQ0,
2995 .clksel_mask = OMAP4_MAPPING_MASK,
2996 .recalc = &omap2_clksel_recalc,
2997};
2998
2999static struct clk auxclkreq1_ck = {
3000 .name = "auxclkreq1_ck",
3001 .parent = &auxclk1_ck,
3002 .init = &omap2_init_clksel_parent,
3003 .ops = &clkops_null,
3004 .clksel = auxclkreq_sel,
3005 .clksel_reg = OMAP4_SCRM_AUXCLKREQ1,
3006 .clksel_mask = OMAP4_MAPPING_MASK,
3007 .recalc = &omap2_clksel_recalc,
3008};
3009
3010static struct clk auxclkreq2_ck = {
3011 .name = "auxclkreq2_ck",
3012 .parent = &auxclk2_ck,
3013 .init = &omap2_init_clksel_parent,
3014 .ops = &clkops_null,
3015 .clksel = auxclkreq_sel,
3016 .clksel_reg = OMAP4_SCRM_AUXCLKREQ2,
3017 .clksel_mask = OMAP4_MAPPING_MASK,
3018 .recalc = &omap2_clksel_recalc,
3019};
3020
3021static struct clk auxclkreq3_ck = {
3022 .name = "auxclkreq3_ck",
3023 .parent = &auxclk3_ck,
3024 .init = &omap2_init_clksel_parent,
3025 .ops = &clkops_null,
3026 .clksel = auxclkreq_sel,
3027 .clksel_reg = OMAP4_SCRM_AUXCLKREQ3,
3028 .clksel_mask = OMAP4_MAPPING_MASK,
3029 .recalc = &omap2_clksel_recalc,
3030};
3031
3032static struct clk auxclkreq4_ck = {
3033 .name = "auxclkreq4_ck",
3034 .parent = &auxclk4_ck,
3035 .init = &omap2_init_clksel_parent,
3036 .ops = &clkops_null,
3037 .clksel = auxclkreq_sel,
3038 .clksel_reg = OMAP4_SCRM_AUXCLKREQ4,
3039 .clksel_mask = OMAP4_MAPPING_MASK,
3040 .recalc = &omap2_clksel_recalc,
3041};
3042
3043static struct clk auxclkreq5_ck = {
3044 .name = "auxclkreq5_ck",
3045 .parent = &auxclk5_ck,
3046 .init = &omap2_init_clksel_parent,
3047 .ops = &clkops_null,
3048 .clksel = auxclkreq_sel,
3049 .clksel_reg = OMAP4_SCRM_AUXCLKREQ5,
3050 .clksel_mask = OMAP4_MAPPING_MASK,
3051 .recalc = &omap2_clksel_recalc,
3052};
3053
3054/*
3055 * clkdev
3056 */
3057
3058static struct omap_clk omap44xx_clks[] = {
3059 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
3060 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
3061 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
3062 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
3063 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
3064 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
3065 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
3066 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
3067 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
3068 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
3069 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
3070 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
3071 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
3072 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
3073 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
3074 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
3075 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
3076 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
3077 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
3078 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
3079 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
3080 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
3081 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
3082 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
3083 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
3084 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
3085 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
3086 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
3087 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
3088 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
3089 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
3090 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
3091 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
3092 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
3093 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
3094 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
3095 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
3096 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
3097 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
3098 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
3099 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
3100 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
3101 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
3102 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
3103 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
3104 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
3105 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
3106 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
3107 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
3108 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
3109 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
3110 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
3111 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
3112 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
3113 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
3114 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
3115 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
3116 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
3117 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
3118 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
3119 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
3120 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
3121 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
3122 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
3123 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
3124 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
3125 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
3126 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
3127 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
3128 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
3129 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
3130 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
3131 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
3132 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
3133 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
3134 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
3135 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
3136 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
3137 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
3138 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
3139 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
3140 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
3141 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
3142 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
3143 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
3144 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
3145 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
3146 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
3147 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
3148 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
3149 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
3150 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
3151 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
3152 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
3153 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
3154 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
3155 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
3156 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
3157 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
3158 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
3159 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
3160 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3161 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3162 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
3163 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
3164 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
3165 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
3166 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
3167 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
3168 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
3169 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
3170 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
3171 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
3172 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
3173 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
3174 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
3175 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
3176 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
3177 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
3178 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
3179 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
3180 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
3181 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
3182 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
3183 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
3184 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
3185 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
3186 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
3187 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
3188 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
3189 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
3190 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
3191 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
3192 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
3193 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
3194 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
3195 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
3196 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
3197 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
3198 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
3199 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
3200 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
3201 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
3202 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
3203 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
3204 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
3205 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
3206 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
3207 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
3208 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
3209 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
3210 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
3211 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
3212 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
3213 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
3214 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
3215 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
3216 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
3217 CLK("omap_rng", "ick", &rng_ick, CK_443X),
3218 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
3219 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
3220 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
3221 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
3222 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
3223 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
3224 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
3225 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
3226 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
3227 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
3228 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
3229 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
3230 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
3231 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
3232 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
3233 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
3234 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
3235 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
3236 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
3237 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
3238 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
3239 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
3240 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
3241 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
3242 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
3243 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
3244 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
3245 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
3246 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
3247 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
3248 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
3249 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
3250 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
3251 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
3252 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
3253 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
3254 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
3255 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
3256 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
3257 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
3258 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
3259 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
3260 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
3261 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
3262 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
3263 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
3264 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
3265 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
3266 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
3267 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
3268 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
3269 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
3270 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3271 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3272 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3273 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3274 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
3275 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
3276 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
3277 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
3278 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
3279 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
3280 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
3281 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
3282 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
3283 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
3284 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
3285 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
3286 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
3287 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
3288 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
3289 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
3290 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
3291 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
3292 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
3293 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
3294 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
3295 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3296 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3297 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
3298 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
3299 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
3300 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
3301 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
3302 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
3303 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
3304 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
3305 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
3306 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
3307 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
3308 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
3309 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
3310 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
3311 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
3312 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
3313 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
3314 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
3315 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
3316 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
3317 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
3318 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
3319 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
3320 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3321 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3322 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
3323 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3324 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
3325 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
3326 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3327 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3328 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3329 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3330 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3331 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3332 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3333 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3334 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3335 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3336 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3337 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3338 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3339 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3340 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3341 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3342 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3343 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3344 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3345 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3346 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3347 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3348 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
3349};
3350
3351int __init omap4xxx_clk_init(void)
3352{
3353 struct omap_clk *c;
3354 u32 cpu_clkflg;
3355
3356 if (cpu_is_omap443x()) {
3357 cpu_mask = RATE_IN_4430;
3358 cpu_clkflg = CK_443X;
3359 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
3360 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
3361 cpu_clkflg = CK_446X | CK_443X;
3362
3363 if (cpu_is_omap447x())
3364 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
3365 } else {
3366 return 0;
3367 }
3368
3369 clk_init(&omap2_clk_functions);
3370
3371 /*
3372 * Must stay commented until all OMAP SoC drivers are
3373 * converted to runtime PM, or drivers may start crashing
3374 *
3375 * omap2_clk_disable_clkdm_control();
3376 */
3377
3378 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3379 c++)
3380 clk_preinit(c->lk.clk);
3381
3382 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3383 c++)
3384 if (c->cpu & cpu_clkflg) {
3385 clkdev_add(&c->lk);
3386 clk_register(c->lk.clk);
3387 omap2_init_clk_clkdm(c->lk.clk);
3388 }
3389
3390 /* Disable autoidle on all clocks; let the PM code enable it later */
3391 omap_clk_disable_autoidle_all();
3392
3393 recalculate_root_clocks();
3394
3395 /*
3396 * Only enable those clocks we will need, let the drivers
3397 * enable other clocks as necessary
3398 */
3399 clk_enable_init_clocks();
3400
3401 return 0;
3402}
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
index b9f3ba68148c..ef4d21bfb964 100644
--- a/arch/arm/mach-omap2/clock_common_data.c
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -16,6 +16,7 @@
16 * OMAP3xxx clock definition files. 16 * OMAP3xxx clock definition files.
17 */ 17 */
18 18
19#include <linux/clk-private.h>
19#include "clock.h" 20#include "clock.h"
20 21
21/* clksel_rate data common to 24xx/343x */ 22/* clksel_rate data common to 24xx/343x */
@@ -52,6 +53,13 @@ const struct clksel_rate div_1_0_rates[] = {
52 { .div = 0 }, 53 { .div = 0 },
53}; 54};
54 55
56const struct clksel_rate div3_1to4_rates[] = {
57 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
58 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
59 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
60 { .div = 0 },
61};
62
55const struct clksel_rate div_1_1_rates[] = { 63const struct clksel_rate div_1_1_rates[] = {
56 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, 64 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
57 { .div = 0 }, 65 { .div = 0 },
@@ -109,14 +117,10 @@ const struct clksel_rate div31_1to31_rates[] = {
109 117
110/* Clocks shared between various OMAP SoCs */ 118/* Clocks shared between various OMAP SoCs */
111 119
112struct clk virt_19200000_ck = { 120static struct clk_ops dummy_ck_ops = {};
113 .name = "virt_19200000_ck",
114 .ops = &clkops_null,
115 .rate = 19200000,
116};
117 121
118struct clk virt_26000000_ck = { 122struct clk dummy_ck = {
119 .name = "virt_26000000_ck", 123 .name = "dummy_clk",
120 .ops = &clkops_null, 124 .ops = &dummy_ck_ops,
121 .rate = 26000000, 125 .flags = CLK_IS_BASIC,
122}; 126};
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 512e79a842cb..384873580b23 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -22,12 +22,14 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/limits.h> 23#include <linux/limits.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/clk-provider.h>
25 26
26#include <linux/io.h> 27#include <linux/io.h>
27 28
28#include <linux/bitops.h> 29#include <linux/bitops.h>
29 30
30#include <plat/clock.h> 31#include "soc.h"
32#include "clock.h"
31#include "clockdomain.h" 33#include "clockdomain.h"
32 34
33/* clkdm_list contains all registered struct clockdomains */ 35/* clkdm_list contains all registered struct clockdomains */
@@ -946,35 +948,6 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
946 return 0; 948 return 0;
947} 949}
948 950
949static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
950{
951 unsigned long flags;
952
953 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
954 return -EINVAL;
955
956 spin_lock_irqsave(&clkdm->lock, flags);
957
958 if (atomic_read(&clkdm->usecount) == 0) {
959 spin_unlock_irqrestore(&clkdm->lock, flags);
960 WARN_ON(1); /* underflow */
961 return -ERANGE;
962 }
963
964 if (atomic_dec_return(&clkdm->usecount) > 0) {
965 spin_unlock_irqrestore(&clkdm->lock, flags);
966 return 0;
967 }
968
969 arch_clkdm->clkdm_clk_disable(clkdm);
970 pwrdm_state_switch(clkdm->pwrdm.ptr);
971 spin_unlock_irqrestore(&clkdm->lock, flags);
972
973 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
974
975 return 0;
976}
977
978/** 951/**
979 * clkdm_clk_enable - add an enabled downstream clock to this clkdm 952 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
980 * @clkdm: struct clockdomain * 953 * @clkdm: struct clockdomain *
@@ -1017,15 +990,37 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
1017 */ 990 */
1018int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 991int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1019{ 992{
1020 /* 993 unsigned long flags;
1021 * XXX Rewrite this code to maintain a list of enabled
1022 * downstream clocks for debugging purposes?
1023 */
1024 994
1025 if (!clk) 995 if (!clkdm || !clk || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1026 return -EINVAL; 996 return -EINVAL;
1027 997
1028 return _clkdm_clk_hwmod_disable(clkdm); 998 spin_lock_irqsave(&clkdm->lock, flags);
999
1000 /* corner case: disabling unused clocks */
1001 if (__clk_get_enable_count(clk) == 0)
1002 goto ccd_exit;
1003
1004 if (atomic_read(&clkdm->usecount) == 0) {
1005 spin_unlock_irqrestore(&clkdm->lock, flags);
1006 WARN_ON(1); /* underflow */
1007 return -ERANGE;
1008 }
1009
1010 if (atomic_dec_return(&clkdm->usecount) > 0) {
1011 spin_unlock_irqrestore(&clkdm->lock, flags);
1012 return 0;
1013 }
1014
1015 arch_clkdm->clkdm_clk_disable(clkdm);
1016 pwrdm_state_switch(clkdm->pwrdm.ptr);
1017
1018 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1019
1020ccd_exit:
1021 spin_unlock_irqrestore(&clkdm->lock, flags);
1022
1023 return 0;
1029} 1024}
1030 1025
1031/** 1026/**
@@ -1076,6 +1071,8 @@ int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1076 */ 1071 */
1077int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh) 1072int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1078{ 1073{
1074 unsigned long flags;
1075
1079 /* The clkdm attribute does not exist yet prior OMAP4 */ 1076 /* The clkdm attribute does not exist yet prior OMAP4 */
1080 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1077 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1081 return 0; 1078 return 0;
@@ -1085,9 +1082,28 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1085 * downstream hwmods for debugging purposes? 1082 * downstream hwmods for debugging purposes?
1086 */ 1083 */
1087 1084
1088 if (!oh) 1085 if (!clkdm || !oh || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1089 return -EINVAL; 1086 return -EINVAL;
1090 1087
1091 return _clkdm_clk_hwmod_disable(clkdm); 1088 spin_lock_irqsave(&clkdm->lock, flags);
1089
1090 if (atomic_read(&clkdm->usecount) == 0) {
1091 spin_unlock_irqrestore(&clkdm->lock, flags);
1092 WARN_ON(1); /* underflow */
1093 return -ERANGE;
1094 }
1095
1096 if (atomic_dec_return(&clkdm->usecount) > 0) {
1097 spin_unlock_irqrestore(&clkdm->lock, flags);
1098 return 0;
1099 }
1100
1101 arch_clkdm->clkdm_clk_disable(clkdm);
1102 pwrdm_state_switch(clkdm->pwrdm.ptr);
1103 spin_unlock_irqrestore(&clkdm->lock, flags);
1104
1105 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1106
1107 return 0;
1092} 1108}
1093 1109
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
deleted file mode 100644
index 70294f54e35a..000000000000
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,339 +0,0 @@
1/*
2 * OMAP2 and OMAP3 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/types.h>
16#include <plat/prcm.h>
17#include "prm.h"
18#include "prm2xxx_3xxx.h"
19#include "cm.h"
20#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h"
22#include "cm-regbits-34xx.h"
23#include "prm-regbits-24xx.h"
24#include "clockdomain.h"
25
26static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
27 struct clockdomain *clkdm2)
28{
29 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
30 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
31 return 0;
32}
33
34static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
35 struct clockdomain *clkdm2)
36{
37 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
38 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
39 return 0;
40}
41
42static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
43 struct clockdomain *clkdm2)
44{
45 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
46 PM_WKDEP, (1 << clkdm2->dep_bit));
47}
48
49static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!cd->clkdm)
56 continue; /* only happens if data is erroneous */
57
58 /* PRM accesses are slow, so minimize them */
59 mask |= 1 << cd->clkdm->dep_bit;
60 atomic_set(&cd->wkdep_usecount, 0);
61 }
62
63 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
64 PM_WKDEP);
65 return 0;
66}
67
68static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
69 struct clockdomain *clkdm2)
70{
71 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
72 clkdm1->pwrdm.ptr->prcm_offs,
73 OMAP3430_CM_SLEEPDEP);
74 return 0;
75}
76
77static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
78 struct clockdomain *clkdm2)
79{
80 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
81 clkdm1->pwrdm.ptr->prcm_offs,
82 OMAP3430_CM_SLEEPDEP);
83 return 0;
84}
85
86static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
87 struct clockdomain *clkdm2)
88{
89 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
90 OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
91}
92
93static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
94{
95 struct clkdm_dep *cd;
96 u32 mask = 0;
97
98 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
99 if (!cd->clkdm)
100 continue; /* only happens if data is erroneous */
101
102 /* PRM accesses are slow, so minimize them */
103 mask |= 1 << cd->clkdm->dep_bit;
104 atomic_set(&cd->sleepdep_usecount, 0);
105 }
106 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
107 OMAP3430_CM_SLEEPDEP);
108 return 0;
109}
110
111static int omap2_clkdm_sleep(struct clockdomain *clkdm)
112{
113 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
114 clkdm->pwrdm.ptr->prcm_offs,
115 OMAP2_PM_PWSTCTRL);
116 return 0;
117}
118
119static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
120{
121 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
122 clkdm->pwrdm.ptr->prcm_offs,
123 OMAP2_PM_PWSTCTRL);
124 return 0;
125}
126
127static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
128{
129 if (atomic_read(&clkdm->usecount) > 0)
130 _clkdm_add_autodeps(clkdm);
131
132 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
133 clkdm->clktrctrl_mask);
134}
135
136static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
137{
138 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
139 clkdm->clktrctrl_mask);
140
141 if (atomic_read(&clkdm->usecount) > 0)
142 _clkdm_del_autodeps(clkdm);
143}
144
145static void _enable_hwsup(struct clockdomain *clkdm)
146{
147 if (cpu_is_omap24xx())
148 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
149 clkdm->clktrctrl_mask);
150 else if (cpu_is_omap34xx())
151 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
152 clkdm->clktrctrl_mask);
153}
154
155static void _disable_hwsup(struct clockdomain *clkdm)
156{
157 if (cpu_is_omap24xx())
158 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
159 clkdm->clktrctrl_mask);
160 else if (cpu_is_omap34xx())
161 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
162 clkdm->clktrctrl_mask);
163}
164
165static int omap3_clkdm_sleep(struct clockdomain *clkdm)
166{
167 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
168 clkdm->clktrctrl_mask);
169 return 0;
170}
171
172static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
173{
174 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
175 clkdm->clktrctrl_mask);
176 return 0;
177}
178
179static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
180{
181 bool hwsup = false;
182
183 if (!clkdm->clktrctrl_mask)
184 return 0;
185
186 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
187 clkdm->clktrctrl_mask);
188
189 if (hwsup) {
190 /* Disable HW transitions when we are changing deps */
191 _disable_hwsup(clkdm);
192 _clkdm_add_autodeps(clkdm);
193 _enable_hwsup(clkdm);
194 } else {
195 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
196 omap2_clkdm_wakeup(clkdm);
197 }
198
199 return 0;
200}
201
202static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
203{
204 bool hwsup = false;
205
206 if (!clkdm->clktrctrl_mask)
207 return 0;
208
209 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
210 clkdm->clktrctrl_mask);
211
212 if (hwsup) {
213 /* Disable HW transitions when we are changing deps */
214 _disable_hwsup(clkdm);
215 _clkdm_del_autodeps(clkdm);
216 _enable_hwsup(clkdm);
217 } else {
218 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
219 omap2_clkdm_sleep(clkdm);
220 }
221
222 return 0;
223}
224
225static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
226{
227 if (atomic_read(&clkdm->usecount) > 0)
228 _clkdm_add_autodeps(clkdm);
229
230 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
231 clkdm->clktrctrl_mask);
232}
233
234static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
235{
236 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
237 clkdm->clktrctrl_mask);
238
239 if (atomic_read(&clkdm->usecount) > 0)
240 _clkdm_del_autodeps(clkdm);
241}
242
243static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
244{
245 bool hwsup = false;
246
247 if (!clkdm->clktrctrl_mask)
248 return 0;
249
250 /*
251 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
252 * more details on the unpleasant problem this is working
253 * around
254 */
255 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
256 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
257 omap3_clkdm_wakeup(clkdm);
258 return 0;
259 }
260
261 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
262 clkdm->clktrctrl_mask);
263
264 if (hwsup) {
265 /* Disable HW transitions when we are changing deps */
266 _disable_hwsup(clkdm);
267 _clkdm_add_autodeps(clkdm);
268 _enable_hwsup(clkdm);
269 } else {
270 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
271 omap3_clkdm_wakeup(clkdm);
272 }
273
274 return 0;
275}
276
277static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
278{
279 bool hwsup = false;
280
281 if (!clkdm->clktrctrl_mask)
282 return 0;
283
284 /*
285 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
286 * more details on the unpleasant problem this is working
287 * around
288 */
289 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
290 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
291 _enable_hwsup(clkdm);
292 return 0;
293 }
294
295 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
296 clkdm->clktrctrl_mask);
297
298 if (hwsup) {
299 /* Disable HW transitions when we are changing deps */
300 _disable_hwsup(clkdm);
301 _clkdm_del_autodeps(clkdm);
302 _enable_hwsup(clkdm);
303 } else {
304 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
305 omap3_clkdm_sleep(clkdm);
306 }
307
308 return 0;
309}
310
311struct clkdm_ops omap2_clkdm_operations = {
312 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
313 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
314 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
315 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
316 .clkdm_sleep = omap2_clkdm_sleep,
317 .clkdm_wakeup = omap2_clkdm_wakeup,
318 .clkdm_allow_idle = omap2_clkdm_allow_idle,
319 .clkdm_deny_idle = omap2_clkdm_deny_idle,
320 .clkdm_clk_enable = omap2_clkdm_clk_enable,
321 .clkdm_clk_disable = omap2_clkdm_clk_disable,
322};
323
324struct clkdm_ops omap3_clkdm_operations = {
325 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
326 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
327 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
328 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
329 .clkdm_add_sleepdep = omap3_clkdm_add_sleepdep,
330 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
331 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
332 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
333 .clkdm_sleep = omap3_clkdm_sleep,
334 .clkdm_wakeup = omap3_clkdm_wakeup,
335 .clkdm_allow_idle = omap3_clkdm_allow_idle,
336 .clkdm_deny_idle = omap3_clkdm_deny_idle,
337 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
338 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
339};
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c
deleted file mode 100644
index aca6388fad76..000000000000
--- a/arch/arm/mach-omap2/clockdomain33xx.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * AM33XX clockdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20
21#include "clockdomain.h"
22#include "cm33xx.h"
23
24
25static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
26{
27 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
28 return 0;
29}
30
31static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
32{
33 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
34 return 0;
35}
36
37static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
38{
39 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
40}
41
42static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
43{
44 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
45}
46
47static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
48{
49 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
50 return am33xx_clkdm_wakeup(clkdm);
51
52 return 0;
53}
54
55static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
56{
57 bool hwsup = false;
58
59 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
60
61 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
62 am33xx_clkdm_sleep(clkdm);
63
64 return 0;
65}
66
67struct clkdm_ops am33xx_clkdm_operations = {
68 .clkdm_sleep = am33xx_clkdm_sleep,
69 .clkdm_wakeup = am33xx_clkdm_wakeup,
70 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
71 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
72 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
73 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
74};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
deleted file mode 100644
index 6fc6155625bc..000000000000
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * OMAP4 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include "clockdomain.h"
17#include "cminst44xx.h"
18#include "cm44xx.h"
19
20static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
21 struct clockdomain *clkdm2)
22{
23 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
24 clkdm1->prcm_partition,
25 clkdm1->cm_inst, clkdm1->clkdm_offs +
26 OMAP4_CM_STATICDEP);
27 return 0;
28}
29
30static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
31 struct clockdomain *clkdm2)
32{
33 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
34 clkdm1->prcm_partition,
35 clkdm1->cm_inst, clkdm1->clkdm_offs +
36 OMAP4_CM_STATICDEP);
37 return 0;
38}
39
40static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
41 struct clockdomain *clkdm2)
42{
43 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
44 clkdm1->cm_inst, clkdm1->clkdm_offs +
45 OMAP4_CM_STATICDEP,
46 (1 << clkdm2->dep_bit));
47}
48
49static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 if (!clkdm->prcm_partition)
55 return 0;
56
57 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
58 if (!cd->clkdm)
59 continue; /* only happens if data is erroneous */
60
61 mask |= 1 << cd->clkdm->dep_bit;
62 atomic_set(&cd->wkdep_usecount, 0);
63 }
64
65 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
66 clkdm->cm_inst, clkdm->clkdm_offs +
67 OMAP4_CM_STATICDEP);
68 return 0;
69}
70
71static int omap4_clkdm_sleep(struct clockdomain *clkdm)
72{
73 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
74 clkdm->cm_inst, clkdm->clkdm_offs);
75 return 0;
76}
77
78static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
79{
80 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
81 clkdm->cm_inst, clkdm->clkdm_offs);
82 return 0;
83}
84
85static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
86{
87 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
88 clkdm->cm_inst, clkdm->clkdm_offs);
89}
90
91static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
92{
93 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
94 omap4_clkdm_wakeup(clkdm);
95 else
96 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
97 clkdm->cm_inst,
98 clkdm->clkdm_offs);
99}
100
101static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
102{
103 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
104 return omap4_clkdm_wakeup(clkdm);
105
106 return 0;
107}
108
109static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
110{
111 bool hwsup = false;
112
113 if (!clkdm->prcm_partition)
114 return 0;
115
116 /*
117 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
118 * more details on the unpleasant problem this is working
119 * around
120 */
121 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
122 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
123 omap4_clkdm_allow_idle(clkdm);
124 return 0;
125 }
126
127 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
128 clkdm->cm_inst, clkdm->clkdm_offs);
129
130 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
131 omap4_clkdm_sleep(clkdm);
132
133 return 0;
134}
135
136struct clkdm_ops omap4_clkdm_operations = {
137 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
138 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
139 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
140 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
141 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
142 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
143 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
144 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
145 .clkdm_sleep = omap4_clkdm_sleep,
146 .clkdm_wakeup = omap4_clkdm_wakeup,
147 .clkdm_allow_idle = omap4_clkdm_allow_idle,
148 .clkdm_deny_idle = omap4_clkdm_deny_idle,
149 .clkdm_clk_enable = omap4_clkdm_clk_enable,
150 .clkdm_clk_disable = omap4_clkdm_clk_disable,
151};
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/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index 686290437568..669ef51b17a8 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -59,6 +59,7 @@
59/* CM_CLKSEL_MPU */ 59/* CM_CLKSEL_MPU */
60#define OMAP24XX_CLKSEL_MPU_SHIFT 0 60#define OMAP24XX_CLKSEL_MPU_SHIFT 0
61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0) 61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0)
62#define OMAP24XX_CLKSEL_MPU_WIDTH 5
62 63
63/* CM_CLKSTCTRL_MPU */ 64/* CM_CLKSTCTRL_MPU */
64#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0 65#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0
@@ -237,8 +238,10 @@
237#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8) 238#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8)
238#define OMAP24XX_CLKSEL_L4_SHIFT 5 239#define OMAP24XX_CLKSEL_L4_SHIFT 5
239#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5) 240#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5)
241#define OMAP24XX_CLKSEL_L4_WIDTH 2
240#define OMAP24XX_CLKSEL_L3_SHIFT 0 242#define OMAP24XX_CLKSEL_L3_SHIFT 0
241#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0) 243#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0)
244#define OMAP24XX_CLKSEL_L3_WIDTH 5
242 245
243/* CM_CLKSEL2_CORE */ 246/* CM_CLKSEL2_CORE */
244#define OMAP24XX_CLKSEL_GPT12_SHIFT 22 247#define OMAP24XX_CLKSEL_GPT12_SHIFT 22
@@ -333,7 +336,9 @@
333#define OMAP24XX_EN_DPLL_MASK (0x3 << 0) 336#define OMAP24XX_EN_DPLL_MASK (0x3 << 0)
334 337
335/* CM_IDLEST_CKGEN */ 338/* CM_IDLEST_CKGEN */
339#define OMAP24XX_ST_54M_APLL_SHIFT 9
336#define OMAP24XX_ST_54M_APLL_MASK (1 << 9) 340#define OMAP24XX_ST_54M_APLL_MASK (1 << 9)
341#define OMAP24XX_ST_96M_APLL_SHIFT 8
337#define OMAP24XX_ST_96M_APLL_MASK (1 << 8) 342#define OMAP24XX_ST_96M_APLL_MASK (1 << 8)
338#define OMAP24XX_ST_54M_CLK_MASK (1 << 6) 343#define OMAP24XX_ST_54M_CLK_MASK (1 << 6)
339#define OMAP24XX_ST_12M_CLK_MASK (1 << 5) 344#define OMAP24XX_ST_12M_CLK_MASK (1 << 5)
@@ -361,8 +366,10 @@
361#define OMAP24XX_DPLL_DIV_MASK (0xf << 8) 366#define OMAP24XX_DPLL_DIV_MASK (0xf << 8)
362#define OMAP24XX_54M_SOURCE_SHIFT 5 367#define OMAP24XX_54M_SOURCE_SHIFT 5
363#define OMAP24XX_54M_SOURCE_MASK (1 << 5) 368#define OMAP24XX_54M_SOURCE_MASK (1 << 5)
369#define OMAP24XX_54M_SOURCE_WIDTH 1
364#define OMAP2430_96M_SOURCE_SHIFT 4 370#define OMAP2430_96M_SOURCE_SHIFT 4
365#define OMAP2430_96M_SOURCE_MASK (1 << 4) 371#define OMAP2430_96M_SOURCE_MASK (1 << 4)
372#define OMAP2430_96M_SOURCE_WIDTH 1
366#define OMAP24XX_48M_SOURCE_SHIFT 3 373#define OMAP24XX_48M_SOURCE_SHIFT 3
367#define OMAP24XX_48M_SOURCE_MASK (1 << 3) 374#define OMAP24XX_48M_SOURCE_MASK (1 << 3)
368#define OMAP2430_ALTCLK_SOURCE_SHIFT 0 375#define OMAP2430_ALTCLK_SOURCE_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 59598ffd8783..adf78d325804 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -81,6 +81,7 @@
81/* CM_CLKSEL1_PLL_IVA2 */ 81/* CM_CLKSEL1_PLL_IVA2 */
82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19 82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19
83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19) 83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19)
84#define OMAP3430_IVA2_CLK_SRC_WIDTH 3
84#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 85#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8
85#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) 86#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8)
86#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 87#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0
@@ -89,6 +90,7 @@
89/* CM_CLKSEL2_PLL_IVA2 */ 90/* CM_CLKSEL2_PLL_IVA2 */
90#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0 91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0
91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 92#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
93#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH 5
92 94
93/* CM_CLKSTCTRL_IVA2 */ 95/* CM_CLKSTCTRL_IVA2 */
94#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0 96#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0
@@ -118,6 +120,7 @@
118/* CM_IDLEST_PLL_MPU */ 120/* CM_IDLEST_PLL_MPU */
119#define OMAP3430_ST_MPU_CLK_SHIFT 0 121#define OMAP3430_ST_MPU_CLK_SHIFT 0
120#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) 122#define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
123#define OMAP3430_ST_MPU_CLK_WIDTH 1
121 124
122/* CM_AUTOIDLE_PLL_MPU */ 125/* CM_AUTOIDLE_PLL_MPU */
123#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0 126#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0
@@ -126,6 +129,7 @@
126/* CM_CLKSEL1_PLL_MPU */ 129/* CM_CLKSEL1_PLL_MPU */
127#define OMAP3430_MPU_CLK_SRC_SHIFT 19 130#define OMAP3430_MPU_CLK_SRC_SHIFT 19
128#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19) 131#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19)
132#define OMAP3430_MPU_CLK_SRC_WIDTH 3
129#define OMAP3430_MPU_DPLL_MULT_SHIFT 8 133#define OMAP3430_MPU_DPLL_MULT_SHIFT 8
130#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) 134#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8)
131#define OMAP3430_MPU_DPLL_DIV_SHIFT 0 135#define OMAP3430_MPU_DPLL_DIV_SHIFT 0
@@ -134,6 +138,7 @@
134/* CM_CLKSEL2_PLL_MPU */ 138/* CM_CLKSEL2_PLL_MPU */
135#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0 139#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0
136#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 140#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
141#define OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH 5
137 142
138/* CM_CLKSTCTRL_MPU */ 143/* CM_CLKSTCTRL_MPU */
139#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0 144#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0
@@ -345,10 +350,13 @@
345#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4) 350#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4)
346#define OMAP3430_CLKSEL_L4_SHIFT 2 351#define OMAP3430_CLKSEL_L4_SHIFT 2
347#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2) 352#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2)
353#define OMAP3430_CLKSEL_L4_WIDTH 2
348#define OMAP3430_CLKSEL_L3_SHIFT 0 354#define OMAP3430_CLKSEL_L3_SHIFT 0
349#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) 355#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0)
356#define OMAP3430_CLKSEL_L3_WIDTH 2
350#define OMAP3630_CLKSEL_96M_SHIFT 12 357#define OMAP3630_CLKSEL_96M_SHIFT 12
351#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12) 358#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12)
359#define OMAP3630_CLKSEL_96M_WIDTH 2
352 360
353/* CM_CLKSTCTRL_CORE */ 361/* CM_CLKSTCTRL_CORE */
354#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4 362#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4
@@ -452,6 +460,7 @@
452#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3) 460#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3)
453#define OMAP3430_CLKSEL_RM_SHIFT 1 461#define OMAP3430_CLKSEL_RM_SHIFT 1
454#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1) 462#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1)
463#define OMAP3430_CLKSEL_RM_WIDTH 2
455#define OMAP3430_CLKSEL_GPT1_SHIFT 0 464#define OMAP3430_CLKSEL_GPT1_SHIFT 0
456#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0) 465#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0)
457 466
@@ -520,14 +529,17 @@
520/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ 529/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
521#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 530#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
522#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27) 531#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27)
532#define OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH 5
523#define OMAP3430_CORE_DPLL_MULT_SHIFT 16 533#define OMAP3430_CORE_DPLL_MULT_SHIFT 16
524#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16) 534#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16)
525#define OMAP3430_CORE_DPLL_DIV_SHIFT 8 535#define OMAP3430_CORE_DPLL_DIV_SHIFT 8
526#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) 536#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8)
527#define OMAP3430_SOURCE_96M_SHIFT 6 537#define OMAP3430_SOURCE_96M_SHIFT 6
528#define OMAP3430_SOURCE_96M_MASK (1 << 6) 538#define OMAP3430_SOURCE_96M_MASK (1 << 6)
539#define OMAP3430_SOURCE_96M_WIDTH 1
529#define OMAP3430_SOURCE_54M_SHIFT 5 540#define OMAP3430_SOURCE_54M_SHIFT 5
530#define OMAP3430_SOURCE_54M_MASK (1 << 5) 541#define OMAP3430_SOURCE_54M_MASK (1 << 5)
542#define OMAP3430_SOURCE_54M_WIDTH 1
531#define OMAP3430_SOURCE_48M_SHIFT 3 543#define OMAP3430_SOURCE_48M_SHIFT 3
532#define OMAP3430_SOURCE_48M_MASK (1 << 3) 544#define OMAP3430_SOURCE_48M_MASK (1 << 3)
533 545
@@ -545,7 +557,9 @@
545/* CM_CLKSEL3_PLL */ 557/* CM_CLKSEL3_PLL */
546#define OMAP3430_DIV_96M_SHIFT 0 558#define OMAP3430_DIV_96M_SHIFT 0
547#define OMAP3430_DIV_96M_MASK (0x1f << 0) 559#define OMAP3430_DIV_96M_MASK (0x1f << 0)
560#define OMAP3430_DIV_96M_WIDTH 5
548#define OMAP3630_DIV_96M_MASK (0x3f << 0) 561#define OMAP3630_DIV_96M_MASK (0x3f << 0)
562#define OMAP3630_DIV_96M_WIDTH 6
549 563
550/* CM_CLKSEL4_PLL */ 564/* CM_CLKSEL4_PLL */
551#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8 565#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8
@@ -556,12 +570,14 @@
556/* CM_CLKSEL5_PLL */ 570/* CM_CLKSEL5_PLL */
557#define OMAP3430ES2_DIV_120M_SHIFT 0 571#define OMAP3430ES2_DIV_120M_SHIFT 0
558#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0) 572#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0)
573#define OMAP3430ES2_DIV_120M_WIDTH 5
559 574
560/* CM_CLKOUT_CTRL */ 575/* CM_CLKOUT_CTRL */
561#define OMAP3430_CLKOUT2_EN_SHIFT 7 576#define OMAP3430_CLKOUT2_EN_SHIFT 7
562#define OMAP3430_CLKOUT2_EN_MASK (1 << 7) 577#define OMAP3430_CLKOUT2_EN_MASK (1 << 7)
563#define OMAP3430_CLKOUT2_DIV_SHIFT 3 578#define OMAP3430_CLKOUT2_DIV_SHIFT 3
564#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3) 579#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3)
580#define OMAP3430_CLKOUT2_DIV_WIDTH 3
565#define OMAP3430_CLKOUT2SOURCE_SHIFT 0 581#define OMAP3430_CLKOUT2SOURCE_SHIFT 0
566#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0) 582#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0)
567 583
@@ -592,10 +608,14 @@
592/* CM_CLKSEL_DSS */ 608/* CM_CLKSEL_DSS */
593#define OMAP3430_CLKSEL_TV_SHIFT 8 609#define OMAP3430_CLKSEL_TV_SHIFT 8
594#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) 610#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8)
611#define OMAP3430_CLKSEL_TV_WIDTH 5
595#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8) 612#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8)
613#define OMAP3630_CLKSEL_TV_WIDTH 6
596#define OMAP3430_CLKSEL_DSS1_SHIFT 0 614#define OMAP3430_CLKSEL_DSS1_SHIFT 0
597#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) 615#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0)
616#define OMAP3430_CLKSEL_DSS1_WIDTH 5
598#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0) 617#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0)
618#define OMAP3630_CLKSEL_DSS1_WIDTH 6
599 619
600/* CM_SLEEPDEP_DSS specific bits */ 620/* CM_SLEEPDEP_DSS specific bits */
601 621
@@ -623,7 +643,9 @@
623/* CM_CLKSEL_CAM */ 643/* CM_CLKSEL_CAM */
624#define OMAP3430_CLKSEL_CAM_SHIFT 0 644#define OMAP3430_CLKSEL_CAM_SHIFT 0
625#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) 645#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0)
646#define OMAP3430_CLKSEL_CAM_WIDTH 5
626#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0) 647#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0)
648#define OMAP3630_CLKSEL_CAM_WIDTH 6
627 649
628/* CM_SLEEPDEP_CAM specific bits */ 650/* CM_SLEEPDEP_CAM specific bits */
629 651
@@ -721,21 +743,30 @@
721/* CM_CLKSEL1_EMU */ 743/* CM_CLKSEL1_EMU */
722#define OMAP3430_DIV_DPLL4_SHIFT 24 744#define OMAP3430_DIV_DPLL4_SHIFT 24
723#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) 745#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24)
746#define OMAP3430_DIV_DPLL4_WIDTH 5
724#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24) 747#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24)
748#define OMAP3630_DIV_DPLL4_WIDTH 6
725#define OMAP3430_DIV_DPLL3_SHIFT 16 749#define OMAP3430_DIV_DPLL3_SHIFT 16
726#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16) 750#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16)
751#define OMAP3430_DIV_DPLL3_WIDTH 5
727#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11 752#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11
728#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11) 753#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11)
754#define OMAP3430_CLKSEL_TRACECLK_WIDTH 3
729#define OMAP3430_CLKSEL_PCLK_SHIFT 8 755#define OMAP3430_CLKSEL_PCLK_SHIFT 8
730#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8) 756#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8)
757#define OMAP3430_CLKSEL_PCLK_WIDTH 3
731#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6 758#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6
732#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6) 759#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6)
760#define OMAP3430_CLKSEL_PCLKX2_WIDTH 2
733#define OMAP3430_CLKSEL_ATCLK_SHIFT 4 761#define OMAP3430_CLKSEL_ATCLK_SHIFT 4
734#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4) 762#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4)
763#define OMAP3430_CLKSEL_ATCLK_WIDTH 2
735#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2 764#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2
736#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2) 765#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2)
766#define OMAP3430_TRACE_MUX_CTRL_WIDTH 2
737#define OMAP3430_MUX_CTRL_SHIFT 0 767#define OMAP3430_MUX_CTRL_SHIFT 0
738#define OMAP3430_MUX_CTRL_MASK (0x3 << 0) 768#define OMAP3430_MUX_CTRL_MASK (0x3 << 0)
769#define OMAP3430_MUX_CTRL_WIDTH 2
739 770
740/* CM_CLKSTCTRL_EMU */ 771/* CM_CLKSTCTRL_EMU */
741#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0 772#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index f24e3f7a2bbc..93473f9a551c 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2+ Clock Management prototypes 2 * OMAP2+ Clock Management prototypes
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -22,6 +22,12 @@
22 */ 22 */
23#define MAX_MODULE_READY_TIME 2000 23#define MAX_MODULE_READY_TIME 2000
24 24
25# ifndef __ASSEMBLER__
26extern void __iomem *cm_base;
27extern void __iomem *cm2_base;
28extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
29# endif
30
25/* 31/*
26 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for 32 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
27 * the PRCM to request that a module enter the inactive state in the 33 * the PRCM to request that a module enter the inactive state in the
@@ -33,4 +39,26 @@
33 */ 39 */
34#define MAX_MODULE_DISABLE_TIME 5000 40#define MAX_MODULE_DISABLE_TIME 5000
35 41
42# ifndef __ASSEMBLER__
43
44/**
45 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
46 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
47 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
48 */
49struct cm_ll_data {
50 int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
51 u8 *idlest_reg_id);
52 int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
53};
54
55extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
56 u8 *idlest_reg_id);
57extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
58
59extern int cm_register(struct cm_ll_data *cld);
60extern int cm_unregister(struct cm_ll_data *cld);
61
62# endif
63
36#endif 64#endif
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
new file mode 100644
index 000000000000..db650690e9d0
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -0,0 +1,381 @@
1/*
2 * OMAP2xxx CM module functions
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.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
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/delay.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h"
25#include "cm.h"
26#include "cm2xxx.h"
27#include "cm-regbits-24xx.h"
28#include "clockdomain.h"
29
30/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
31#define DPLL_AUTOIDLE_DISABLE 0x0
32#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
33
34/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
35#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
36#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
37
38/* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */
39#define EN_APLL_LOCKED 3
40
41static const u8 omap2xxx_cm_idlest_offs[] = {
42 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
43};
44
45/*
46 *
47 */
48
49static void _write_clktrctrl(u8 c, s16 module, u32 mask)
50{
51 u32 v;
52
53 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
54 v &= ~mask;
55 v |= c << __ffs(mask);
56 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
57}
58
59bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
60{
61 u32 v;
62
63 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
64 v &= mask;
65 v >>= __ffs(mask);
66
67 return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
68}
69
70void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
71{
72 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
73}
74
75void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
76{
77 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
78}
79
80/*
81 * DPLL autoidle control
82 */
83
84static void _omap2xxx_set_dpll_autoidle(u8 m)
85{
86 u32 v;
87
88 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
89 v &= ~OMAP24XX_AUTO_DPLL_MASK;
90 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
91 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
92}
93
94void omap2xxx_cm_set_dpll_disable_autoidle(void)
95{
96 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
97}
98
99void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
100{
101 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
102}
103
104/*
105 * APLL control
106 */
107
108static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
109{
110 u32 v;
111
112 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
113 v &= ~mask;
114 v |= m << __ffs(mask);
115 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
116}
117
118void omap2xxx_cm_set_apll54_disable_autoidle(void)
119{
120 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
121 OMAP24XX_AUTO_54M_MASK);
122}
123
124void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
125{
126 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
127 OMAP24XX_AUTO_54M_MASK);
128}
129
130void omap2xxx_cm_set_apll96_disable_autoidle(void)
131{
132 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
133 OMAP24XX_AUTO_96M_MASK);
134}
135
136void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
137{
138 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
139 OMAP24XX_AUTO_96M_MASK);
140}
141
142/* Enable an APLL if off */
143static int _omap2xxx_apll_enable(u8 enable_bit, u8 status_bit)
144{
145 u32 v, m;
146
147 m = EN_APLL_LOCKED << enable_bit;
148
149 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
150 if (v & m)
151 return 0; /* apll already enabled */
152
153 v |= m;
154 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
155
156 omap2xxx_cm_wait_module_ready(PLL_MOD, 1, status_bit);
157
158 /*
159 * REVISIT: Should we return an error code if
160 * omap2xxx_cm_wait_module_ready() fails?
161 */
162 return 0;
163}
164
165/* Stop APLL */
166static void _omap2xxx_apll_disable(u8 enable_bit)
167{
168 u32 v;
169
170 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
171 v &= ~(EN_APLL_LOCKED << enable_bit);
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
173}
174
175/* Enable an APLL if off */
176int omap2xxx_cm_apll54_enable(void)
177{
178 return _omap2xxx_apll_enable(OMAP24XX_EN_54M_PLL_SHIFT,
179 OMAP24XX_ST_54M_APLL_SHIFT);
180}
181
182/* Enable an APLL if off */
183int omap2xxx_cm_apll96_enable(void)
184{
185 return _omap2xxx_apll_enable(OMAP24XX_EN_96M_PLL_SHIFT,
186 OMAP24XX_ST_96M_APLL_SHIFT);
187}
188
189/* Stop APLL */
190void omap2xxx_cm_apll54_disable(void)
191{
192 _omap2xxx_apll_disable(OMAP24XX_EN_54M_PLL_SHIFT);
193}
194
195/* Stop APLL */
196void omap2xxx_cm_apll96_disable(void)
197{
198 _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT);
199}
200
201/**
202 * omap2xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
203 * @idlest_reg: CM_IDLEST* virtual address
204 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
205 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
206 *
207 * XXX This function is only needed until absolute register addresses are
208 * removed from the OMAP struct clk records.
209 */
210int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
211 u8 *idlest_reg_id)
212{
213 unsigned long offs;
214 u8 idlest_offs;
215 int i;
216
217 if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff))
218 return -EINVAL;
219
220 idlest_offs = (unsigned long)idlest_reg & 0xff;
221 for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) {
222 if (idlest_offs == omap2xxx_cm_idlest_offs[i]) {
223 *idlest_reg_id = i + 1;
224 break;
225 }
226 }
227
228 if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs))
229 return -EINVAL;
230
231 offs = idlest_reg - cm_base;
232 offs &= 0xff00;
233 *prcm_inst = offs;
234
235 return 0;
236}
237
238/*
239 *
240 */
241
242/**
243 * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
244 * @prcm_mod: PRCM module offset
245 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
246 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
247 *
248 * Wait for the PRCM to indicate that the module identified by
249 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
250 * success or -EBUSY if the module doesn't enable in time.
251 */
252int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
253{
254 int ena = 0, i = 0;
255 u8 cm_idlest_reg;
256 u32 mask;
257
258 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs)))
259 return -EINVAL;
260
261 cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1];
262
263 mask = 1 << idlest_shift;
264 ena = mask;
265
266 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
267 mask) == ena), MAX_MODULE_READY_TIME, i);
268
269 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
270}
271
272/* Clockdomain low-level functions */
273
274static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
275{
276 if (atomic_read(&clkdm->usecount) > 0)
277 _clkdm_add_autodeps(clkdm);
278
279 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
280 clkdm->clktrctrl_mask);
281}
282
283static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
284{
285 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
286 clkdm->clktrctrl_mask);
287
288 if (atomic_read(&clkdm->usecount) > 0)
289 _clkdm_del_autodeps(clkdm);
290}
291
292static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
293{
294 bool hwsup = false;
295
296 if (!clkdm->clktrctrl_mask)
297 return 0;
298
299 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
300 clkdm->clktrctrl_mask);
301
302 if (hwsup) {
303 /* Disable HW transitions when we are changing deps */
304 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
305 clkdm->clktrctrl_mask);
306 _clkdm_add_autodeps(clkdm);
307 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
308 clkdm->clktrctrl_mask);
309 } else {
310 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
311 omap2xxx_clkdm_wakeup(clkdm);
312 }
313
314 return 0;
315}
316
317static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
318{
319 bool hwsup = false;
320
321 if (!clkdm->clktrctrl_mask)
322 return 0;
323
324 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
325 clkdm->clktrctrl_mask);
326
327 if (hwsup) {
328 /* Disable HW transitions when we are changing deps */
329 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
330 clkdm->clktrctrl_mask);
331 _clkdm_del_autodeps(clkdm);
332 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
333 clkdm->clktrctrl_mask);
334 } else {
335 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
336 omap2xxx_clkdm_sleep(clkdm);
337 }
338
339 return 0;
340}
341
342struct clkdm_ops omap2_clkdm_operations = {
343 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
344 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
345 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
346 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
347 .clkdm_sleep = omap2xxx_clkdm_sleep,
348 .clkdm_wakeup = omap2xxx_clkdm_wakeup,
349 .clkdm_allow_idle = omap2xxx_clkdm_allow_idle,
350 .clkdm_deny_idle = omap2xxx_clkdm_deny_idle,
351 .clkdm_clk_enable = omap2xxx_clkdm_clk_enable,
352 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
353};
354
355/*
356 *
357 */
358
359static struct cm_ll_data omap2xxx_cm_ll_data = {
360 .split_idlest_reg = &omap2xxx_cm_split_idlest_reg,
361 .wait_module_ready = &omap2xxx_cm_wait_module_ready,
362};
363
364int __init omap2xxx_cm_init(void)
365{
366 if (!cpu_is_omap24xx())
367 return 0;
368
369 return cm_register(&omap2xxx_cm_ll_data);
370}
371
372static void __exit omap2xxx_cm_exit(void)
373{
374 if (!cpu_is_omap24xx())
375 return;
376
377 /* Should never happen */
378 WARN(cm_unregister(&omap2xxx_cm_ll_data),
379 "%s: cm_ll_data function pointer mismatch\n", __func__);
380}
381__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
new file mode 100644
index 000000000000..4cbb39b051d2
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -0,0 +1,70 @@
1/*
2 * OMAP2xxx Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
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 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP2420_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
24#define OMAP2430_CM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
26
27/*
28 * Module specific CM register offsets from CM_BASE + domain offset
29 * Use cm_{read,write}_mod_reg() with these registers.
30 * These register offsets generally appear in more than one PRCM submodule.
31 */
32
33/* OMAP2-specific register offsets */
34
35#define OMAP24XX_CM_FCLKEN2 0x0004
36#define OMAP24XX_CM_ICLKEN4 0x001c
37#define OMAP24XX_CM_AUTOIDLE4 0x003c
38#define OMAP24XX_CM_IDLEST4 0x002c
39
40/* CM_IDLEST bit field values to indicate deasserted IdleReq */
41
42#define OMAP24XX_CM_IDLEST_VAL 0
43
44
45/* Clock management domain register get/set */
46
47#ifndef __ASSEMBLER__
48
49extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
50extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
51
52extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
53extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
54
55extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
56extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
57extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
58extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
59
60extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
61extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
62 u8 idlest_shift);
63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
64 s16 *prcm_inst, u8 *idlest_reg_id);
65
66extern int __init omap2xxx_cm_init(void);
67
68#endif
69
70#endif
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 57b2f3c2fbf3..bfbd16fe9151 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -16,28 +16,7 @@
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
18 18
19#include "prcm-common.h" 19#include "cm.h"
20
21#define OMAP2420_CM_REGADDR(module, reg) \
22 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
23#define OMAP2430_CM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
25#define OMAP34XX_CM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
27
28
29/*
30 * OMAP3-specific global CM registers
31 * Use cm_{read,write}_reg() with these registers.
32 * These registers appear once per CM module.
33 */
34
35#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
36#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
37#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
38
39#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
40#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
41 20
42/* 21/*
43 * Module specific CM register offsets from CM_BASE + domain offset 22 * Module specific CM register offsets from CM_BASE + domain offset
@@ -57,6 +36,7 @@
57#define CM_IDLEST 0x0020 36#define CM_IDLEST 0x0020
58#define CM_IDLEST1 CM_IDLEST 37#define CM_IDLEST1 CM_IDLEST
59#define CM_IDLEST2 0x0024 38#define CM_IDLEST2 0x0024
39#define OMAP2430_CM_IDLEST3 0x0028
60#define CM_AUTOIDLE 0x0030 40#define CM_AUTOIDLE 0x0030
61#define CM_AUTOIDLE1 CM_AUTOIDLE 41#define CM_AUTOIDLE1 CM_AUTOIDLE
62#define CM_AUTOIDLE2 0x0034 42#define CM_AUTOIDLE2 0x0034
@@ -66,70 +46,60 @@
66#define CM_CLKSEL2 0x0044 46#define CM_CLKSEL2 0x0044
67#define OMAP2_CM_CLKSTCTRL 0x0048 47#define OMAP2_CM_CLKSTCTRL 0x0048
68 48
69/* OMAP2-specific register offsets */ 49#ifndef __ASSEMBLER__
70
71#define OMAP24XX_CM_FCLKEN2 0x0004
72#define OMAP24XX_CM_ICLKEN4 0x001c
73#define OMAP24XX_CM_AUTOIDLE4 0x003c
74#define OMAP24XX_CM_IDLEST4 0x002c
75
76#define OMAP2430_CM_IDLEST3 0x0028
77
78/* OMAP3-specific register offsets */
79
80#define OMAP3430_CM_CLKEN_PLL 0x0004
81#define OMAP3430ES2_CM_CLKEN2 0x0004
82#define OMAP3430ES2_CM_FCLKEN3 0x0008
83#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
84#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
85#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
86#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
87#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
88#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
89#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
90#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
91#define OMAP3430_CM_CLKSTST 0x004c
92#define OMAP3430ES2_CM_CLKSEL4 0x004c
93#define OMAP3430ES2_CM_CLKSEL5 0x0050
94#define OMAP3430_CM_CLKSEL2_EMU 0x0050
95#define OMAP3430_CM_CLKSEL3_EMU 0x0054
96 50
51#include <linux/io.h>
97 52
98/* CM_IDLEST bit field values to indicate deasserted IdleReq */ 53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
54{
55 return __raw_readl(cm_base + module + idx);
56}
99 57
100#define OMAP24XX_CM_IDLEST_VAL 0 58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
101#define OMAP34XX_CM_IDLEST_VAL 1 59{
60 __raw_writel(val, cm_base + module + idx);
61}
102 62
63/* Read-modify-write a register in a CM module. Caller must lock */
64static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
65 s16 idx)
66{
67 u32 v;
103 68
104/* Clock management domain register get/set */ 69 v = omap2_cm_read_mod_reg(module, idx);
70 v &= ~mask;
71 v |= bits;
72 omap2_cm_write_mod_reg(v, module, idx);
105 73
106#ifndef __ASSEMBLER__ 74 return v;
75}
107 76
108extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx); 77/* Read a CM register, AND it, and shift the result down to bit 0 */
109extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx); 78static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
110extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 79{
80 u32 v;
111 81
112extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, 82 v = omap2_cm_read_mod_reg(domain, idx);
113 u8 idlest_shift); 83 v &= mask;
114extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 84 v >>= __ffs(mask);
115extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
116 85
117extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask); 86 return v;
118extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 87}
119extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
120 88
121extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 89static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
122extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); 90{
123extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); 91 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
124extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); 92}
125 93
126extern void omap2xxx_cm_set_dpll_disable_autoidle(void); 94static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
127extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); 95{
96 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
97}
128 98
129extern void omap2xxx_cm_set_apll54_disable_autoidle(void); 99extern int omap2xxx_cm_apll54_enable(void);
130extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void); 100extern void omap2xxx_cm_apll54_disable(void);
131extern void omap2xxx_cm_set_apll96_disable_autoidle(void); 101extern int omap2xxx_cm_apll96_enable(void);
132extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); 102extern void omap2xxx_cm_apll96_disable(void);
133 103
134#endif 104#endif
135 105
@@ -138,6 +108,7 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
138/* CM_CLKSEL_GFX */ 108/* CM_CLKSEL_GFX */
139#define OMAP_CLKSEL_GFX_SHIFT 0 109#define OMAP_CLKSEL_GFX_SHIFT 0
140#define OMAP_CLKSEL_GFX_MASK (0x7 << 0) 110#define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
111#define OMAP_CLKSEL_GFX_WIDTH 3
141 112
142/* CM_ICLKEN_GFX */ 113/* CM_ICLKEN_GFX */
143#define OMAP_EN_GFX_SHIFT 0 114#define OMAP_EN_GFX_SHIFT 0
@@ -146,11 +117,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
146/* CM_IDLEST_GFX */ 117/* CM_IDLEST_GFX */
147#define OMAP_ST_GFX_MASK (1 << 0) 118#define OMAP_ST_GFX_MASK (1 << 0)
148 119
149
150/* Function prototypes */
151# ifndef __ASSEMBLER__
152extern void omap3_cm_save_context(void);
153extern void omap3_cm_restore_context(void);
154# endif
155
156#endif 120#endif
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 13f56eafef03..b2dfcd777194 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -22,8 +22,9 @@
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 "clockdomain.h"
27#include "cm.h" 28#include "cm.h"
28#include "cm33xx.h" 29#include "cm33xx.h"
29#include "cm-regbits-34xx.h" 30#include "cm-regbits-34xx.h"
@@ -311,3 +312,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
311 v &= ~AM33XX_MODULEMODE_MASK; 312 v &= ~AM33XX_MODULEMODE_MASK;
312 am33xx_cm_write_reg(v, inst, clkctrl_offs); 313 am33xx_cm_write_reg(v, inst, clkctrl_offs);
313} 314}
315
316/*
317 * Clockdomain low-level functions
318 */
319
320static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
321{
322 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
323 return 0;
324}
325
326static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
327{
328 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
329 return 0;
330}
331
332static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
333{
334 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
335}
336
337static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
338{
339 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
340}
341
342static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
343{
344 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
345 return am33xx_clkdm_wakeup(clkdm);
346
347 return 0;
348}
349
350static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
351{
352 bool hwsup = false;
353
354 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
355
356 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
357 am33xx_clkdm_sleep(clkdm);
358
359 return 0;
360}
361
362struct clkdm_ops am33xx_clkdm_operations = {
363 .clkdm_sleep = am33xx_clkdm_sleep,
364 .clkdm_wakeup = am33xx_clkdm_wakeup,
365 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
366 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
367 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
368 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
369};
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 7f07ab02a5b3..c2086f2e86b6 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -1,8 +1,10 @@
1/* 1/*
2 * OMAP2/3 CM module functions 2 * OMAP3xxx CM module functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * 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 10 * it under the terms of the GNU General Public License version 2 as
@@ -12,8 +14,6 @@
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/types.h> 15#include <linux/types.h>
14#include <linux/delay.h> 16#include <linux/delay.h>
15#include <linux/spinlock.h>
16#include <linux/list.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
@@ -21,56 +21,16 @@
21#include "soc.h" 21#include "soc.h"
22#include "iomap.h" 22#include "iomap.h"
23#include "common.h" 23#include "common.h"
24#include "prm2xxx_3xxx.h"
24#include "cm.h" 25#include "cm.h"
25#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
26#include "cm-regbits-24xx.h"
27#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
28#include "clockdomain.h"
28 29
29/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ 30static const u8 omap3xxx_cm_idlest_offs[] = {
30#define DPLL_AUTOIDLE_DISABLE 0x0 31 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
31#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
32
33/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
34#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
35#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
36
37static const u8 cm_idlest_offs[] = {
38 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
39}; 32};
40 33
41u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
42{
43 return __raw_readl(cm_base + module + idx);
44}
45
46void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
47{
48 __raw_writel(val, cm_base + module + idx);
49}
50
51/* Read-modify-write a register in a CM module. Caller must lock */
52u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
53{
54 u32 v;
55
56 v = omap2_cm_read_mod_reg(module, idx);
57 v &= ~mask;
58 v |= bits;
59 omap2_cm_write_mod_reg(v, module, idx);
60
61 return v;
62}
63
64u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
65{
66 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
67}
68
69u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
70{
71 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
72}
73
74/* 34/*
75 * 35 *
76 */ 36 */
@@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
85 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); 45 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
86} 46}
87 47
88bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask) 48bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
89{ 49{
90 u32 v; 50 u32 v;
91 bool ret = 0;
92
93 BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx());
94 51
95 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); 52 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
96 v &= mask; 53 v &= mask;
97 v >>= __ffs(mask); 54 v >>= __ffs(mask);
98 55
99 if (cpu_is_omap24xx()) 56 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
100 ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
101 else
102 ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
103
104 return ret;
105}
106
107void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
108{
109 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
110}
111
112void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
113{
114 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
115} 57}
116 58
117void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) 59void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
@@ -135,109 +77,247 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
135} 77}
136 78
137/* 79/*
138 * DPLL autoidle control 80 *
139 */ 81 */
140 82
141static void _omap2xxx_set_dpll_autoidle(u8 m) 83/**
84 * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
85 * @prcm_mod: PRCM module offset
86 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
87 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
88 *
89 * Wait for the PRCM to indicate that the module identified by
90 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
91 * success or -EBUSY if the module doesn't enable in time.
92 */
93int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
142{ 94{
143 u32 v; 95 int ena = 0, i = 0;
96 u8 cm_idlest_reg;
97 u32 mask;
144 98
145 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 99 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs)))
146 v &= ~OMAP24XX_AUTO_DPLL_MASK; 100 return -EINVAL;
147 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
148 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
149}
150 101
151void omap2xxx_cm_set_dpll_disable_autoidle(void) 102 cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1];
152{ 103
153 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP); 104 mask = 1 << idlest_shift;
105 ena = 0;
106
107 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
108 mask) == ena), MAX_MODULE_READY_TIME, i);
109
110 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
154} 111}
155 112
156void omap2xxx_cm_set_dpll_auto_low_power_stop(void) 113/**
114 * omap3xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
115 * @idlest_reg: CM_IDLEST* virtual address
116 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
117 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
118 *
119 * XXX This function is only needed until absolute register addresses are
120 * removed from the OMAP struct clk records.
121 */
122int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
123 u8 *idlest_reg_id)
157{ 124{
158 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE); 125 unsigned long offs;
126 u8 idlest_offs;
127 int i;
128
129 if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) ||
130 idlest_reg > (cm_base + 0x1ffff))
131 return -EINVAL;
132
133 idlest_offs = (unsigned long)idlest_reg & 0xff;
134 for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) {
135 if (idlest_offs == omap3xxx_cm_idlest_offs[i]) {
136 *idlest_reg_id = i + 1;
137 break;
138 }
139 }
140
141 if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs))
142 return -EINVAL;
143
144 offs = idlest_reg - cm_base;
145 offs &= 0xff00;
146 *prcm_inst = offs;
147
148 return 0;
159} 149}
160 150
161/* 151/* Clockdomain low-level operations */
162 * APLL autoidle control
163 */
164 152
165static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) 153static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
154 struct clockdomain *clkdm2)
166{ 155{
167 u32 v; 156 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
157 clkdm1->pwrdm.ptr->prcm_offs,
158 OMAP3430_CM_SLEEPDEP);
159 return 0;
160}
168 161
169 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 162static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1,
170 v &= ~mask; 163 struct clockdomain *clkdm2)
171 v |= m << __ffs(mask); 164{
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); 165 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
166 clkdm1->pwrdm.ptr->prcm_offs,
167 OMAP3430_CM_SLEEPDEP);
168 return 0;
173} 169}
174 170
175void omap2xxx_cm_set_apll54_disable_autoidle(void) 171static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1,
172 struct clockdomain *clkdm2)
176{ 173{
177 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 174 return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
178 OMAP24XX_AUTO_54M_MASK); 175 OMAP3430_CM_SLEEPDEP,
176 (1 << clkdm2->dep_bit));
179} 177}
180 178
181void omap2xxx_cm_set_apll54_auto_low_power_stop(void) 179static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
182{ 180{
183 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 181 struct clkdm_dep *cd;
184 OMAP24XX_AUTO_54M_MASK); 182 u32 mask = 0;
183
184 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
185 if (!cd->clkdm)
186 continue; /* only happens if data is erroneous */
187
188 mask |= 1 << cd->clkdm->dep_bit;
189 atomic_set(&cd->sleepdep_usecount, 0);
190 }
191 omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
192 OMAP3430_CM_SLEEPDEP);
193 return 0;
185} 194}
186 195
187void omap2xxx_cm_set_apll96_disable_autoidle(void) 196static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm)
188{ 197{
189 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 198 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
190 OMAP24XX_AUTO_96M_MASK); 199 clkdm->clktrctrl_mask);
200 return 0;
191} 201}
192 202
193void omap2xxx_cm_set_apll96_auto_low_power_stop(void) 203static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm)
194{ 204{
195 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 205 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
196 OMAP24XX_AUTO_96M_MASK); 206 clkdm->clktrctrl_mask);
207 return 0;
197} 208}
198 209
199/* 210static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm)
200 * 211{
201 */ 212 if (atomic_read(&clkdm->usecount) > 0)
213 _clkdm_add_autodeps(clkdm);
202 214
203/** 215 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
204 * omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby 216 clkdm->clktrctrl_mask);
205 * @prcm_mod: PRCM module offset 217}
206 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 218
207 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 219static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm)
208 *
209 * XXX document
210 */
211int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
212{ 220{
213 int ena = 0, i = 0; 221 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
214 u8 cm_idlest_reg; 222 clkdm->clktrctrl_mask);
215 u32 mask;
216 223
217 if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs))) 224 if (atomic_read(&clkdm->usecount) > 0)
218 return -EINVAL; 225 _clkdm_del_autodeps(clkdm);
226}
219 227
220 cm_idlest_reg = cm_idlest_offs[idlest_id - 1]; 228static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
229{
230 bool hwsup = false;
221 231
222 mask = 1 << idlest_shift; 232 if (!clkdm->clktrctrl_mask)
233 return 0;
223 234
224 if (cpu_is_omap24xx()) 235 /*
225 ena = mask; 236 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
226 else if (cpu_is_omap34xx()) 237 * more details on the unpleasant problem this is working
227 ena = 0; 238 * around
228 else 239 */
229 BUG(); 240 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
241 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
242 omap3xxx_clkdm_wakeup(clkdm);
243 return 0;
244 }
245
246 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
247 clkdm->clktrctrl_mask);
248
249 if (hwsup) {
250 /* Disable HW transitions when we are changing deps */
251 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
252 clkdm->clktrctrl_mask);
253 _clkdm_add_autodeps(clkdm);
254 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
255 clkdm->clktrctrl_mask);
256 } else {
257 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
258 omap3xxx_clkdm_wakeup(clkdm);
259 }
260
261 return 0;
262}
230 263
231 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena), 264static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
232 MAX_MODULE_READY_TIME, i); 265{
266 bool hwsup = false;
233 267
234 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 268 if (!clkdm->clktrctrl_mask)
269 return 0;
270
271 /*
272 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
273 * more details on the unpleasant problem this is working
274 * around
275 */
276 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
277 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
278 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
279 clkdm->clktrctrl_mask);
280 return 0;
281 }
282
283 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
284 clkdm->clktrctrl_mask);
285
286 if (hwsup) {
287 /* Disable HW transitions when we are changing deps */
288 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
289 clkdm->clktrctrl_mask);
290 _clkdm_del_autodeps(clkdm);
291 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
292 clkdm->clktrctrl_mask);
293 } else {
294 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
295 omap3xxx_clkdm_sleep(clkdm);
296 }
297
298 return 0;
235} 299}
236 300
301struct clkdm_ops omap3_clkdm_operations = {
302 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
303 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
304 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
305 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
306 .clkdm_add_sleepdep = omap3xxx_clkdm_add_sleepdep,
307 .clkdm_del_sleepdep = omap3xxx_clkdm_del_sleepdep,
308 .clkdm_read_sleepdep = omap3xxx_clkdm_read_sleepdep,
309 .clkdm_clear_all_sleepdeps = omap3xxx_clkdm_clear_all_sleepdeps,
310 .clkdm_sleep = omap3xxx_clkdm_sleep,
311 .clkdm_wakeup = omap3xxx_clkdm_wakeup,
312 .clkdm_allow_idle = omap3xxx_clkdm_allow_idle,
313 .clkdm_deny_idle = omap3xxx_clkdm_deny_idle,
314 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
315 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
316};
317
237/* 318/*
238 * Context save/restore code - OMAP3 only 319 * Context save/restore code - OMAP3 only
239 */ 320 */
240#ifdef CONFIG_ARCH_OMAP3
241struct omap3_cm_regs { 321struct omap3_cm_regs {
242 u32 iva2_cm_clksel1; 322 u32 iva2_cm_clksel1;
243 u32 iva2_cm_clksel2; 323 u32 iva2_cm_clksel2;
@@ -555,4 +635,31 @@ void omap3_cm_restore_context(void)
555 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD, 635 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
556 OMAP3_CM_CLKOUT_CTRL_OFFSET); 636 OMAP3_CM_CLKOUT_CTRL_OFFSET);
557} 637}
558#endif 638
639/*
640 *
641 */
642
643static struct cm_ll_data omap3xxx_cm_ll_data = {
644 .split_idlest_reg = &omap3xxx_cm_split_idlest_reg,
645 .wait_module_ready = &omap3xxx_cm_wait_module_ready,
646};
647
648int __init omap3xxx_cm_init(void)
649{
650 if (!cpu_is_omap34xx())
651 return 0;
652
653 return cm_register(&omap3xxx_cm_ll_data);
654}
655
656static void __exit omap3xxx_cm_exit(void)
657{
658 if (!cpu_is_omap34xx())
659 return;
660
661 /* Should never happen */
662 WARN(cm_unregister(&omap3xxx_cm_ll_data),
663 "%s: cm_ll_data function pointer mismatch\n", __func__);
664}
665__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
new file mode 100644
index 000000000000..e8e146f4a43f
--- /dev/null
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -0,0 +1,91 @@
1/*
2 * OMAP2/3 Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
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 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM3XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP34XX_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
24
25
26/*
27 * OMAP3-specific global CM registers
28 * Use cm_{read,write}_reg() with these registers.
29 * These registers appear once per CM module.
30 */
31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
38
39/*
40 * Module specific CM register offsets from CM_BASE + domain offset
41 * Use cm_{read,write}_mod_reg() with these registers.
42 * These register offsets generally appear in more than one PRCM submodule.
43 */
44
45/* OMAP3-specific register offsets */
46
47#define OMAP3430_CM_CLKEN_PLL 0x0004
48#define OMAP3430ES2_CM_CLKEN2 0x0004
49#define OMAP3430ES2_CM_FCLKEN3 0x0008
50#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
51#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
52#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
53#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
54#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
55#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
56#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
57#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
58#define OMAP3430_CM_CLKSTST 0x004c
59#define OMAP3430ES2_CM_CLKSEL4 0x004c
60#define OMAP3430ES2_CM_CLKSEL5 0x0050
61#define OMAP3430_CM_CLKSEL2_EMU 0x0050
62#define OMAP3430_CM_CLKSEL3_EMU 0x0054
63
64
65/* CM_IDLEST bit field values to indicate deasserted IdleReq */
66
67#define OMAP34XX_CM_IDLEST_VAL 1
68
69
70#ifndef __ASSEMBLER__
71
72extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
73extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
74extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
75extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
76
77extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
78extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
79 u8 idlest_shift);
80
81extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
82 s16 *prcm_inst, u8 *idlest_reg_id);
83
84extern void omap3_cm_save_context(void);
85extern void omap3_cm_restore_context(void);
86
87extern int __init omap3xxx_cm_init(void);
88
89#endif
90
91#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
new file mode 100644
index 000000000000..0bab493ec133
--- /dev/null
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -0,0 +1,139 @@
1/*
2 * OMAP2+ common Clock Management (CM) IP block functions
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
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 * XXX This code should eventually be moved to a CM driver.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16
17#include "cm2xxx.h"
18#include "cm3xxx.h"
19#include "cm44xx.h"
20#include "common.h"
21
22/*
23 * cm_ll_data: function pointers to SoC-specific implementations of
24 * common CM functions
25 */
26static struct cm_ll_data null_cm_ll_data;
27static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
28
29/* cm_base: base virtual address of the CM IP block */
30void __iomem *cm_base;
31
32/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
33void __iomem *cm2_base;
34
35/**
36 * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
37 * @cm: CM base virtual address
38 * @cm2: CM2 base virtual address (if present on the booted SoC)
39 *
40 * XXX Will be replaced when the PRM/CM drivers are completed.
41 */
42void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
43{
44 cm_base = cm;
45 cm2_base = cm2;
46}
47
48/**
49 * cm_split_idlest_reg - split CM_IDLEST reg addr into its components
50 * @idlest_reg: CM_IDLEST* virtual address
51 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
52 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
53 *
54 * Given an absolute CM_IDLEST register address @idlest_reg, passes
55 * the PRCM instance offset and IDLEST register ID back to the caller
56 * via the @prcm_inst and @idlest_reg_id. Returns -EINVAL upon error,
57 * or 0 upon success. XXX This function is only needed until absolute
58 * register addresses are removed from the OMAP struct clk records.
59 */
60int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
61 u8 *idlest_reg_id)
62{
63 if (!cm_ll_data->split_idlest_reg) {
64 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
65 __func__);
66 return -EINVAL;
67 }
68
69 return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst,
70 idlest_reg_id);
71}
72
73/**
74 * cm_wait_module_ready - wait for a module to leave idle or standby
75 * @prcm_mod: PRCM module offset
76 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
77 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
78 *
79 * Wait for the PRCM to indicate that the module identified by
80 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
81 * success, -EBUSY if the module doesn't enable in time, or -EINVAL if
82 * no per-SoC wait_module_ready() function pointer has been registered
83 * or if the idlest register is unknown on the SoC.
84 */
85int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
86{
87 if (!cm_ll_data->wait_module_ready) {
88 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
89 __func__);
90 return -EINVAL;
91 }
92
93 return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift);
94}
95
96/**
97 * cm_register - register per-SoC low-level data with the CM
98 * @cld: low-level per-SoC OMAP CM data & function pointers to register
99 *
100 * Register per-SoC low-level OMAP CM data and function pointers with
101 * the OMAP CM common interface. The caller must keep the data
102 * pointed to by @cld valid until it calls cm_unregister() and
103 * it returns successfully. Returns 0 upon success, -EINVAL if @cld
104 * is NULL, or -EEXIST if cm_register() has already been called
105 * without an intervening cm_unregister().
106 */
107int cm_register(struct cm_ll_data *cld)
108{
109 if (!cld)
110 return -EINVAL;
111
112 if (cm_ll_data != &null_cm_ll_data)
113 return -EEXIST;
114
115 cm_ll_data = cld;
116
117 return 0;
118}
119
120/**
121 * cm_unregister - unregister per-SoC low-level data & function pointers
122 * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
123 *
124 * Unregister per-SoC low-level OMAP CM data and function pointers
125 * that were previously registered with cm_register(). The
126 * caller may not destroy any of the data pointed to by @cld until
127 * this function returns successfully. Returns 0 upon success, or
128 * -EINVAL if @cld is NULL or if @cld does not match the struct
129 * cm_ll_data * previously registered by cm_register().
130 */
131int cm_unregister(struct cm_ll_data *cld)
132{
133 if (!cld || cm_ll_data != cld)
134 return -EINVAL;
135
136 cm_ll_data = &null_cm_ll_data;
137
138 return 0;
139}
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 1894015ff04b..7f9a464f01e9 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -2,8 +2,9 @@
2 * OMAP4 CM instance functions 2 * OMAP4 CM instance functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2008-2011 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +23,7 @@
22 23
23#include "iomap.h" 24#include "iomap.h"
24#include "common.h" 25#include "common.h"
26#include "clockdomain.h"
25#include "cm.h" 27#include "cm.h"
26#include "cm1_44xx.h" 28#include "cm1_44xx.h"
27#include "cm2_44xx.h" 29#include "cm2_44xx.h"
@@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
343 v &= ~OMAP4430_MODULEMODE_MASK; 345 v &= ~OMAP4430_MODULEMODE_MASK;
344 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs); 346 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
345} 347}
348
349/*
350 * Clockdomain low-level functions
351 */
352
353static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
354 struct clockdomain *clkdm2)
355{
356 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
357 clkdm1->prcm_partition,
358 clkdm1->cm_inst, clkdm1->clkdm_offs +
359 OMAP4_CM_STATICDEP);
360 return 0;
361}
362
363static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
364 struct clockdomain *clkdm2)
365{
366 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
367 clkdm1->prcm_partition,
368 clkdm1->cm_inst, clkdm1->clkdm_offs +
369 OMAP4_CM_STATICDEP);
370 return 0;
371}
372
373static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
374 struct clockdomain *clkdm2)
375{
376 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
377 clkdm1->cm_inst,
378 clkdm1->clkdm_offs +
379 OMAP4_CM_STATICDEP,
380 (1 << clkdm2->dep_bit));
381}
382
383static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
384{
385 struct clkdm_dep *cd;
386 u32 mask = 0;
387
388 if (!clkdm->prcm_partition)
389 return 0;
390
391 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
392 if (!cd->clkdm)
393 continue; /* only happens if data is erroneous */
394
395 mask |= 1 << cd->clkdm->dep_bit;
396 atomic_set(&cd->wkdep_usecount, 0);
397 }
398
399 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
400 clkdm->cm_inst, clkdm->clkdm_offs +
401 OMAP4_CM_STATICDEP);
402 return 0;
403}
404
405static int omap4_clkdm_sleep(struct clockdomain *clkdm)
406{
407 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
408 clkdm->cm_inst, clkdm->clkdm_offs);
409 return 0;
410}
411
412static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
413{
414 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
415 clkdm->cm_inst, clkdm->clkdm_offs);
416 return 0;
417}
418
419static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
420{
421 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
422 clkdm->cm_inst, clkdm->clkdm_offs);
423}
424
425static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
426{
427 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
428 omap4_clkdm_wakeup(clkdm);
429 else
430 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
431 clkdm->cm_inst,
432 clkdm->clkdm_offs);
433}
434
435static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
436{
437 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
438 return omap4_clkdm_wakeup(clkdm);
439
440 return 0;
441}
442
443static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
444{
445 bool hwsup = false;
446
447 if (!clkdm->prcm_partition)
448 return 0;
449
450 /*
451 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
452 * more details on the unpleasant problem this is working
453 * around
454 */
455 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
456 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
457 omap4_clkdm_allow_idle(clkdm);
458 return 0;
459 }
460
461 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
462 clkdm->cm_inst, clkdm->clkdm_offs);
463
464 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
465 omap4_clkdm_sleep(clkdm);
466
467 return 0;
468}
469
470struct clkdm_ops omap4_clkdm_operations = {
471 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
472 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
473 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
474 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
475 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
476 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
477 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
478 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
479 .clkdm_sleep = omap4_clkdm_sleep,
480 .clkdm_wakeup = omap4_clkdm_wakeup,
481 .clkdm_allow_idle = omap4_clkdm_allow_idle,
482 .clkdm_deny_idle = omap4_clkdm_deny_idle,
483 .clkdm_clk_enable = omap4_clkdm_clk_enable,
484 .clkdm_clk_disable = omap4_clkdm_clk_disable,
485};
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index d69fdefef985..bd7bab889745 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -38,4 +38,6 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, 38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 u32 mask); 39 u32 mask);
40 40
41extern void omap_cm_base_init(void);
42
41#endif 43#endif
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..5c2fd4863b2b 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -14,189 +14,26 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk.h> 17#include <linux/platform_data/dsp-omap.h>
18#include <linux/io.h>
19 18
20#include <plat/clock.h> 19#include <plat/vram.h>
21 20
22#include "soc.h"
23#include "iomap.h"
24#include "common.h" 21#include "common.h"
25#include "sdrc.h" 22#include "omap-secure.h"
26#include "control.h"
27
28/* Global address base setup code */
29
30static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
31{
32 omap2_set_globals_tap(omap2_globals);
33 omap2_set_globals_sdrc(omap2_globals);
34 omap2_set_globals_control(omap2_globals);
35 omap2_set_globals_prcm(omap2_globals);
36}
37
38#if defined(CONFIG_SOC_OMAP2420)
39
40static struct omap_globals omap242x_globals = {
41 .class = OMAP242X_CLASS,
42 .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
43 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
44 .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
45 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
46 .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
47 .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
48};
49
50void __init omap2_set_globals_242x(void)
51{
52 __omap2_set_globals(&omap242x_globals);
53}
54
55void __init omap242x_map_io(void)
56{
57 omap242x_map_common_io();
58}
59#endif
60
61#if defined(CONFIG_SOC_OMAP2430)
62
63static struct omap_globals omap243x_globals = {
64 .class = OMAP243X_CLASS,
65 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
66 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
67 .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
68 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
69 .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
70 .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
71};
72
73void __init omap2_set_globals_243x(void)
74{
75 __omap2_set_globals(&omap243x_globals);
76}
77
78void __init omap243x_map_io(void)
79{
80 omap243x_map_common_io();
81}
82#endif
83
84#if defined(CONFIG_ARCH_OMAP3)
85
86static struct omap_globals omap3_globals = {
87 .class = OMAP343X_CLASS,
88 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
89 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
90 .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
91 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
92 .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
93 .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
94};
95
96void __init omap2_set_globals_3xxx(void)
97{
98 __omap2_set_globals(&omap3_globals);
99}
100
101void __init omap3_map_io(void)
102{
103 omap34xx_map_common_io();
104}
105 23
106/* 24/*
107 * Adjust TAP register base such that omap3_check_revision accesses the correct 25 * Stub function for OMAP2 so that common files
108 * TI81XX register for checking device ID (it adds 0x204 to tap base while 26 * continue to build when custom builds are used
109 * TI81XX DEVICE ID register is at offset 0x600 from control base).
110 */ 27 */
111#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \ 28int __weak omap_secure_ram_reserve_memblock(void)
112 TI81XX_CONTROL_DEVICE_ID - 0x204)
113
114static struct omap_globals ti81xx_globals = {
115 .class = OMAP343X_CLASS,
116 .tap = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
117 .ctrl = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
118 .prm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
119 .cm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
120};
121
122void __init omap2_set_globals_ti81xx(void)
123{
124 __omap2_set_globals(&ti81xx_globals);
125}
126
127void __init ti81xx_map_io(void)
128{
129 omapti81xx_map_common_io();
130}
131#endif
132
133#if defined(CONFIG_SOC_AM33XX)
134#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
135 TI81XX_CONTROL_DEVICE_ID - 0x204)
136
137static struct omap_globals am33xx_globals = {
138 .class = AM335X_CLASS,
139 .tap = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
140 .ctrl = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
141 .prm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
142 .cm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
143};
144
145void __init omap2_set_globals_am33xx(void)
146{
147 __omap2_set_globals(&am33xx_globals);
148}
149
150void __init am33xx_map_io(void)
151{
152 omapam33xx_map_common_io();
153}
154#endif
155
156#if defined(CONFIG_ARCH_OMAP4)
157static struct omap_globals omap4_globals = {
158 .class = OMAP443X_CLASS,
159 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
160 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
161 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
162 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
163 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
164 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
165 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
166};
167
168void __init omap2_set_globals_443x(void)
169{
170 __omap2_set_globals(&omap4_globals);
171}
172
173void __init omap4_map_io(void)
174{
175 omap44xx_map_common_io();
176}
177#endif
178
179#if defined(CONFIG_SOC_OMAP5)
180static struct omap_globals omap5_globals = {
181 .class = OMAP54XX_CLASS,
182 .tap = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
183 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
184 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
185 .prm = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
186 .cm = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
187 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
188 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
189};
190
191void __init omap2_set_globals_5xxx(void)
192{ 29{
193 omap2_set_globals_tap(&omap5_globals); 30 return 0;
194 omap2_set_globals_control(&omap5_globals);
195 omap2_set_globals_prcm(&omap5_globals);
196} 31}
197 32
198void __init omap5_map_io(void) 33void __init omap_reserve(void)
199{ 34{
200 omap5_map_common_io(); 35 omap_vram_reserve_sdram_memblock();
36 omap_dsp_reserve_sdram_memblock();
37 omap_secure_ram_reserve_memblock();
38 omap_barrier_reserve_memblock();
201} 39}
202#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7045e4d61ac3..c57eeeac7d11 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -28,63 +28,20 @@
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> 37#include "../plat-omap/common.h"
36#include <plat/serial.h>
37#include <plat/common.h>
38 38
39#define OMAP_INTC_START NR_IRQS 39#include "i2c.h"
40#include "serial.h"
40 41
41#ifdef CONFIG_SOC_OMAP2420 42#include "usb.h"
42extern void omap242x_map_common_io(void);
43#else
44static inline void omap242x_map_common_io(void)
45{
46}
47#endif
48
49#ifdef CONFIG_SOC_OMAP2430
50extern void omap243x_map_common_io(void);
51#else
52static inline void omap243x_map_common_io(void)
53{
54}
55#endif
56 43
57#ifdef CONFIG_ARCH_OMAP3 44#define OMAP_INTC_START NR_IRQS
58extern void omap34xx_map_common_io(void);
59#else
60static inline void omap34xx_map_common_io(void)
61{
62}
63#endif
64
65#ifdef CONFIG_SOC_TI81XX
66extern void omapti81xx_map_common_io(void);
67#else
68static inline void omapti81xx_map_common_io(void)
69{
70}
71#endif
72
73#ifdef CONFIG_SOC_AM33XX
74extern void omapam33xx_map_common_io(void);
75#else
76static inline void omapam33xx_map_common_io(void)
77{
78}
79#endif
80
81#ifdef CONFIG_ARCH_OMAP4
82extern void omap44xx_map_common_io(void);
83#else
84static inline void omap44xx_map_common_io(void)
85{
86}
87#endif
88 45
89#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 46#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
90int omap2_pm_init(void); 47int omap2_pm_init(void);
@@ -122,14 +79,6 @@ static inline int omap_mux_late_init(void)
122} 79}
123#endif 80#endif
124 81
125#ifdef CONFIG_SOC_OMAP5
126extern void omap5_map_common_io(void);
127#else
128static inline void omap5_map_common_io(void)
129{
130}
131#endif
132
133extern void omap2_init_common_infrastructure(void); 82extern void omap2_init_common_infrastructure(void);
134 83
135extern struct sys_timer omap2_timer; 84extern struct sys_timer omap2_timer;
@@ -162,52 +111,43 @@ void am35xx_init_late(void);
162void ti81xx_init_late(void); 111void ti81xx_init_late(void);
163void omap4430_init_late(void); 112void omap4430_init_late(void);
164int omap2_common_pm_late_init(void); 113int omap2_common_pm_late_init(void);
165void omap_prcm_restart(char, const char *);
166 114
167/* 115#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
168 * IO bases for various OMAP processors 116void omap2xxx_restart(char mode, const char *cmd);
169 * Except the tap base, rest all the io bases
170 * listed are physical addresses.
171 */
172struct omap_globals {
173 u32 class; /* OMAP class to detect */
174 void __iomem *tap; /* Control module ID code */
175 void __iomem *sdrc; /* SDRAM Controller */
176 void __iomem *sms; /* SDRAM Memory Scheduler */
177 void __iomem *ctrl; /* System Control Module */
178 void __iomem *ctrl_pad; /* PAD Control Module */
179 void __iomem *prm; /* Power and Reset Management */
180 void __iomem *cm; /* Clock Management */
181 void __iomem *cm2;
182 void __iomem *prcm_mpu;
183};
184
185void omap2_set_globals_242x(void);
186void omap2_set_globals_243x(void);
187void omap2_set_globals_3xxx(void);
188void omap2_set_globals_443x(void);
189void omap2_set_globals_5xxx(void);
190void omap2_set_globals_ti81xx(void);
191void omap2_set_globals_am33xx(void);
192
193/* These get called from omap2_set_globals_xxxx(), do not call these */
194void omap2_set_globals_tap(struct omap_globals *);
195#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
196void omap2_set_globals_sdrc(struct omap_globals *);
197#else 117#else
198static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 118static inline void omap2xxx_restart(char mode, const char *cmd)
199{ } 119{
120}
200#endif 121#endif
201void omap2_set_globals_control(struct omap_globals *); 122
202void omap2_set_globals_prcm(struct omap_globals *); 123#ifdef CONFIG_ARCH_OMAP3
203 124void omap3xxx_restart(char mode, const char *cmd);
204void omap242x_map_io(void); 125#else
205void omap243x_map_io(void); 126static inline void omap3xxx_restart(char mode, const char *cmd)
206void omap3_map_io(void); 127{
207void am33xx_map_io(void); 128}
208void omap4_map_io(void); 129#endif
209void omap5_map_io(void); 130
210void ti81xx_map_io(void); 131#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
132void omap44xx_restart(char mode, const char *cmd);
133#else
134static inline void omap44xx_restart(char mode, const char *cmd)
135{
136}
137#endif
138
139/* This gets called from mach-omap2/io.c, do not call this */
140void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
141
142void __init omap242x_map_io(void);
143void __init omap243x_map_io(void);
144void __init omap3_map_io(void);
145void __init am33xx_map_io(void);
146void __init omap4_map_io(void);
147void __init omap5_map_io(void);
148void __init ti81xx_map_io(void);
149
150/* omap_barriers_init() is OMAP4 only */
211void omap_barriers_init(void); 151void omap_barriers_init(void);
212 152
213/** 153/**
@@ -338,6 +278,7 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
338 struct omap_sdrc_params *sdrc_cs1); 278 struct omap_sdrc_params *sdrc_cs1);
339struct omap2_hsmmc_info; 279struct omap2_hsmmc_info;
340extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers); 280extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
281extern void omap_reserve(void);
341 282
342#endif /* __ASSEMBLER__ */ 283#endif /* __ASSEMBLER__ */
343#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 284#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..2adb2683f074 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,15 +15,13 @@
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"
23#include "cm-regbits-34xx.h" 21#include "cm-regbits-34xx.h"
24#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
25#include "prm2xxx_3xxx.h" 23#include "prm3xxx.h"
26#include "cm2xxx_3xxx.h" 24#include "cm3xxx.h"
27#include "sdrc.h" 25#include "sdrc.h"
28#include "pm.h" 26#include "pm.h"
29#include "control.h" 27#include "control.h"
@@ -149,13 +147,11 @@ static struct omap3_control_regs control_context;
149#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) 147#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
150#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg)) 148#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
151 149
152void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 150void __init omap2_set_globals_control(void __iomem *ctrl,
151 void __iomem *ctrl_pad)
153{ 152{
154 if (omap2_globals->ctrl) 153 omap2_ctrl_base = ctrl;
155 omap2_ctrl_base = omap2_globals->ctrl; 154 omap4_ctrl_pad_base = ctrl_pad;
156
157 if (omap2_globals->ctrl_pad)
158 omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
159} 155}
160 156
161void __iomem *omap_ctrl_base_get(void) 157void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index d236257626bf..3d944d3263d2 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -415,6 +415,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
415extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 415extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
416extern void omap3630_ctrl_disable_rta(void); 416extern void omap3630_ctrl_disable_rta(void);
417extern int omap3_ctrl_save_padconf(void); 417extern int omap3_ctrl_save_padconf(void);
418extern void omap2_set_globals_control(void __iomem *ctrl,
419 void __iomem *ctrl_pad);
418#else 420#else
419#define omap_ctrl_base_get() 0 421#define omap_ctrl_base_get() 0
420#define omap_ctrl_readb(x) 0 422#define omap_ctrl_readb(x) 0
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index bc2756959be5..bca7a8885703 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -27,7 +27,6 @@
27#include <linux/export.h> 27#include <linux/export.h>
28#include <linux/cpu_pm.h> 28#include <linux/cpu_pm.h>
29 29
30#include <plat/prcm.h>
31#include "powerdomain.h" 30#include "powerdomain.h"
32#include "clockdomain.h" 31#include "clockdomain.h"
33 32
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c72b5a727720..d2215e9873a5 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -24,10 +24,11 @@
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <plat-omap/dma-omap.h>
28
27#include "iomap.h" 29#include "iomap.h"
28#include <plat/dma.h> 30#include "omap_hwmod.h"
29#include <plat/omap_hwmod.h> 31#include "omap_device.h"
30#include <plat/omap_device.h>
31#include "omap4-keypad.h" 32#include "omap4-keypad.h"
32 33
33#include "soc.h" 34#include "soc.h"
@@ -35,6 +36,7 @@
35#include "mux.h" 36#include "mux.h"
36#include "control.h" 37#include "control.h"
37#include "devices.h" 38#include "devices.h"
39#include "dma.h"
38 40
39#define L3_MODULES_MAX_LEN 12 41#define L3_MODULES_MAX_LEN 12
40#define L3_MODULES 3 42#define L3_MODULES 3
@@ -723,29 +725,3 @@ static int __init omap2_init_devices(void)
723 return 0; 725 return 0;
724} 726}
725arch_initcall(omap2_init_devices); 727arch_initcall(omap2_init_devices);
726
727#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
728static int __init omap_init_wdt(void)
729{
730 int id = -1;
731 struct platform_device *pdev;
732 struct omap_hwmod *oh;
733 char *oh_name = "wd_timer2";
734 char *dev_name = "omap_wdt";
735
736 if (!cpu_class_is_omap2() || of_have_populated_dt())
737 return 0;
738
739 oh = omap_hwmod_lookup(oh_name);
740 if (!oh) {
741 pr_err("Could not look up wd_timer%d hwmod\n", id);
742 return -EINVAL;
743 }
744
745 pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
746 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
747 dev_name, oh->name);
748 return 0;
749}
750subsys_initcall(omap_init_wdt);
751#endif
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 1011995f150a..38ba58c97628 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -25,15 +25,17 @@
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"
36#include "display.h" 37#include "display.h"
38#include "prm.h"
37 39
38#define DISPC_CONTROL 0x0040 40#define DISPC_CONTROL 0x0040
39#define DISPC_CONTROL2 0x0238 41#define DISPC_CONTROL2 0x0238
@@ -284,6 +286,35 @@ err:
284 return ERR_PTR(r); 286 return ERR_PTR(r);
285} 287}
286 288
289static enum omapdss_version __init omap_display_get_version(void)
290{
291 if (cpu_is_omap24xx())
292 return OMAPDSS_VER_OMAP24xx;
293 else if (cpu_is_omap3630())
294 return OMAPDSS_VER_OMAP3630;
295 else if (cpu_is_omap34xx()) {
296 if (soc_is_am35xx()) {
297 return OMAPDSS_VER_AM35xx;
298 } else {
299 if (omap_rev() < OMAP3430_REV_ES3_0)
300 return OMAPDSS_VER_OMAP34xx_ES1;
301 else
302 return OMAPDSS_VER_OMAP34xx_ES3;
303 }
304 } else if (omap_rev() == OMAP4430_REV_ES1_0)
305 return OMAPDSS_VER_OMAP4430_ES1;
306 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
307 omap_rev() == OMAP4430_REV_ES2_1 ||
308 omap_rev() == OMAP4430_REV_ES2_2)
309 return OMAPDSS_VER_OMAP4430_ES2;
310 else if (cpu_is_omap44xx())
311 return OMAPDSS_VER_OMAP4;
312 else if (soc_is_omap54xx())
313 return OMAPDSS_VER_OMAP5;
314 else
315 return OMAPDSS_VER_UNKNOWN;
316}
317
287int __init omap_display_init(struct omap_dss_board_info *board_data) 318int __init omap_display_init(struct omap_dss_board_info *board_data)
288{ 319{
289 int r = 0; 320 int r = 0;
@@ -291,9 +322,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
291 int i, oh_count; 322 int i, oh_count;
292 const struct omap_dss_hwmod_data *curr_dss_hwmod; 323 const struct omap_dss_hwmod_data *curr_dss_hwmod;
293 struct platform_device *dss_pdev; 324 struct platform_device *dss_pdev;
325 enum omapdss_version ver;
294 326
295 /* create omapdss device */ 327 /* create omapdss device */
296 328
329 ver = omap_display_get_version();
330
331 if (ver == OMAPDSS_VER_UNKNOWN) {
332 pr_err("DSS not supported on this SoC\n");
333 return -ENODEV;
334 }
335
336 board_data->version = ver;
297 board_data->dsi_enable_pads = omap_dsi_enable_pads; 337 board_data->dsi_enable_pads = omap_dsi_enable_pads;
298 board_data->dsi_disable_pads = omap_dsi_disable_pads; 338 board_data->dsi_disable_pads = omap_dsi_disable_pads;
299 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; 339 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
@@ -473,7 +513,6 @@ static void dispc_disable_outputs(void)
473 } 513 }
474} 514}
475 515
476#define MAX_MODULE_SOFTRESET_WAIT 10000
477int omap_dss_reset(struct omap_hwmod *oh) 516int omap_dss_reset(struct omap_hwmod *oh)
478{ 517{
479 struct omap_hwmod_opt_clk *oc; 518 struct omap_hwmod_opt_clk *oc;
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..fafb28c0dcbc 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -28,9 +28,8 @@
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"
32#include "clockdomain.h"
34#include "clock.h" 33#include "clock.h"
35#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
36#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
@@ -44,7 +43,7 @@
44/* Private functions */ 43/* Private functions */
45 44
46/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ 45/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
47static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) 46static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
48{ 47{
49 const struct dpll_data *dd; 48 const struct dpll_data *dd;
50 u32 v; 49 u32 v;
@@ -58,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
58} 57}
59 58
60/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ 59/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
61static int _omap3_wait_dpll_status(struct clk *clk, u8 state) 60static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
62{ 61{
63 const struct dpll_data *dd; 62 const struct dpll_data *dd;
64 int i = 0; 63 int i = 0;
@@ -66,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
66 const char *clk_name; 65 const char *clk_name;
67 66
68 dd = clk->dpll_data; 67 dd = clk->dpll_data;
69 clk_name = __clk_get_name(clk); 68 clk_name = __clk_get_name(clk->hw.clk);
70 69
71 state <<= __ffs(dd->idlest_mask); 70 state <<= __ffs(dd->idlest_mask);
72 71
@@ -90,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
90} 89}
91 90
92/* From 3430 TRM ES2 4.7.6.2 */ 91/* From 3430 TRM ES2 4.7.6.2 */
93static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) 92static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n)
94{ 93{
95 unsigned long fint; 94 unsigned long fint;
96 u16 f = 0; 95 u16 f = 0;
@@ -135,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
135 * locked successfully, return 0; if the DPLL did not lock in the time 134 * locked successfully, return 0; if the DPLL did not lock in the time
136 * allotted, or DPLL3 was passed in, return -EINVAL. 135 * allotted, or DPLL3 was passed in, return -EINVAL.
137 */ 136 */
138static int _omap3_noncore_dpll_lock(struct clk *clk) 137static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
139{ 138{
140 const struct dpll_data *dd; 139 const struct dpll_data *dd;
141 u8 ai; 140 u8 ai;
142 u8 state = 1; 141 u8 state = 1;
143 int r = 0; 142 int r = 0;
144 143
145 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); 144 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk));
146 145
147 dd = clk->dpll_data; 146 dd = clk->dpll_data;
148 state <<= __ffs(dd->idlest_mask); 147 state <<= __ffs(dd->idlest_mask);
@@ -180,7 +179,7 @@ done:
180 * DPLL3 was passed in, or the DPLL does not support low-power bypass, 179 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
181 * return -EINVAL. 180 * return -EINVAL.
182 */ 181 */
183static int _omap3_noncore_dpll_bypass(struct clk *clk) 182static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk)
184{ 183{
185 int r; 184 int r;
186 u8 ai; 185 u8 ai;
@@ -189,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
189 return -EINVAL; 188 return -EINVAL;
190 189
191 pr_debug("clock: configuring DPLL %s for low-power bypass\n", 190 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
192 __clk_get_name(clk)); 191 __clk_get_name(clk->hw.clk));
193 192
194 ai = omap3_dpll_autoidle_read(clk); 193 ai = omap3_dpll_autoidle_read(clk);
195 194
@@ -212,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
212 * code. If DPLL3 was passed in, or the DPLL does not support 211 * code. If DPLL3 was passed in, or the DPLL does not support
213 * low-power stop, return -EINVAL; otherwise, return 0. 212 * low-power stop, return -EINVAL; otherwise, return 0.
214 */ 213 */
215static int _omap3_noncore_dpll_stop(struct clk *clk) 214static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk)
216{ 215{
217 u8 ai; 216 u8 ai;
218 217
219 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 218 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
220 return -EINVAL; 219 return -EINVAL;
221 220
222 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); 221 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk));
223 222
224 ai = omap3_dpll_autoidle_read(clk); 223 ai = omap3_dpll_autoidle_read(clk);
225 224
@@ -243,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
243 * XXX This code is not needed for 3430/AM35xx; can it be optimized 242 * XXX This code is not needed for 3430/AM35xx; can it be optimized
244 * out in non-multi-OMAP builds for those chips? 243 * out in non-multi-OMAP builds for those chips?
245 */ 244 */
246static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) 245static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n)
247{ 246{
248 unsigned long fint, clkinp; /* watch out for overflow */ 247 unsigned long fint, clkinp; /* watch out for overflow */
249 248
250 clkinp = __clk_get_rate(__clk_get_parent(clk)); 249 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
251 fint = (clkinp / n) * m; 250 fint = (clkinp / n) * m;
252 251
253 if (fint < 1000000000) 252 if (fint < 1000000000)
@@ -268,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n)
268 * XXX This code is not needed for 3430/AM35xx; can it be optimized 267 * XXX This code is not needed for 3430/AM35xx; can it be optimized
269 * out in non-multi-OMAP builds for those chips? 268 * out in non-multi-OMAP builds for those chips?
270 */ 269 */
271static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) 270static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n)
272{ 271{
273 unsigned long clkinp, sd; /* watch out for overflow */ 272 unsigned long clkinp, sd; /* watch out for overflow */
274 int mod1, mod2; 273 int mod1, mod2;
275 274
276 clkinp = __clk_get_rate(__clk_get_parent(clk)); 275 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
277 276
278 /* 277 /*
279 * target sigma-delta to near 250MHz 278 * target sigma-delta to near 250MHz
@@ -300,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n)
300 * Program the DPLL with the supplied M, N values, and wait for the DPLL to 299 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
301 * lock.. Returns -EINVAL upon error, or 0 upon success. 300 * lock.. Returns -EINVAL upon error, or 0 upon success.
302 */ 301 */
303static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) 302static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n,
303 u16 freqsel)
304{ 304{
305 struct dpll_data *dd = clk->dpll_data; 305 struct dpll_data *dd = clk->dpll_data;
306 u8 dco, sd_div; 306 u8 dco, sd_div;
@@ -357,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
357 * 357 *
358 * Recalculate and propagate the DPLL rate. 358 * Recalculate and propagate the DPLL rate.
359 */ 359 */
360unsigned long omap3_dpll_recalc(struct clk *clk) 360unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate)
361{ 361{
362 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
363
362 return omap2_get_dpll_rate(clk); 364 return omap2_get_dpll_rate(clk);
363} 365}
364 366
@@ -378,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk)
378 * support low-power stop, or if the DPLL took too long to enter 380 * support low-power stop, or if the DPLL took too long to enter
379 * bypass or lock, return -EINVAL; otherwise, return 0. 381 * bypass or lock, return -EINVAL; otherwise, return 0.
380 */ 382 */
381int omap3_noncore_dpll_enable(struct clk *clk) 383int omap3_noncore_dpll_enable(struct clk_hw *hw)
382{ 384{
385 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
383 int r; 386 int r;
384 struct dpll_data *dd; 387 struct dpll_data *dd;
385 struct clk *parent; 388 struct clk *parent;
@@ -388,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk)
388 if (!dd) 391 if (!dd)
389 return -EINVAL; 392 return -EINVAL;
390 393
391 parent = __clk_get_parent(clk); 394 if (clk->clkdm) {
395 r = clkdm_clk_enable(clk->clkdm, hw->clk);
396 if (r) {
397 WARN(1,
398 "%s: could not enable %s's clockdomain %s: %d\n",
399 __func__, __clk_get_name(hw->clk),
400 clk->clkdm->name, r);
401 return r;
402 }
403 }
392 404
393 if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { 405 parent = __clk_get_parent(hw->clk);
406
407 if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) {
394 WARN_ON(parent != dd->clk_bypass); 408 WARN_ON(parent != dd->clk_bypass);
395 r = _omap3_noncore_dpll_bypass(clk); 409 r = _omap3_noncore_dpll_bypass(clk);
396 } else { 410 } else {
397 WARN_ON(parent != dd->clk_ref); 411 WARN_ON(parent != dd->clk_ref);
398 r = _omap3_noncore_dpll_lock(clk); 412 r = _omap3_noncore_dpll_lock(clk);
399 } 413 }
400 /*
401 *FIXME: this is dubious - if clk->rate has changed, what about
402 * propagating?
403 */
404 if (!r)
405 clk->rate = (clk->recalc) ? clk->recalc(clk) :
406 omap2_get_dpll_rate(clk);
407 414
408 return r; 415 return r;
409} 416}
@@ -415,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk)
415 * Instructs a non-CORE DPLL to enter low-power stop. This function is 422 * Instructs a non-CORE DPLL to enter low-power stop. This function is
416 * intended for use in struct clkops. No return value. 423 * intended for use in struct clkops. No return value.
417 */ 424 */
418void omap3_noncore_dpll_disable(struct clk *clk) 425void omap3_noncore_dpll_disable(struct clk_hw *hw)
419{ 426{
427 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
428
420 _omap3_noncore_dpll_stop(clk); 429 _omap3_noncore_dpll_stop(clk);
430 if (clk->clkdm)
431 clkdm_clk_disable(clk->clkdm, hw->clk);
421} 432}
422 433
423 434
@@ -434,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk)
434 * target rate if it hasn't been done already, then program and lock 445 * target rate if it hasn't been done already, then program and lock
435 * the DPLL. Returns -EINVAL upon error, or 0 upon success. 446 * the DPLL. Returns -EINVAL upon error, or 0 upon success.
436 */ 447 */
437int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) 448int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
449 unsigned long parent_rate)
438{ 450{
451 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
439 struct clk *new_parent = NULL; 452 struct clk *new_parent = NULL;
440 unsigned long hw_rate, bypass_rate;
441 u16 freqsel = 0; 453 u16 freqsel = 0;
442 struct dpll_data *dd; 454 struct dpll_data *dd;
443 int ret; 455 int ret;
444 456
445 if (!clk || !rate) 457 if (!hw || !rate)
446 return -EINVAL; 458 return -EINVAL;
447 459
448 dd = clk->dpll_data; 460 dd = clk->dpll_data;
449 if (!dd) 461 if (!dd)
450 return -EINVAL; 462 return -EINVAL;
451 463
452 hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); 464 __clk_prepare(dd->clk_bypass);
453 if (rate == hw_rate) 465 clk_enable(dd->clk_bypass);
454 return 0; 466 __clk_prepare(dd->clk_ref);
467 clk_enable(dd->clk_ref);
455 468
456 /* 469 if (__clk_get_rate(dd->clk_bypass) == rate &&
457 * Ensure both the bypass and ref clocks are enabled prior to 470 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
458 * doing anything; we need the bypass clock running to reprogram 471 pr_debug("%s: %s: set rate: entering bypass.\n",
459 * the DPLL. 472 __func__, __clk_get_name(hw->clk));
460 */
461 omap2_clk_enable(dd->clk_bypass);
462 omap2_clk_enable(dd->clk_ref);
463
464 bypass_rate = __clk_get_rate(dd->clk_bypass);
465 if (bypass_rate == rate &&
466 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
467 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
468 473
469 ret = _omap3_noncore_dpll_bypass(clk); 474 ret = _omap3_noncore_dpll_bypass(clk);
470 if (!ret) 475 if (!ret)
471 new_parent = dd->clk_bypass; 476 new_parent = dd->clk_bypass;
472 } else { 477 } else {
473 if (dd->last_rounded_rate != rate) 478 if (dd->last_rounded_rate != rate)
474 rate = clk->round_rate(clk, rate); 479 rate = __clk_round_rate(hw->clk, rate);
475 480
476 if (dd->last_rounded_rate == 0) 481 if (dd->last_rounded_rate == 0)
477 return -EINVAL; 482 return -EINVAL;
478 483
479 /* No freqsel on OMAP4 and OMAP3630 */ 484 /* No freqsel on OMAP4 and OMAP3630 */
480 if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { 485 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
481 freqsel = _omap3_dpll_compute_freqsel(clk, 486 freqsel = _omap3_dpll_compute_freqsel(clk,
482 dd->last_rounded_n); 487 dd->last_rounded_n);
483 if (!freqsel) 488 if (!freqsel)
484 WARN_ON(1); 489 WARN_ON(1);
485 } 490 }
486 491
487 pr_debug("clock: %s: set rate: locking rate to %lu.\n", 492 pr_debug("%s: %s: set rate: locking rate to %lu.\n",
488 __clk_get_name(clk), rate); 493 __func__, __clk_get_name(hw->clk), rate);
489 494
490 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, 495 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
491 dd->last_rounded_n, freqsel); 496 dd->last_rounded_n, freqsel);
492 if (!ret) 497 if (!ret)
493 new_parent = dd->clk_ref; 498 new_parent = dd->clk_ref;
494 } 499 }
495 if (!ret) { 500 /*
496 /* 501 * FIXME - this is all wrong. common code handles reparenting and
497 * Switch the parent clock in the hierarchy, and make sure 502 * migrating prepare/enable counts. dplls should be a multiplexer
498 * that the new parent's usecount is correct. Note: we 503 * clock and this should be a set_parent operation so that all of that
499 * enable the new parent before disabling the old to avoid 504 * stuff is inherited for free
500 * any unnecessary hardware disable->enable transitions. 505 */
501 */ 506
502 if (clk->usecount) { 507 if (!ret)
503 omap2_clk_enable(new_parent); 508 __clk_reparent(hw->clk, new_parent);
504 omap2_clk_disable(clk->parent); 509
505 } 510 clk_disable(dd->clk_ref);
506 clk_reparent(clk, new_parent); 511 __clk_unprepare(dd->clk_ref);
507 clk->rate = rate; 512 clk_disable(dd->clk_bypass);
508 } 513 __clk_unprepare(dd->clk_bypass);
509 omap2_clk_disable(dd->clk_ref);
510 omap2_clk_disable(dd->clk_bypass);
511 514
512 return 0; 515 return 0;
513} 516}
@@ -522,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
522 * -EINVAL if passed a null pointer or if the struct clk does not 525 * -EINVAL if passed a null pointer or if the struct clk does not
523 * appear to refer to a DPLL. 526 * appear to refer to a DPLL.
524 */ 527 */
525u32 omap3_dpll_autoidle_read(struct clk *clk) 528u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
526{ 529{
527 const struct dpll_data *dd; 530 const struct dpll_data *dd;
528 u32 v; 531 u32 v;
@@ -551,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk)
551 * OMAP3430. The DPLL will enter low-power stop when its downstream 554 * OMAP3430. The DPLL will enter low-power stop when its downstream
552 * clocks are gated. No return value. 555 * clocks are gated. No return value.
553 */ 556 */
554void omap3_dpll_allow_idle(struct clk *clk) 557void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
555{ 558{
556 const struct dpll_data *dd; 559 const struct dpll_data *dd;
557 u32 v; 560 u32 v;
@@ -561,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk)
561 564
562 dd = clk->dpll_data; 565 dd = clk->dpll_data;
563 566
564 if (!dd->autoidle_reg) { 567 if (!dd->autoidle_reg)
565 pr_debug("clock: DPLL %s: autoidle not supported\n",
566 __clk_get_name(clk));
567 return; 568 return;
568 }
569 569
570 /* 570 /*
571 * REVISIT: CORE DPLL can optionally enter low-power bypass 571 * REVISIT: CORE DPLL can optionally enter low-power bypass
@@ -585,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
585 * 585 *
586 * Disable DPLL automatic idle control. No return value. 586 * Disable DPLL automatic idle control. No return value.
587 */ 587 */
588void omap3_dpll_deny_idle(struct clk *clk) 588void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
589{ 589{
590 const struct dpll_data *dd; 590 const struct dpll_data *dd;
591 u32 v; 591 u32 v;
@@ -595,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk)
595 595
596 dd = clk->dpll_data; 596 dd = clk->dpll_data;
597 597
598 if (!dd->autoidle_reg) { 598 if (!dd->autoidle_reg)
599 pr_debug("clock: DPLL %s: autoidle not supported\n",
600 __clk_get_name(clk));
601 return; 599 return;
602 }
603 600
604 v = __raw_readl(dd->autoidle_reg); 601 v = __raw_readl(dd->autoidle_reg);
605 v &= ~dd->autoidle_mask; 602 v &= ~dd->autoidle_mask;
@@ -617,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk)
617 * Using parent clock DPLL data, look up DPLL state. If locked, set our 614 * Using parent clock DPLL data, look up DPLL state. If locked, set our
618 * rate to the dpll_clk * 2; otherwise, just use dpll_clk. 615 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
619 */ 616 */
620unsigned long omap3_clkoutx2_recalc(struct clk *clk) 617unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
618 unsigned long parent_rate)
621{ 619{
622 const struct dpll_data *dd; 620 const struct dpll_data *dd;
623 unsigned long rate; 621 unsigned long rate;
624 u32 v; 622 u32 v;
625 struct clk *pclk; 623 struct clk_hw_omap *pclk = NULL;
626 unsigned long parent_rate; 624 struct clk *parent;
627 625
628 /* Walk up the parents of clk, looking for a DPLL */ 626 /* Walk up the parents of clk, looking for a DPLL */
629 pclk = __clk_get_parent(clk); 627 do {
630 while (pclk && !pclk->dpll_data) 628 do {
631 pclk = __clk_get_parent(pclk); 629 parent = __clk_get_parent(hw->clk);
630 hw = __clk_get_hw(parent);
631 } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
632 if (!hw)
633 break;
634 pclk = to_clk_hw_omap(hw);
635 } while (pclk && !pclk->dpll_data);
632 636
633 /* clk does not have a DPLL as a parent? error in the clock data */ 637 /* clk does not have a DPLL as a parent? error in the clock data */
634 if (!pclk) { 638 if (!pclk) {
@@ -640,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
640 644
641 WARN_ON(!dd->enable_mask); 645 WARN_ON(!dd->enable_mask);
642 646
643 parent_rate = __clk_get_rate(__clk_get_parent(clk));
644 v = __raw_readl(dd->control_reg) & dd->enable_mask; 647 v = __raw_readl(dd->control_reg) & dd->enable_mask;
645 v >>= __ffs(dd->enable_mask); 648 v >>= __ffs(dd->enable_mask);
646 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) 649 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
@@ -651,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
651} 654}
652 655
653/* OMAP3/4 non-CORE DPLL clkops */ 656/* OMAP3/4 non-CORE DPLL clkops */
654 657const struct clk_hw_omap_ops clkhwops_omap3_dpll = {
655const struct clkops clkops_omap3_noncore_dpll_ops = {
656 .enable = omap3_noncore_dpll_enable,
657 .disable = omap3_noncore_dpll_disable,
658 .allow_idle = omap3_dpll_allow_idle,
659 .deny_idle = omap3_dpll_deny_idle,
660};
661
662const struct clkops clkops_omap3_core_dpll_ops = {
663 .allow_idle = omap3_dpll_allow_idle, 658 .allow_idle = omap3_dpll_allow_idle,
664 .deny_idle = omap3_dpll_deny_idle, 659 .deny_idle = omap3_dpll_deny_idle,
665}; 660};
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 09d0ccccb861..d3326c474fdc 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -15,15 +15,13 @@
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"
23#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
24 22
25/* Supported only on OMAP4 */ 23/* Supported only on OMAP4 */
26int omap4_dpllmx_gatectrl_read(struct clk *clk) 24int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
27{ 25{
28 u32 v; 26 u32 v;
29 u32 mask; 27 u32 mask;
@@ -42,7 +40,7 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk)
42 return v; 40 return v;
43} 41}
44 42
45void omap4_dpllmx_allow_gatectrl(struct clk *clk) 43void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
46{ 44{
47 u32 v; 45 u32 v;
48 u32 mask; 46 u32 mask;
@@ -60,7 +58,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk)
60 __raw_writel(v, clk->clksel_reg); 58 __raw_writel(v, clk->clksel_reg);
61} 59}
62 60
63void omap4_dpllmx_deny_gatectrl(struct clk *clk) 61void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
64{ 62{
65 u32 v; 63 u32 v;
66 u32 mask; 64 u32 mask;
@@ -78,9 +76,9 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk)
78 __raw_writel(v, clk->clksel_reg); 76 __raw_writel(v, clk->clksel_reg);
79} 77}
80 78
81const struct clkops clkops_omap4_dpllmx_ops = { 79const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
82 .allow_idle = omap4_dpllmx_allow_gatectrl, 80 .allow_idle = omap4_dpllmx_allow_gatectrl,
83 .deny_idle = omap4_dpllmx_deny_gatectrl, 81 .deny_idle = omap4_dpllmx_deny_gatectrl,
84}; 82};
85 83
86/** 84/**
@@ -92,8 +90,10 @@ const struct clkops clkops_omap4_dpllmx_ops = {
92 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers) 90 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers)
93 * upon success, or 0 upon error. 91 * upon success, or 0 upon error.
94 */ 92 */
95unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) 93unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
94 unsigned long parent_rate)
96{ 95{
96 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
97 u32 v; 97 u32 v;
98 unsigned long rate; 98 unsigned long rate;
99 struct dpll_data *dd; 99 struct dpll_data *dd;
@@ -125,8 +125,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
125 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or 125 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or
126 * ~0 if an error occurred in omap2_dpll_round_rate(). 126 * ~0 if an error occurred in omap2_dpll_round_rate().
127 */ 127 */
128long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) 128long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
129 unsigned long target_rate,
130 unsigned long *parent_rate)
129{ 131{
132 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
130 u32 v; 133 u32 v;
131 struct dpll_data *dd; 134 struct dpll_data *dd;
132 long r; 135 long r;
@@ -142,7 +145,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
142 if (v) 145 if (v)
143 target_rate = target_rate / OMAP4430_REGM4XEN_MULT; 146 target_rate = target_rate / OMAP4430_REGM4XEN_MULT;
144 147
145 r = omap2_dpll_round_rate(clk, target_rate); 148 r = omap2_dpll_round_rate(hw, target_rate, NULL);
146 if (r == ~0) 149 if (r == ~0)
147 return r; 150 return r;
148 151
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 92b5718fa722..bf6117c32f4b 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)
@@ -1093,267 +939,3 @@ void omap3_gpmc_restore_context(void)
1093 } 939 }
1094} 940}
1095#endif /* CONFIG_ARCH_OMAP3 */ 941#endif /* CONFIG_ARCH_OMAP3 */
1096
1097/**
1098 * gpmc_enable_hwecc - enable hardware ecc functionality
1099 * @cs: chip select number
1100 * @mode: read/write mode
1101 * @dev_width: device bus width(1 for x16, 0 for x8)
1102 * @ecc_size: bytes for which ECC will be generated
1103 */
1104int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
1105{
1106 unsigned int val;
1107
1108 /* check if ecc module is in used */
1109 if (gpmc_ecc_used != -EINVAL)
1110 return -EINVAL;
1111
1112 gpmc_ecc_used = cs;
1113
1114 /* clear ecc and enable bits */
1115 gpmc_write_reg(GPMC_ECC_CONTROL,
1116 GPMC_ECC_CTRL_ECCCLEAR |
1117 GPMC_ECC_CTRL_ECCREG1);
1118
1119 /* program ecc and result sizes */
1120 val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
1121 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
1122
1123 switch (mode) {
1124 case GPMC_ECC_READ:
1125 case GPMC_ECC_WRITE:
1126 gpmc_write_reg(GPMC_ECC_CONTROL,
1127 GPMC_ECC_CTRL_ECCCLEAR |
1128 GPMC_ECC_CTRL_ECCREG1);
1129 break;
1130 case GPMC_ECC_READSYN:
1131 gpmc_write_reg(GPMC_ECC_CONTROL,
1132 GPMC_ECC_CTRL_ECCCLEAR |
1133 GPMC_ECC_CTRL_ECCDISABLE);
1134 break;
1135 default:
1136 printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
1137 break;
1138 }
1139
1140 /* (ECC 16 or 8 bit col) | ( CS ) | ECC Enable */
1141 val = (dev_width << 7) | (cs << 1) | (0x1);
1142 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1143 return 0;
1144}
1145EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
1146
1147/**
1148 * gpmc_calculate_ecc - generate non-inverted ecc bytes
1149 * @cs: chip select number
1150 * @dat: data pointer over which ecc is computed
1151 * @ecc_code: ecc code buffer
1152 *
1153 * Using non-inverted ECC is considered ugly since writing a blank
1154 * page (padding) will clear the ECC bytes. This is not a problem as long
1155 * no one is trying to write data on the seemingly unused page. Reading
1156 * an erased page will produce an ECC mismatch between generated and read
1157 * ECC bytes that has to be dealt with separately.
1158 */
1159int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
1160{
1161 unsigned int val = 0x0;
1162
1163 if (gpmc_ecc_used != cs)
1164 return -EINVAL;
1165
1166 /* read ecc result */
1167 val = gpmc_read_reg(GPMC_ECC1_RESULT);
1168 *ecc_code++ = val; /* P128e, ..., P1e */
1169 *ecc_code++ = val >> 16; /* P128o, ..., P1o */
1170 /* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
1171 *ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
1172
1173 gpmc_ecc_used = -EINVAL;
1174 return 0;
1175}
1176EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
1177
1178#ifdef CONFIG_ARCH_OMAP3
1179
1180/**
1181 * gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
1182 * @cs: chip select number
1183 * @nsectors: how many 512-byte sectors to process
1184 * @nerrors: how many errors to correct per sector (4 or 8)
1185 *
1186 * This function must be executed before any call to gpmc_enable_hwecc_bch.
1187 */
1188int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
1189{
1190 /* check if ecc module is in use */
1191 if (gpmc_ecc_used != -EINVAL)
1192 return -EINVAL;
1193
1194 /* support only OMAP3 class */
1195 if (!cpu_is_omap34xx()) {
1196 printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
1197 return -EINVAL;
1198 }
1199
1200 /*
1201 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
1202 * Other chips may be added if confirmed to work.
1203 */
1204 if ((nerrors == 4) &&
1205 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
1206 printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
1207 return -EINVAL;
1208 }
1209
1210 /* sanity check */
1211 if (nsectors > 8) {
1212 printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
1213 nsectors);
1214 return -EINVAL;
1215 }
1216
1217 return 0;
1218}
1219EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
1220
1221/**
1222 * gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
1223 * @cs: chip select number
1224 * @mode: read/write mode
1225 * @dev_width: device bus width(1 for x16, 0 for x8)
1226 * @nsectors: how many 512-byte sectors to process
1227 * @nerrors: how many errors to correct per sector (4 or 8)
1228 */
1229int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
1230 int nerrors)
1231{
1232 unsigned int val;
1233
1234 /* check if ecc module is in use */
1235 if (gpmc_ecc_used != -EINVAL)
1236 return -EINVAL;
1237
1238 gpmc_ecc_used = cs;
1239
1240 /* clear ecc and enable bits */
1241 gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
1242
1243 /*
1244 * When using BCH, sector size is hardcoded to 512 bytes.
1245 * Here we are using wrapping mode 6 both for reading and writing, with:
1246 * size0 = 0 (no additional protected byte in spare area)
1247 * size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
1248 */
1249 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
1250
1251 /* BCH configuration */
1252 val = ((1 << 16) | /* enable BCH */
1253 (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
1254 (0x06 << 8) | /* wrap mode = 6 */
1255 (dev_width << 7) | /* bus width */
1256 (((nsectors-1) & 0x7) << 4) | /* number of sectors */
1257 (cs << 1) | /* ECC CS */
1258 (0x1)); /* enable ECC */
1259
1260 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1261 gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
1262 return 0;
1263}
1264EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
1265
1266/**
1267 * gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
1268 * @cs: chip select number
1269 * @dat: The pointer to data on which ecc is computed
1270 * @ecc: The ecc output buffer
1271 */
1272int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
1273{
1274 int i;
1275 unsigned long nsectors, reg, val1, val2;
1276
1277 if (gpmc_ecc_used != cs)
1278 return -EINVAL;
1279
1280 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1281
1282 for (i = 0; i < nsectors; i++) {
1283
1284 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1285
1286 /* Read hw-computed remainder */
1287 val1 = gpmc_read_reg(reg + 0);
1288 val2 = gpmc_read_reg(reg + 4);
1289
1290 /*
1291 * Add constant polynomial to remainder, in order to get an ecc
1292 * sequence of 0xFFs for a buffer filled with 0xFFs; and
1293 * left-justify the resulting polynomial.
1294 */
1295 *ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
1296 *ecc++ = 0x13 ^ ((val2 >> 4) & 0xFF);
1297 *ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
1298 *ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
1299 *ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
1300 *ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
1301 *ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
1302 }
1303
1304 gpmc_ecc_used = -EINVAL;
1305 return 0;
1306}
1307EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
1308
1309/**
1310 * gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
1311 * @cs: chip select number
1312 * @dat: The pointer to data on which ecc is computed
1313 * @ecc: The ecc output buffer
1314 */
1315int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
1316{
1317 int i;
1318 unsigned long nsectors, reg, val1, val2, val3, val4;
1319
1320 if (gpmc_ecc_used != cs)
1321 return -EINVAL;
1322
1323 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1324
1325 for (i = 0; i < nsectors; i++) {
1326
1327 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1328
1329 /* Read hw-computed remainder */
1330 val1 = gpmc_read_reg(reg + 0);
1331 val2 = gpmc_read_reg(reg + 4);
1332 val3 = gpmc_read_reg(reg + 8);
1333 val4 = gpmc_read_reg(reg + 12);
1334
1335 /*
1336 * Add constant polynomial to remainder, in order to get an ecc
1337 * sequence of 0xFFs for a buffer filled with 0xFFs.
1338 */
1339 *ecc++ = 0xef ^ (val4 & 0xFF);
1340 *ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
1341 *ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
1342 *ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
1343 *ecc++ = 0xed ^ (val3 & 0xFF);
1344 *ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
1345 *ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
1346 *ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
1347 *ecc++ = 0x97 ^ (val2 & 0xFF);
1348 *ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
1349 *ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
1350 *ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
1351 *ecc++ = 0xb5 ^ (val1 & 0xFF);
1352 }
1353
1354 gpmc_ecc_used = -EINVAL;
1355 return 0;
1356}
1357EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
1358
1359#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..ab7bf181a105 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -27,15 +27,13 @@
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 "prm.h"
34#include "common.h" 35#include "common.h"
35 36
36/* Maximum microseconds to wait for OMAP module to softreset */
37#define MAX_MODULE_SOFTRESET_WAIT 10000
38
39/** 37/**
40 * omap_hdq1w_reset - reset the OMAP HDQ1W module 38 * omap_hdq1w_reset - reset the OMAP HDQ1W module
41 * @oh: struct omap_hwmod * 39 * @oh: struct omap_hwmod *
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..be092e8e5d85 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -19,21 +19,23 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h> 22#include "soc.h"
23#include "common.h" 23#include "omap_hwmod.h"
24#include <plat/omap_hwmod.h> 24#include "omap_device.h"
25 25
26#include "prm.h"
27#include "common.h"
26#include "mux.h" 28#include "mux.h"
29#include "i2c.h"
27 30
28/* In register I2C_CON, Bit 15 is the I2C enable bit */ 31/* In register I2C_CON, Bit 15 is the I2C enable bit */
29#define I2C_EN BIT(15) 32#define I2C_EN BIT(15)
30#define OMAP2_I2C_CON_OFFSET 0x24 33#define OMAP2_I2C_CON_OFFSET 0x24
31#define OMAP4_I2C_CON_OFFSET 0xA4 34#define OMAP4_I2C_CON_OFFSET 0xA4
32 35
33/* Maximum microseconds to wait for OMAP module to softreset */ 36#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
34#define MAX_MODULE_SOFTRESET_WAIT 10000
35 37
36void __init omap2_i2c_mux_pins(int bus_id) 38static void __init omap2_i2c_mux_pins(int bus_id)
37{ 39{
38 char mux_name[sizeof("i2c2_scl.i2c2_scl")]; 40 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
39 41
@@ -104,3 +106,46 @@ int omap_i2c_reset(struct omap_hwmod *oh)
104 106
105 return 0; 107 return 0;
106} 108}
109
110static const char name[] = "omap_i2c";
111
112int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
113 int bus_id)
114{
115 int l;
116 struct omap_hwmod *oh;
117 struct platform_device *pdev;
118 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
119 struct omap_i2c_bus_platform_data *pdata;
120 struct omap_i2c_dev_attr *dev_attr;
121
122 omap2_i2c_mux_pins(bus_id);
123
124 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
125 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
126 "String buffer overflow in I2C%d device setup\n", bus_id);
127 oh = omap_hwmod_lookup(oh_name);
128 if (!oh) {
129 pr_err("Could not look up %s\n", oh_name);
130 return -EEXIST;
131 }
132
133 pdata = i2c_pdata;
134 /*
135 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
136 * use, and functionality implementation flags, up to the OMAP I2C
137 * driver via platform data
138 */
139 pdata->rev = oh->class->rev;
140
141 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
142 pdata->flags = dev_attr->flags;
143
144 pdev = omap_device_build(name, bus_id, oh, pdata,
145 sizeof(struct omap_i2c_bus_platform_data),
146 NULL, 0, 0);
147 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
148
149 return PTR_RET(pdev);
150}
151
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/id.c b/arch/arm/mach-omap2/id.c
index cf2362ccb234..f1e121502789 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -559,11 +559,12 @@ void __init omap5xxx_check_revision(void)
559 * detect the exact revision later on in omap2_detect_revision() once map_io 559 * detect the exact revision later on in omap2_detect_revision() once map_io
560 * is done. 560 * is done.
561 */ 561 */
562void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 562void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
563{ 563{
564 omap_revision = omap2_globals->class; 564 omap_revision = class;
565 tap_base = omap2_globals->tap; 565 tap_base = tap;
566 566
567 /* XXX What is this intended to do? */
567 if (cpu_is_omap34xx()) 568 if (cpu_is_omap34xx())
568 tap_prod_id = 0x0210; 569 tap_prod_id = 0x0210;
569 else 570 else
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 93d10de7129f..4b5cbdfac028 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
13 13
14#include <linux/serial_reg.h> 14#include <linux/serial_reg.h>
15 15
16#include <plat/serial.h> 16#include <../mach-omap2/serial.h>
17 17
18#define UART_OFFSET(addr) ((addr) & 0x00ffffff) 18#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
19 19
diff --git a/arch/arm/mach-omap2/include/mach/uncompress.h b/arch/arm/mach-omap2/include/mach/uncompress.h
index 78e0557bfd4e..28d1ec0e869a 100644
--- a/arch/arm/mach-omap2/include/mach/uncompress.h
+++ b/arch/arm/mach-omap2/include/mach/uncompress.h
@@ -1,5 +1,176 @@
1/* 1/*
2 * arch/arm/mach-omap2/include/mach/uncompress.h 2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
3 */ 18 */
4 19
5#include <plat/uncompress.h> 20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include <../mach-omap2/serial.h>
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP2(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
80 OMAP2UART##p)
81
82#define DEBUG_LL_OMAP3(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP3UART##p)
85
86#define DEBUG_LL_OMAP4(p, mach) \
87 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP4UART##p)
89
90#define DEBUG_LL_OMAP5(p, mach) \
91 _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP5UART##p)
93/* Zoom2/3 shift is different for UART1 and external port */
94#define DEBUG_LL_ZOOM(mach) \
95 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
96
97#define DEBUG_LL_TI81XX(p, mach) \
98 _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
99 TI81XXUART##p)
100
101#define DEBUG_LL_AM33XX(p, mach) \
102 _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
103 AM33XXUART##p)
104
105static inline void arch_decomp_setup(void)
106{
107 int port = 0;
108
109 /*
110 * Initialize the port based on the machine ID from the bootloader.
111 * Note that we're using macros here instead of switch statement
112 * as machine_is functions are optimized out for the boards that
113 * are not selected.
114 */
115 do {
116 /* omap2 based boards using UART1 */
117 DEBUG_LL_OMAP2(1, omap_2430sdp);
118 DEBUG_LL_OMAP2(1, omap_apollon);
119 DEBUG_LL_OMAP2(1, omap_h4);
120
121 /* omap2 based boards using UART3 */
122 DEBUG_LL_OMAP2(3, nokia_n800);
123 DEBUG_LL_OMAP2(3, nokia_n810);
124 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
125
126 /* omap3 based boards using UART1 */
127 DEBUG_LL_OMAP2(1, omap3evm);
128 DEBUG_LL_OMAP3(1, omap_3430sdp);
129 DEBUG_LL_OMAP3(1, omap_3630sdp);
130 DEBUG_LL_OMAP3(1, omap3530_lv_som);
131 DEBUG_LL_OMAP3(1, omap3_torpedo);
132
133 /* omap3 based boards using UART3 */
134 DEBUG_LL_OMAP3(3, cm_t35);
135 DEBUG_LL_OMAP3(3, cm_t3517);
136 DEBUG_LL_OMAP3(3, cm_t3730);
137 DEBUG_LL_OMAP3(3, craneboard);
138 DEBUG_LL_OMAP3(3, devkit8000);
139 DEBUG_LL_OMAP3(3, igep0020);
140 DEBUG_LL_OMAP3(3, igep0030);
141 DEBUG_LL_OMAP3(3, nokia_rm680);
142 DEBUG_LL_OMAP3(3, nokia_rm696);
143 DEBUG_LL_OMAP3(3, nokia_rx51);
144 DEBUG_LL_OMAP3(3, omap3517evm);
145 DEBUG_LL_OMAP3(3, omap3_beagle);
146 DEBUG_LL_OMAP3(3, omap3_pandora);
147 DEBUG_LL_OMAP3(3, omap_ldp);
148 DEBUG_LL_OMAP3(3, overo);
149 DEBUG_LL_OMAP3(3, touchbook);
150
151 /* omap4 based boards using UART3 */
152 DEBUG_LL_OMAP4(3, omap_4430sdp);
153 DEBUG_LL_OMAP4(3, omap4_panda);
154
155 /* omap5 based boards using UART3 */
156 DEBUG_LL_OMAP5(3, omap5_sevm);
157
158 /* zoom2/3 external uart */
159 DEBUG_LL_ZOOM(omap_zoom2);
160 DEBUG_LL_ZOOM(omap_zoom3);
161
162 /* TI8168 base boards using UART3 */
163 DEBUG_LL_TI81XX(3, ti8168evm);
164
165 /* TI8148 base boards using UART1 */
166 DEBUG_LL_TI81XX(1, ti8148evm);
167
168 /* AM33XX base boards using UART1 */
169 DEBUG_LL_AM33XX(1, am335xevm);
170 } while (0);
171}
172
173/*
174 * nothing to do
175 */
176#define arch_decomp_wdog()
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4234d28dc171..924bf24693cd 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -25,14 +25,11 @@
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> 28#include <plat-omap/dma-omap.h>
29#include <plat/sdrc.h>
30#include <plat/serial.h>
31#include <plat/omap-pm.h>
32#include <plat/omap_hwmod.h>
33#include <plat/multi.h>
34#include <plat/dma.h>
35 29
30#include "../plat-omap/sram.h"
31
32#include "omap_hwmod.h"
36#include "soc.h" 33#include "soc.h"
37#include "iomap.h" 34#include "iomap.h"
38#include "voltage.h" 35#include "voltage.h"
@@ -43,7 +40,17 @@
43#include "clock2xxx.h" 40#include "clock2xxx.h"
44#include "clock3xxx.h" 41#include "clock3xxx.h"
45#include "clock44xx.h" 42#include "clock44xx.h"
46 43#include "omap-pm.h"
44#include "sdrc.h"
45#include "control.h"
46#include "serial.h"
47#include "cm2xxx.h"
48#include "cm3xxx.h"
49#include "prm.h"
50#include "cm.h"
51#include "prcm_mpu44xx.h"
52#include "prminst44xx.h"
53#include "cminst44xx.h"
47/* 54/*
48 * The machine specific code may provide the extra mapping besides the 55 * The machine specific code may provide the extra mapping besides the
49 * default mapping provided here. 56 * default mapping provided here.
@@ -265,7 +272,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
265#endif 272#endif
266 273
267#ifdef CONFIG_SOC_OMAP2420 274#ifdef CONFIG_SOC_OMAP2420
268void __init omap242x_map_common_io(void) 275void __init omap242x_map_io(void)
269{ 276{
270 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 277 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
271 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 278 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
@@ -273,7 +280,7 @@ void __init omap242x_map_common_io(void)
273#endif 280#endif
274 281
275#ifdef CONFIG_SOC_OMAP2430 282#ifdef CONFIG_SOC_OMAP2430
276void __init omap243x_map_common_io(void) 283void __init omap243x_map_io(void)
277{ 284{
278 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 285 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
279 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 286 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
@@ -281,28 +288,28 @@ void __init omap243x_map_common_io(void)
281#endif 288#endif
282 289
283#ifdef CONFIG_ARCH_OMAP3 290#ifdef CONFIG_ARCH_OMAP3
284void __init omap34xx_map_common_io(void) 291void __init omap3_map_io(void)
285{ 292{
286 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 293 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
287} 294}
288#endif 295#endif
289 296
290#ifdef CONFIG_SOC_TI81XX 297#ifdef CONFIG_SOC_TI81XX
291void __init omapti81xx_map_common_io(void) 298void __init ti81xx_map_io(void)
292{ 299{
293 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 300 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
294} 301}
295#endif 302#endif
296 303
297#ifdef CONFIG_SOC_AM33XX 304#ifdef CONFIG_SOC_AM33XX
298void __init omapam33xx_map_common_io(void) 305void __init am33xx_map_io(void)
299{ 306{
300 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 307 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
301} 308}
302#endif 309#endif
303 310
304#ifdef CONFIG_ARCH_OMAP4 311#ifdef CONFIG_ARCH_OMAP4
305void __init omap44xx_map_common_io(void) 312void __init omap4_map_io(void)
306{ 313{
307 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 314 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
308 omap_barriers_init(); 315 omap_barriers_init();
@@ -310,7 +317,7 @@ void __init omap44xx_map_common_io(void)
310#endif 317#endif
311 318
312#ifdef CONFIG_SOC_OMAP5 319#ifdef CONFIG_SOC_OMAP5
313void __init omap5_map_common_io(void) 320void __init omap5_map_io(void)
314{ 321{
315 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 322 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
316} 323}
@@ -377,8 +384,15 @@ static void __init omap_hwmod_init_postsetup(void)
377#ifdef CONFIG_SOC_OMAP2420 384#ifdef CONFIG_SOC_OMAP2420
378void __init omap2420_init_early(void) 385void __init omap2420_init_early(void)
379{ 386{
380 omap2_set_globals_242x(); 387 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
388 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
389 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
390 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
391 NULL);
392 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
393 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
381 omap2xxx_check_revision(); 394 omap2xxx_check_revision();
395 omap2xxx_cm_init();
382 omap_common_init_early(); 396 omap_common_init_early();
383 omap2xxx_voltagedomains_init(); 397 omap2xxx_voltagedomains_init();
384 omap242x_powerdomains_init(); 398 omap242x_powerdomains_init();
@@ -393,14 +407,22 @@ void __init omap2420_init_late(void)
393 omap_mux_late_init(); 407 omap_mux_late_init();
394 omap2_common_pm_late_init(); 408 omap2_common_pm_late_init();
395 omap2_pm_init(); 409 omap2_pm_init();
410 omap2_clk_enable_autoidle_all();
396} 411}
397#endif 412#endif
398 413
399#ifdef CONFIG_SOC_OMAP2430 414#ifdef CONFIG_SOC_OMAP2430
400void __init omap2430_init_early(void) 415void __init omap2430_init_early(void)
401{ 416{
402 omap2_set_globals_243x(); 417 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
418 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
419 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
420 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
421 NULL);
422 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
423 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
403 omap2xxx_check_revision(); 424 omap2xxx_check_revision();
425 omap2xxx_cm_init();
404 omap_common_init_early(); 426 omap_common_init_early();
405 omap2xxx_voltagedomains_init(); 427 omap2xxx_voltagedomains_init();
406 omap243x_powerdomains_init(); 428 omap243x_powerdomains_init();
@@ -415,6 +437,7 @@ void __init omap2430_init_late(void)
415 omap_mux_late_init(); 437 omap_mux_late_init();
416 omap2_common_pm_late_init(); 438 omap2_common_pm_late_init();
417 omap2_pm_init(); 439 omap2_pm_init();
440 omap2_clk_enable_autoidle_all();
418} 441}
419#endif 442#endif
420 443
@@ -425,9 +448,16 @@ void __init omap2430_init_late(void)
425#ifdef CONFIG_ARCH_OMAP3 448#ifdef CONFIG_ARCH_OMAP3
426void __init omap3_init_early(void) 449void __init omap3_init_early(void)
427{ 450{
428 omap2_set_globals_3xxx(); 451 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
452 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
453 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
454 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
455 NULL);
456 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
457 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
429 omap3xxx_check_revision(); 458 omap3xxx_check_revision();
430 omap3xxx_check_features(); 459 omap3xxx_check_features();
460 omap3xxx_cm_init();
431 omap_common_init_early(); 461 omap_common_init_early();
432 omap3xxx_voltagedomains_init(); 462 omap3xxx_voltagedomains_init();
433 omap3xxx_powerdomains_init(); 463 omap3xxx_powerdomains_init();
@@ -459,7 +489,12 @@ void __init am35xx_init_early(void)
459 489
460void __init ti81xx_init_early(void) 490void __init ti81xx_init_early(void)
461{ 491{
462 omap2_set_globals_ti81xx(); 492 omap2_set_globals_tap(OMAP343X_CLASS,
493 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
494 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
495 NULL);
496 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
497 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
463 omap3xxx_check_revision(); 498 omap3xxx_check_revision();
464 ti81xx_check_features(); 499 ti81xx_check_features();
465 omap_common_init_early(); 500 omap_common_init_early();
@@ -476,6 +511,7 @@ void __init omap3_init_late(void)
476 omap_mux_late_init(); 511 omap_mux_late_init();
477 omap2_common_pm_late_init(); 512 omap2_common_pm_late_init();
478 omap3_pm_init(); 513 omap3_pm_init();
514 omap2_clk_enable_autoidle_all();
479} 515}
480 516
481void __init omap3430_init_late(void) 517void __init omap3430_init_late(void)
@@ -483,6 +519,7 @@ void __init omap3430_init_late(void)
483 omap_mux_late_init(); 519 omap_mux_late_init();
484 omap2_common_pm_late_init(); 520 omap2_common_pm_late_init();
485 omap3_pm_init(); 521 omap3_pm_init();
522 omap2_clk_enable_autoidle_all();
486} 523}
487 524
488void __init omap35xx_init_late(void) 525void __init omap35xx_init_late(void)
@@ -490,6 +527,7 @@ void __init omap35xx_init_late(void)
490 omap_mux_late_init(); 527 omap_mux_late_init();
491 omap2_common_pm_late_init(); 528 omap2_common_pm_late_init();
492 omap3_pm_init(); 529 omap3_pm_init();
530 omap2_clk_enable_autoidle_all();
493} 531}
494 532
495void __init omap3630_init_late(void) 533void __init omap3630_init_late(void)
@@ -497,6 +535,7 @@ void __init omap3630_init_late(void)
497 omap_mux_late_init(); 535 omap_mux_late_init();
498 omap2_common_pm_late_init(); 536 omap2_common_pm_late_init();
499 omap3_pm_init(); 537 omap3_pm_init();
538 omap2_clk_enable_autoidle_all();
500} 539}
501 540
502void __init am35xx_init_late(void) 541void __init am35xx_init_late(void)
@@ -504,6 +543,7 @@ void __init am35xx_init_late(void)
504 omap_mux_late_init(); 543 omap_mux_late_init();
505 omap2_common_pm_late_init(); 544 omap2_common_pm_late_init();
506 omap3_pm_init(); 545 omap3_pm_init();
546 omap2_clk_enable_autoidle_all();
507} 547}
508 548
509void __init ti81xx_init_late(void) 549void __init ti81xx_init_late(void)
@@ -511,13 +551,19 @@ void __init ti81xx_init_late(void)
511 omap_mux_late_init(); 551 omap_mux_late_init();
512 omap2_common_pm_late_init(); 552 omap2_common_pm_late_init();
513 omap3_pm_init(); 553 omap3_pm_init();
554 omap2_clk_enable_autoidle_all();
514} 555}
515#endif 556#endif
516 557
517#ifdef CONFIG_SOC_AM33XX 558#ifdef CONFIG_SOC_AM33XX
518void __init am33xx_init_early(void) 559void __init am33xx_init_early(void)
519{ 560{
520 omap2_set_globals_am33xx(); 561 omap2_set_globals_tap(AM335X_CLASS,
562 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
563 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
564 NULL);
565 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
566 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
521 omap3xxx_check_revision(); 567 omap3xxx_check_revision();
522 ti81xx_check_features(); 568 ti81xx_check_features();
523 omap_common_init_early(); 569 omap_common_init_early();
@@ -533,7 +579,16 @@ void __init am33xx_init_early(void)
533#ifdef CONFIG_ARCH_OMAP4 579#ifdef CONFIG_ARCH_OMAP4
534void __init omap4430_init_early(void) 580void __init omap4430_init_early(void)
535{ 581{
536 omap2_set_globals_443x(); 582 omap2_set_globals_tap(OMAP443X_CLASS,
583 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
584 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
585 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
586 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
587 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
588 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
589 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
590 omap_prm_base_init();
591 omap_cm_base_init();
537 omap4xxx_check_revision(); 592 omap4xxx_check_revision();
538 omap4xxx_check_features(); 593 omap4xxx_check_features();
539 omap_common_init_early(); 594 omap_common_init_early();
@@ -550,13 +605,23 @@ void __init omap4430_init_late(void)
550 omap_mux_late_init(); 605 omap_mux_late_init();
551 omap2_common_pm_late_init(); 606 omap2_common_pm_late_init();
552 omap4_pm_init(); 607 omap4_pm_init();
608 omap2_clk_enable_autoidle_all();
553} 609}
554#endif 610#endif
555 611
556#ifdef CONFIG_SOC_OMAP5 612#ifdef CONFIG_SOC_OMAP5
557void __init omap5_init_early(void) 613void __init omap5_init_early(void)
558{ 614{
559 omap2_set_globals_5xxx(); 615 omap2_set_globals_tap(OMAP54XX_CLASS,
616 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
617 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
618 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
619 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
620 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
621 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
622 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
623 omap_prm_base_init();
624 omap_cm_base_init();
560 omap5xxx_check_revision(); 625 omap5xxx_check_revision();
561 omap_common_init_early(); 626 omap_common_init_early();
562} 627}
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 37f8f948047b..bf496510eb5e 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -19,16 +19,17 @@
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.
30 */ 31 */
31#include "cm2xxx_3xxx.h" 32#include "cm3xxx.h"
32#include "cm-regbits-34xx.h" 33#include "cm-regbits-34xx.h"
33 34
34static int omap3_enable_st_clock(unsigned int id, bool enable) 35static int omap3_enable_st_clock(unsigned int id, bool enable)
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..aafdd4ca9f4f 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -25,13 +25,13 @@
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> 28#include "prm.h"
29#include <plat/omap_device.h>
30#include <plat/mmc.h>
31
32#include "common.h" 29#include "common.h"
33#include "control.h" 30#include "control.h"
31#include "omap_hwmod.h"
32#include "omap_device.h"
34#include "mux.h" 33#include "mux.h"
34#include "mmc.h"
35 35
36/* 36/*
37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register 37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
@@ -44,9 +44,6 @@
44#define MSDI_CON_CLKD_MASK (0x3f << 0) 44#define MSDI_CON_CLKD_MASK (0x3f << 0)
45#define MSDI_CON_CLKD_SHIFT 0 45#define MSDI_CON_CLKD_SHIFT 0
46 46
47/* Maximum microseconds to wait for OMAP module to softreset */
48#define MAX_MODULE_SOFTRESET_WAIT 10000
49
50/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */ 47/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
51#define MSDI_TARGET_RESET_CLKD 0x3ff 48#define MSDI_TARGET_RESET_CLKD 0x3ff
52 49
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/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
new file mode 100644
index 000000000000..be6bc89ab1e8
--- /dev/null
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -0,0 +1,65 @@
1/*
2 * omap2-restart.c - code common to all OMAP2xxx machines.
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/io.h>
15
16#include "common.h"
17#include "prm2xxx.h"
18
19/*
20 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
21 * clock and the sys_ck. Used during the reset process
22 */
23static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;
24
25/* Reboot handling */
26
27/**
28 * omap2xxx_restart - Set DPLL to bypass mode for reboot to work
29 *
30 * Set the DPLL to bypass so that reboot completes successfully. No
31 * return value.
32 */
33void omap2xxx_restart(char mode, const char *cmd)
34{
35 u32 rate;
36
37 rate = clk_get_rate(reset_sys_ck);
38 clk_set_rate(reset_virt_prcm_set_ck, rate);
39
40 /* XXX Should save the cmd argument for use after the reboot */
41
42 omap2xxx_prm_dpll_reset(); /* never returns */
43 while (1);
44}
45
46/**
47 * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart
48 *
49 * Some clocks need to be looked up in advance for the SoC restart
50 * operation to work - see omap2xxx_restart(). Returns -EINVAL upon
51 * error or 0 upon success.
52 */
53static int __init omap2xxx_common_look_up_clks_for_reset(void)
54{
55 reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set");
56 if (IS_ERR(reset_virt_prcm_set_ck))
57 return -EINVAL;
58
59 reset_sys_ck = clk_get(NULL, "sys_ck");
60 if (IS_ERR(reset_sys_ck))
61 return -EINVAL;
62
63 return 0;
64}
65core_initcall(omap2xxx_common_look_up_clks_for_reset);
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
new file mode 100644
index 000000000000..923c582189e5
--- /dev/null
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -0,0 +1,36 @@
1/*
2 * omap3-restart.c - Code common to all OMAP3xxx machines.
3 *
4 * Copyright (C) 2009, 2012 Texas Instruments
5 * Copyright (C) 2010 Nokia Corporation
6 * Tony Lindgren <tony@atomide.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.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
16#include "iomap.h"
17#include "common.h"
18#include "control.h"
19#include "prm3xxx.h"
20
21/* Global address base setup code */
22
23/**
24 * omap3xxx_restart - trigger a software restart of the SoC
25 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
26 * @cmd: passed from the userspace program rebooting the system (if provided)
27 *
28 * Resets the SoC. For @cmd, see the 'reboot' syscall in
29 * kernel/sys.c. No return value.
30 */
31void omap3xxx_restart(char mode, const char *cmd)
32{
33 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
34 omap3xxx_prm_dpll3_reset(); /* never returns */
35 while (1);
36}
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index e1f289748c5d..64fce07a3ccd 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -25,16 +25,18 @@
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"
32#include "iomap.h"
35#include "common.h" 33#include "common.h"
34#include "mmc.h"
36#include "hsmmc.h" 35#include "hsmmc.h"
36#include "prminst44xx.h"
37#include "prcm_mpu44xx.h"
37#include "omap4-sar-layout.h" 38#include "omap4-sar-layout.h"
39#include "omap-secure.h"
38 40
39#ifdef CONFIG_CACHE_L2X0 41#ifdef CONFIG_CACHE_L2X0
40static void __iomem *l2cache_base; 42static void __iomem *l2cache_base;
@@ -281,3 +283,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
281 return 0; 283 return 0;
282} 284}
283#endif 285#endif
286
287/**
288 * omap44xx_restart - trigger a software restart of the SoC
289 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
290 * @cmd: passed from the userspace program rebooting the system (if provided)
291 *
292 * Resets the SoC. For @cmd, see the 'reboot' syscall in
293 * kernel/sys.c. No return value.
294 */
295void omap44xx_restart(char mode, const char *cmd)
296{
297 /* XXX Should save 'cmd' into scratchpad for use after reboot */
298 omap4_prminst_global_warm_sw_reset(); /* never returns */
299 while (1);
300}
301
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 87cc6d058de2..3f3bf323e201 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -130,7 +130,7 @@
130#include <linux/kernel.h> 130#include <linux/kernel.h>
131#include <linux/errno.h> 131#include <linux/errno.h>
132#include <linux/io.h> 132#include <linux/io.h>
133#include <linux/clk.h> 133#include <linux/clk-provider.h>
134#include <linux/delay.h> 134#include <linux/delay.h>
135#include <linux/err.h> 135#include <linux/err.h>
136#include <linux/list.h> 136#include <linux/list.h>
@@ -139,27 +139,25 @@
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>
145 144
146#include "soc.h" 145#include "soc.h"
147#include "common.h" 146#include "common.h"
148#include "clockdomain.h" 147#include "clockdomain.h"
149#include "powerdomain.h" 148#include "powerdomain.h"
150#include "cm2xxx_3xxx.h" 149#include "cm2xxx.h"
150#include "cm3xxx.h"
151#include "cminst44xx.h" 151#include "cminst44xx.h"
152#include "cm33xx.h" 152#include "cm33xx.h"
153#include "prm2xxx_3xxx.h" 153#include "prm.h"
154#include "prm3xxx.h"
154#include "prm44xx.h" 155#include "prm44xx.h"
155#include "prm33xx.h" 156#include "prm33xx.h"
156#include "prminst44xx.h" 157#include "prminst44xx.h"
157#include "mux.h" 158#include "mux.h"
158#include "pm.h" 159#include "pm.h"
159 160
160/* Maximum microseconds to wait for OMAP module to softreset */
161#define MAX_MODULE_SOFTRESET_WAIT 10000
162
163/* Name of the OMAP hwmod for the MPU */ 161/* Name of the OMAP hwmod for the MPU */
164#define MPU_INITIATOR_NAME "mpu" 162#define MPU_INITIATOR_NAME "mpu"
165 163
@@ -648,6 +646,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
648 return 0; 646 return 0;
649} 647}
650 648
649static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
650{
651 struct clk_hw_omap *clk;
652
653 if (oh->clkdm) {
654 return oh->clkdm;
655 } else if (oh->_clk) {
656 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
657 return clk->clkdm;
658 }
659 return NULL;
660}
661
651/** 662/**
652 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active 663 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
653 * @oh: struct omap_hwmod * 664 * @oh: struct omap_hwmod *
@@ -663,13 +674,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
663 */ 674 */
664static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 675static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
665{ 676{
666 if (!oh->_clk) 677 struct clockdomain *clkdm, *init_clkdm;
678
679 clkdm = _get_clkdm(oh);
680 init_clkdm = _get_clkdm(init_oh);
681
682 if (!clkdm || !init_clkdm)
667 return -EINVAL; 683 return -EINVAL;
668 684
669 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 685 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
670 return 0; 686 return 0;
671 687
672 return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 688 return clkdm_add_sleepdep(clkdm, init_clkdm);
673} 689}
674 690
675/** 691/**
@@ -687,13 +703,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
687 */ 703 */
688static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 704static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
689{ 705{
690 if (!oh->_clk) 706 struct clockdomain *clkdm, *init_clkdm;
707
708 clkdm = _get_clkdm(oh);
709 init_clkdm = _get_clkdm(init_oh);
710
711 if (!clkdm || !init_clkdm)
691 return -EINVAL; 712 return -EINVAL;
692 713
693 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 714 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
694 return 0; 715 return 0;
695 716
696 return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 717 return clkdm_del_sleepdep(clkdm, init_clkdm);
697} 718}
698 719
699/** 720/**
@@ -727,7 +748,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
727 */ 748 */
728 clk_prepare(oh->_clk); 749 clk_prepare(oh->_clk);
729 750
730 if (!oh->_clk->clkdm) 751 if (!_get_clkdm(oh))
731 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", 752 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
732 oh->name, oh->main_clk); 753 oh->name, oh->main_clk);
733 754
@@ -1310,6 +1331,7 @@ static void _enable_sysc(struct omap_hwmod *oh)
1310 u8 idlemode, sf; 1331 u8 idlemode, sf;
1311 u32 v; 1332 u32 v;
1312 bool clkdm_act; 1333 bool clkdm_act;
1334 struct clockdomain *clkdm;
1313 1335
1314 if (!oh->class->sysc) 1336 if (!oh->class->sysc)
1315 return; 1337 return;
@@ -1329,11 +1351,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
1329 v = oh->_sysc_cache; 1351 v = oh->_sysc_cache;
1330 sf = oh->class->sysc->sysc_flags; 1352 sf = oh->class->sysc->sysc_flags;
1331 1353
1354 clkdm = _get_clkdm(oh);
1332 if (sf & SYSC_HAS_SIDLEMODE) { 1355 if (sf & SYSC_HAS_SIDLEMODE) {
1333 clkdm_act = ((oh->clkdm && 1356 clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
1334 oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
1335 (oh->_clk && oh->_clk->clkdm &&
1336 oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
1337 if (clkdm_act && !(oh->class->sysc->idlemodes & 1357 if (clkdm_act && !(oh->class->sysc->idlemodes &
1338 (SIDLE_SMART | SIDLE_SMART_WKUP))) 1358 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1339 idlemode = HWMOD_IDLEMODE_FORCE; 1359 idlemode = HWMOD_IDLEMODE_FORCE;
@@ -1535,11 +1555,12 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1535 1555
1536 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); 1556 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name);
1537 1557
1558 if (soc_ops.init_clkdm)
1559 ret |= soc_ops.init_clkdm(oh);
1560
1538 ret |= _init_main_clk(oh); 1561 ret |= _init_main_clk(oh);
1539 ret |= _init_interface_clks(oh); 1562 ret |= _init_interface_clks(oh);
1540 ret |= _init_opt_clks(oh); 1563 ret |= _init_opt_clks(oh);
1541 if (soc_ops.init_clkdm)
1542 ret |= soc_ops.init_clkdm(oh);
1543 1564
1544 if (!ret) 1565 if (!ret)
1545 oh->_state = _HWMOD_STATE_CLKS_INITED; 1566 oh->_state = _HWMOD_STATE_CLKS_INITED;
@@ -2095,7 +2116,8 @@ static int _enable(struct omap_hwmod *oh)
2095 _enable_sysc(oh); 2116 _enable_sysc(oh);
2096 } 2117 }
2097 } else { 2118 } else {
2098 _omap4_disable_module(oh); 2119 if (soc_ops.disable_module)
2120 soc_ops.disable_module(oh);
2099 _disable_clocks(oh); 2121 _disable_clocks(oh);
2100 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 2122 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
2101 oh->name, r); 2123 oh->name, r);
@@ -2703,7 +2725,34 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2703/* Static functions intended only for use in soc_ops field function pointers */ 2725/* Static functions intended only for use in soc_ops field function pointers */
2704 2726
2705/** 2727/**
2706 * _omap2_wait_target_ready - wait for a module to leave slave idle 2728 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
2729 * @oh: struct omap_hwmod *
2730 *
2731 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2732 * does not have an IDLEST bit or if the module successfully leaves
2733 * slave idle; otherwise, pass along the return value of the
2734 * appropriate *_cm*_wait_module_ready() function.
2735 */
2736static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2737{
2738 if (!oh)
2739 return -EINVAL;
2740
2741 if (oh->flags & HWMOD_NO_IDLEST)
2742 return 0;
2743
2744 if (!_find_mpu_rt_port(oh))
2745 return 0;
2746
2747 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2748
2749 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2750 oh->prcm.omap2.idlest_reg_id,
2751 oh->prcm.omap2.idlest_idle_bit);
2752}
2753
2754/**
2755 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2707 * @oh: struct omap_hwmod * 2756 * @oh: struct omap_hwmod *
2708 * 2757 *
2709 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2758 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2711,7 +2760,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2711 * slave idle; otherwise, pass along the return value of the 2760 * slave idle; otherwise, pass along the return value of the
2712 * appropriate *_cm*_wait_module_ready() function. 2761 * appropriate *_cm*_wait_module_ready() function.
2713 */ 2762 */
2714static int _omap2_wait_target_ready(struct omap_hwmod *oh) 2763static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2715{ 2764{
2716 if (!oh) 2765 if (!oh)
2717 return -EINVAL; 2766 return -EINVAL;
@@ -2724,9 +2773,9 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2724 2773
2725 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2774 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2726 2775
2727 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2776 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2728 oh->prcm.omap2.idlest_reg_id, 2777 oh->prcm.omap2.idlest_reg_id,
2729 oh->prcm.omap2.idlest_idle_bit); 2778 oh->prcm.omap2.idlest_idle_bit);
2730} 2779}
2731 2780
2732/** 2781/**
@@ -3565,10 +3614,15 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3565{ 3614{
3566 struct clk *c; 3615 struct clk *c;
3567 struct omap_hwmod_ocp_if *oi; 3616 struct omap_hwmod_ocp_if *oi;
3617 struct clockdomain *clkdm;
3618 struct clk_hw_omap *clk;
3568 3619
3569 if (!oh) 3620 if (!oh)
3570 return NULL; 3621 return NULL;
3571 3622
3623 if (oh->clkdm)
3624 return oh->clkdm->pwrdm.ptr;
3625
3572 if (oh->_clk) { 3626 if (oh->_clk) {
3573 c = oh->_clk; 3627 c = oh->_clk;
3574 } else { 3628 } else {
@@ -3578,11 +3632,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3578 c = oi->_clk; 3632 c = oi->_clk;
3579 } 3633 }
3580 3634
3581 if (!c->clkdm) 3635 clk = to_clk_hw_omap(__clk_get_hw(c));
3636 clkdm = clk->clkdm;
3637 if (!clkdm)
3582 return NULL; 3638 return NULL;
3583 3639
3584 return c->clkdm->pwrdm.ptr; 3640 return clkdm->pwrdm.ptr;
3585
3586} 3641}
3587 3642
3588/** 3643/**
@@ -3994,8 +4049,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3994 */ 4049 */
3995void __init omap_hwmod_init(void) 4050void __init omap_hwmod_init(void)
3996{ 4051{
3997 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 4052 if (cpu_is_omap24xx()) {
3998 soc_ops.wait_target_ready = _omap2_wait_target_ready; 4053 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
4054 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4055 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4056 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4057 } else if (cpu_is_omap34xx()) {
4058 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
3999 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4059 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4000 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4060 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4001 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4061 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 1db029438022..87a3c5b7aa74 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..a8b3368dca3d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -12,21 +12,24 @@
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"
32#include "serial.h"
30#include "wd_timer.h" 33#include "wd_timer.h"
31 34
32/* 35/*
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..0413daba2dba 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,8 +13,7 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17#include <plat/serial.h>
18 17
19#include "omap_hwmod_common_data.h" 18#include "omap_hwmod_common_data.h"
20 19
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..05c6a5906550 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,16 @@
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-omap/dma-omap.h>
14#include <plat/dma.h> 14
15#include <plat/common.h> 15#include "../plat-omap/common.h"
16
17#include "omap_hwmod.h"
16#include "hdq1w.h" 18#include "hdq1w.h"
17 19
18#include "omap_hwmod_common_data.h" 20#include "omap_hwmod_common_data.h"
21#include "dma.h"
19 22
20/* UART */ 23/* UART */
21 24
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..47901a5e76de 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -13,10 +13,10 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17#include <plat/serial.h>
18#include "l3_2xxx.h" 17#include "l3_2xxx.h"
19#include "l4_2xxx.h" 18#include "l4_2xxx.h"
19#include "serial.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_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index bd9220ed5ab9..a0116d08cf45 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,13 @@
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>
13#include <linux/platform_data/gpio-omap.h> 12#include <linux/platform_data/gpio-omap.h>
14#include <plat/dma.h> 13#include <plat-omap/dma-omap.h>
15#include <plat/dmtimer.h> 14#include <plat/dmtimer.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 15#include <linux/platform_data/spi-omap2-mcspi.h>
17 16
17#include "omap_hwmod.h"
18#include "omap_hwmod_common_data.h" 18#include "omap_hwmod_common_data.h"
19#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
20#include "prm-regbits-24xx.h" 20#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 9693a187ff66..abe66ced903f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -14,16 +14,14 @@
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 "l3_3xxx.h" 23#include "l3_3xxx.h"
24#include "l4_3xxx.h" 24#include "l4_3xxx.h"
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 26#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <plat/dmtimer.h> 27#include <plat/dmtimer.h>
@@ -32,10 +30,16 @@
32#include "am35xx.h" 30#include "am35xx.h"
33 31
34#include "soc.h" 32#include "soc.h"
33#include "omap_hwmod.h"
35#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
36#include "prm-regbits-34xx.h" 35#include "prm-regbits-34xx.h"
37#include "cm-regbits-34xx.h" 36#include "cm-regbits-34xx.h"
37
38#include "dma.h"
39#include "i2c.h"
40#include "mmc.h"
38#include "wd_timer.h" 41#include "wd_timer.h"
42#include "serial.h"
39 43
40/* 44/*
41 * OMAP3xxx hardware module integration data 45 * OMAP3xxx hardware module integration data
@@ -1406,7 +1410,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
1406static struct omap_hwmod omap34xx_sr1_hwmod = { 1410static struct omap_hwmod omap34xx_sr1_hwmod = {
1407 .name = "smartreflex_mpu_iva", 1411 .name = "smartreflex_mpu_iva",
1408 .class = &omap34xx_smartreflex_hwmod_class, 1412 .class = &omap34xx_smartreflex_hwmod_class,
1409 .main_clk = "smartreflex_mpu_iva_fck", 1413 .main_clk = "sr1_fck",
1410 .prcm = { 1414 .prcm = {
1411 .omap2 = { 1415 .omap2 = {
1412 .prcm_reg_id = 1, 1416 .prcm_reg_id = 1,
@@ -1424,7 +1428,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
1424static struct omap_hwmod omap36xx_sr1_hwmod = { 1428static struct omap_hwmod omap36xx_sr1_hwmod = {
1425 .name = "smartreflex_mpu_iva", 1429 .name = "smartreflex_mpu_iva",
1426 .class = &omap36xx_smartreflex_hwmod_class, 1430 .class = &omap36xx_smartreflex_hwmod_class,
1427 .main_clk = "smartreflex_mpu_iva_fck", 1431 .main_clk = "sr1_fck",
1428 .prcm = { 1432 .prcm = {
1429 .omap2 = { 1433 .omap2 = {
1430 .prcm_reg_id = 1, 1434 .prcm_reg_id = 1,
@@ -1451,7 +1455,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
1451static struct omap_hwmod omap34xx_sr2_hwmod = { 1455static struct omap_hwmod omap34xx_sr2_hwmod = {
1452 .name = "smartreflex_core", 1456 .name = "smartreflex_core",
1453 .class = &omap34xx_smartreflex_hwmod_class, 1457 .class = &omap34xx_smartreflex_hwmod_class,
1454 .main_clk = "smartreflex_core_fck", 1458 .main_clk = "sr2_fck",
1455 .prcm = { 1459 .prcm = {
1456 .omap2 = { 1460 .omap2 = {
1457 .prcm_reg_id = 1, 1461 .prcm_reg_id = 1,
@@ -1469,7 +1473,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
1469static struct omap_hwmod omap36xx_sr2_hwmod = { 1473static struct omap_hwmod omap36xx_sr2_hwmod = {
1470 .name = "smartreflex_core", 1474 .name = "smartreflex_core",
1471 .class = &omap36xx_smartreflex_hwmod_class, 1475 .class = &omap36xx_smartreflex_hwmod_class,
1472 .main_clk = "smartreflex_core_fck", 1476 .main_clk = "sr2_fck",
1473 .prcm = { 1477 .prcm = {
1474 .omap2 = { 1478 .omap2 = {
1475 .prcm_reg_id = 1, 1479 .prcm_reg_id = 1,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 0b1249e00398..d6700d3ddd04 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -22,22 +22,25 @@
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/platform_data/omap_ocp2scp.h> 24#include <linux/platform_data/omap_ocp2scp.h>
25#include <linux/i2c-omap.h>
26
27#include <plat-omap/dma-omap.h>
25 28
26#include <plat/omap_hwmod.h>
27#include <plat/i2c.h>
28#include <plat/dma.h>
29#include <linux/platform_data/spi-omap2-mcspi.h> 29#include <linux/platform_data/spi-omap2-mcspi.h>
30#include <linux/platform_data/asoc-ti-mcbsp.h> 30#include <linux/platform_data/asoc-ti-mcbsp.h>
31#include <plat/mmc.h>
32#include <plat/dmtimer.h> 31#include <plat/dmtimer.h>
33#include <plat/common.h>
34#include <plat/iommu.h> 32#include <plat/iommu.h>
35 33
34#include "../plat-omap/common.h"
35
36#include "omap_hwmod.h"
36#include "omap_hwmod_common_data.h" 37#include "omap_hwmod_common_data.h"
37#include "cm1_44xx.h" 38#include "cm1_44xx.h"
38#include "cm2_44xx.h" 39#include "cm2_44xx.h"
39#include "prm44xx.h" 40#include "prm44xx.h"
40#include "prm-regbits-44xx.h" 41#include "prm-regbits-44xx.h"
42#include "i2c.h"
43#include "mmc.h"
41#include "wd_timer.h" 44#include "wd_timer.h"
42 45
43/* Base offset for all OMAP4 interrupts external to MPUSS */ 46/* 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 18a750e296a8..336fdfcf88bb 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_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 9b56e5e1a2d2..e237602e10ea 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -27,11 +27,11 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/usb.h> 29#include <linux/usb.h>
30 30#include <linux/usb/musb.h>
31#include <plat/usb.h>
32 31
33#include "soc.h" 32#include "soc.h"
34#include "control.h" 33#include "control.h"
34#include "usb.h"
35 35
36#define CONTROL_DEV_CONF 0x300 36#define CONTROL_DEV_CONF 0x300
37#define PHY_PD 0x1 37#define PHY_PD 0x1
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 7ff9667d9761..fefd40166624 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 ef668c756db7..f4b3143a8b1d 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..3d35bd64487c 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -25,7 +25,7 @@
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/clk.h> 28#include <linux/clk-provider.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
@@ -36,14 +36,16 @@
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"
44#include "prm2xxx_3xxx.h" 45#include "clock.h"
46#include "prm2xxx.h"
45#include "prm-regbits-24xx.h" 47#include "prm-regbits-24xx.h"
46#include "cm2xxx_3xxx.h" 48#include "cm2xxx.h"
47#include "cm-regbits-24xx.h" 49#include "cm-regbits-24xx.h"
48#include "sdrc.h" 50#include "sdrc.h"
49#include "pm.h" 51#include "pm.h"
@@ -200,7 +202,7 @@ static int omap2_can_sleep(void)
200{ 202{
201 if (omap2_fclks_active()) 203 if (omap2_fclks_active())
202 return 0; 204 return 0;
203 if (osc_ck->usecount > 1) 205 if (__clk_is_enabled(osc_ck))
204 return 0; 206 return 0;
205 if (omap_dma_running()) 207 if (omap_dma_running())
206 return 0; 208 return 0;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3a904de4313e..a9b8da1629bf 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -35,20 +35,19 @@
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> 40#include <plat-omap/dma-omap.h>
42#include <plat/prcm.h>
43#include <plat/gpmc.h>
44#include <plat/dma.h>
45 41
42#include "../plat-omap/sram.h"
43
44#include "soc.h"
46#include "common.h" 45#include "common.h"
47#include "cm2xxx_3xxx.h" 46#include "cm3xxx.h"
48#include "cm-regbits-34xx.h" 47#include "cm-regbits-34xx.h"
48#include "gpmc.h"
49#include "prm-regbits-34xx.h" 49#include "prm-regbits-34xx.h"
50 50#include "prm3xxx.h"
51#include "prm2xxx_3xxx.h"
52#include "pm.h" 51#include "pm.h"
53#include "sdrc.h" 52#include "sdrc.h"
54#include "control.h" 53#include "control.h"
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index f2d69be9b77e..aa6fd98f606e 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.c b/arch/arm/mach-omap2/powerdomain.c
index 1678a3284233..dea62a9aad07 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -29,8 +29,6 @@
29 29
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31 31
32#include <plat/prcm.h>
33
34#include "powerdomain.h" 32#include "powerdomain.h"
35#include "clockdomain.h" 33#include "clockdomain.h"
36 34
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/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
deleted file mode 100644
index 3950ccfe5f4a..000000000000
--- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * OMAP2 and OMAP3 powerdomain control
3 *
4 * Copyright (C) 2009-2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include <plat/prcm.h>
21
22#include "powerdomain.h"
23#include "prm.h"
24#include "prm-regbits-24xx.h"
25#include "prm-regbits-34xx.h"
26
27
28/* Common functions across OMAP2 and OMAP3 */
29static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
30{
31 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
32 (pwrst << OMAP_POWERSTATE_SHIFT),
33 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
34 return 0;
35}
36
37static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
38{
39 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
40 OMAP2_PM_PWSTCTRL,
41 OMAP_POWERSTATE_MASK);
42}
43
44static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
45{
46 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
47 OMAP2_PM_PWSTST,
48 OMAP_POWERSTATEST_MASK);
49}
50
51static int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
52 u8 pwrst)
53{
54 u32 m;
55
56 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
57
58 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
59 OMAP2_PM_PWSTCTRL);
60
61 return 0;
62}
63
64static int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
65 u8 pwrst)
66{
67 u32 m;
68
69 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
70
71 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
72 OMAP2_PM_PWSTCTRL);
73
74 return 0;
75}
76
77static int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
78{
79 u32 m;
80
81 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
82
83 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
84 m);
85}
86
87static int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
88{
89 u32 m;
90
91 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
92
93 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
94 OMAP2_PM_PWSTCTRL, m);
95}
96
97static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
98{
99 u32 v;
100
101 v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
102 omap2_prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
103 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
104
105 return 0;
106}
107
108static int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
109{
110 u32 c = 0;
111
112 /*
113 * REVISIT: pwrdm_wait_transition() may be better implemented
114 * via a callback and a periodic timer check -- how long do we expect
115 * powerdomain transitions to take?
116 */
117
118 /* XXX Is this udelay() value meaningful? */
119 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
120 OMAP_INTRANSITION_MASK) &&
121 (c++ < PWRDM_TRANSITION_BAILOUT))
122 udelay(1);
123
124 if (c > PWRDM_TRANSITION_BAILOUT) {
125 pr_err("powerdomain: %s: waited too long to complete transition\n",
126 pwrdm->name);
127 return -EAGAIN;
128 }
129
130 pr_debug("powerdomain: completed transition in %d loops\n", c);
131
132 return 0;
133}
134
135/* Applicable only for OMAP3. Not supported on OMAP2 */
136static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
137{
138 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
139 OMAP3430_PM_PREPWSTST,
140 OMAP3430_LASTPOWERSTATEENTERED_MASK);
141}
142
143static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
144{
145 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
146 OMAP2_PM_PWSTST,
147 OMAP3430_LOGICSTATEST_MASK);
148}
149
150static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
151{
152 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
153 OMAP2_PM_PWSTCTRL,
154 OMAP3430_LOGICSTATEST_MASK);
155}
156
157static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
158{
159 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
160 OMAP3430_PM_PREPWSTST,
161 OMAP3430_LASTLOGICSTATEENTERED_MASK);
162}
163
164static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
165{
166 switch (bank) {
167 case 0:
168 return OMAP3430_LASTMEM1STATEENTERED_MASK;
169 case 1:
170 return OMAP3430_LASTMEM2STATEENTERED_MASK;
171 case 2:
172 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
173 case 3:
174 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
175 default:
176 WARN_ON(1); /* should never happen */
177 return -EEXIST;
178 }
179 return 0;
180}
181
182static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m;
185
186 m = omap3_get_mem_bank_lastmemst_mask(bank);
187
188 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
189 OMAP3430_PM_PREPWSTST, m);
190}
191
192static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
193{
194 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
195 return 0;
196}
197
198static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
199{
200 return omap2_prm_rmw_mod_reg_bits(0,
201 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
202 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
203}
204
205static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
206{
207 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
208 0, pwrdm->prcm_offs,
209 OMAP2_PM_PWSTCTRL);
210}
211
212struct pwrdm_ops omap2_pwrdm_operations = {
213 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
214 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
215 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
216 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
217 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
218 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
219 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
220 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
221 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
222};
223
224struct pwrdm_ops omap3_pwrdm_operations = {
225 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
226 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
227 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
228 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
229 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
230 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
231 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
232 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
233 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
234 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
235 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
236 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
237 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
238 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
239 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
240 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
241 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
242};
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c
deleted file mode 100644
index 67c5663899b6..000000000000
--- a/arch/arm/mach-omap2/powerdomain33xx.c
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * AM33XX Powerdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Derived from mach-omap2/powerdomain44xx.c written by Rajendra Nayak
7 * <rnayak@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/io.h>
20#include <linux/errno.h>
21#include <linux/delay.h>
22
23#include <plat/prcm.h>
24
25#include "powerdomain.h"
26#include "prm33xx.h"
27#include "prm-regbits-33xx.h"
28
29
30static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
31{
32 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
33 (pwrst << OMAP_POWERSTATE_SHIFT),
34 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
35 return 0;
36}
37
38static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
39{
40 u32 v;
41
42 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
43 v &= OMAP_POWERSTATE_MASK;
44 v >>= OMAP_POWERSTATE_SHIFT;
45
46 return v;
47}
48
49static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
50{
51 u32 v;
52
53 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
65 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
66 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
67
68 return v;
69}
70
71static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
72{
73 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
74 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
75 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
76 return 0;
77}
78
79static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
80{
81 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
82 AM33XX_LASTPOWERSTATEENTERED_MASK,
83 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
84 return 0;
85}
86
87static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
88{
89 u32 m;
90
91 m = pwrdm->logicretstate_mask;
92 if (!m)
93 return -EINVAL;
94
95 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
96 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
97
98 return 0;
99}
100
101static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
102{
103 u32 v;
104
105 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
106 v &= AM33XX_LOGICSTATEST_MASK;
107 v >>= AM33XX_LOGICSTATEST_SHIFT;
108
109 return v;
110}
111
112static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
113{
114 u32 v, m;
115
116 m = pwrdm->logicretstate_mask;
117 if (!m)
118 return -EINVAL;
119
120 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
121 v &= m;
122 v >>= __ffs(m);
123
124 return v;
125}
126
127static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
128 u8 pwrst)
129{
130 u32 m;
131
132 m = pwrdm->mem_on_mask[bank];
133 if (!m)
134 return -EINVAL;
135
136 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
137 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
138
139 return 0;
140}
141
142static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
143 u8 pwrst)
144{
145 u32 m;
146
147 m = pwrdm->mem_ret_mask[bank];
148 if (!m)
149 return -EINVAL;
150
151 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
152 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
153
154 return 0;
155}
156
157static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
158{
159 u32 m, v;
160
161 m = pwrdm->mem_pwrst_mask[bank];
162 if (!m)
163 return -EINVAL;
164
165 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
166 v &= m;
167 v >>= __ffs(m);
168
169 return v;
170}
171
172static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
173{
174 u32 m, v;
175
176 m = pwrdm->mem_retst_mask[bank];
177 if (!m)
178 return -EINVAL;
179
180 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
181 v &= m;
182 v >>= __ffs(m);
183
184 return v;
185}
186
187static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
188{
189 u32 c = 0;
190
191 /*
192 * REVISIT: pwrdm_wait_transition() may be better implemented
193 * via a callback and a periodic timer check -- how long do we expect
194 * powerdomain transitions to take?
195 */
196
197 /* XXX Is this udelay() value meaningful? */
198 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
199 & OMAP_INTRANSITION_MASK) &&
200 (c++ < PWRDM_TRANSITION_BAILOUT))
201 udelay(1);
202
203 if (c > PWRDM_TRANSITION_BAILOUT) {
204 pr_err("powerdomain: %s: waited too long to complete transition\n",
205 pwrdm->name);
206 return -EAGAIN;
207 }
208
209 pr_debug("powerdomain: completed transition in %d loops\n", c);
210
211 return 0;
212}
213
214struct pwrdm_ops am33xx_pwrdm_operations = {
215 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
216 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
217 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
218 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
219 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
220 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
221 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
222 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
223 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
224 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
225 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
226 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
227 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
228 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
229};
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
deleted file mode 100644
index aceb4f464c9b..000000000000
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ /dev/null
@@ -1,285 +0,0 @@
1/*
2 * OMAP4 powerdomain control
3 *
4 * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include "powerdomain.h"
21#include <plat/prcm.h>
22#include "prm2xxx_3xxx.h"
23#include "prm44xx.h"
24#include "prminst44xx.h"
25#include "prm-regbits-44xx.h"
26
27static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
28{
29 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
30 (pwrst << OMAP_POWERSTATE_SHIFT),
31 pwrdm->prcm_partition,
32 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
33 return 0;
34}
35
36static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
37{
38 u32 v;
39
40 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
41 OMAP4_PM_PWSTCTRL);
42 v &= OMAP_POWERSTATE_MASK;
43 v >>= OMAP_POWERSTATE_SHIFT;
44
45 return v;
46}
47
48static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
49{
50 u32 v;
51
52 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
53 OMAP4_PM_PWSTST);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
65 OMAP4_PM_PWSTST);
66 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
67 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
68
69 return v;
70}
71
72static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
73{
74 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
75 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
76 pwrdm->prcm_partition,
77 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
78 return 0;
79}
80
81static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
82{
83 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
84 OMAP4430_LASTPOWERSTATEENTERED_MASK,
85 pwrdm->prcm_partition,
86 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
87 return 0;
88}
89
90static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
91{
92 u32 v;
93
94 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
95 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
96 pwrdm->prcm_partition, pwrdm->prcm_offs,
97 OMAP4_PM_PWSTCTRL);
98
99 return 0;
100}
101
102static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
103 u8 pwrst)
104{
105 u32 m;
106
107 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
108
109 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
110 pwrdm->prcm_partition, pwrdm->prcm_offs,
111 OMAP4_PM_PWSTCTRL);
112
113 return 0;
114}
115
116static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
117 u8 pwrst)
118{
119 u32 m;
120
121 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
122
123 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
124 pwrdm->prcm_partition, pwrdm->prcm_offs,
125 OMAP4_PM_PWSTCTRL);
126
127 return 0;
128}
129
130static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
131{
132 u32 v;
133
134 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
135 OMAP4_PM_PWSTST);
136 v &= OMAP4430_LOGICSTATEST_MASK;
137 v >>= OMAP4430_LOGICSTATEST_SHIFT;
138
139 return v;
140}
141
142static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
143{
144 u32 v;
145
146 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
147 OMAP4_PM_PWSTCTRL);
148 v &= OMAP4430_LOGICRETSTATE_MASK;
149 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
150
151 return v;
152}
153
154/**
155 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
156 * @pwrdm: struct powerdomain * to read the state for
157 *
158 * Reads the previous logic powerstate for a powerdomain. This
159 * function must determine the previous logic powerstate by first
160 * checking the previous powerstate for the domain. If that was OFF,
161 * then logic has been lost. If previous state was RETENTION, the
162 * function reads the setting for the next retention logic state to
163 * see the actual value. In every other case, the logic is
164 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
165 * depending whether the logic was retained or not.
166 */
167static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
168{
169 int state;
170
171 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
172
173 if (state == PWRDM_POWER_OFF)
174 return PWRDM_POWER_OFF;
175
176 if (state != PWRDM_POWER_RET)
177 return PWRDM_POWER_RET;
178
179 return omap4_pwrdm_read_logic_retst(pwrdm);
180}
181
182static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m, v;
185
186 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
187
188 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
189 OMAP4_PM_PWSTST);
190 v &= m;
191 v >>= __ffs(m);
192
193 return v;
194}
195
196static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
197{
198 u32 m, v;
199
200 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
201
202 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
203 OMAP4_PM_PWSTCTRL);
204 v &= m;
205 v >>= __ffs(m);
206
207 return v;
208}
209
210/**
211 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
212 * @pwrdm: struct powerdomain * to read mem powerstate for
213 * @bank: memory bank index
214 *
215 * Reads the previous memory powerstate for a powerdomain. This
216 * function must determine the previous memory powerstate by first
217 * checking the previous powerstate for the domain. If that was OFF,
218 * then logic has been lost. If previous state was RETENTION, the
219 * function reads the setting for the next memory retention state to
220 * see the actual value. In every other case, the logic is
221 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
222 * depending whether logic was retained or not.
223 */
224static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
225{
226 int state;
227
228 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
229
230 if (state == PWRDM_POWER_OFF)
231 return PWRDM_POWER_OFF;
232
233 if (state != PWRDM_POWER_RET)
234 return PWRDM_POWER_RET;
235
236 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
237}
238
239static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
240{
241 u32 c = 0;
242
243 /*
244 * REVISIT: pwrdm_wait_transition() may be better implemented
245 * via a callback and a periodic timer check -- how long do we expect
246 * powerdomain transitions to take?
247 */
248
249 /* XXX Is this udelay() value meaningful? */
250 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
251 pwrdm->prcm_offs,
252 OMAP4_PM_PWSTST) &
253 OMAP_INTRANSITION_MASK) &&
254 (c++ < PWRDM_TRANSITION_BAILOUT))
255 udelay(1);
256
257 if (c > PWRDM_TRANSITION_BAILOUT) {
258 pr_err("powerdomain: %s: waited too long to complete transition\n",
259 pwrdm->name);
260 return -EAGAIN;
261 }
262
263 pr_debug("powerdomain: completed transition in %d loops\n", c);
264
265 return 0;
266}
267
268struct pwrdm_ops omap4_pwrdm_operations = {
269 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
270 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
271 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
272 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
273 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
274 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
275 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
276 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
277 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
278 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
279 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
280 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
281 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
282 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
283 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
284 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
285};
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-common.h b/arch/arm/mach-omap2/prcm-common.h
index 72df97482cc0..c7d355fafd24 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -406,11 +406,6 @@
406#define OMAP3430_EN_CORE_MASK (1 << 0) 406#define OMAP3430_EN_CORE_MASK (1 << 0)
407 407
408 408
409/*
410 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
411 * submodule to exit hardreset
412 */
413#define MAX_MODULE_HARDRESET_WAIT 10000
414 409
415/* 410/*
416 * Maximum time(us) it takes to output the signal WUCLKOUT of the last 411 * Maximum time(us) it takes to output the signal WUCLKOUT of the last
@@ -419,24 +414,7 @@
419 * microseconds on OMAP4, so this timeout may be too high. 414 * microseconds on OMAP4, so this timeout may be too high.
420 */ 415 */
421#define MAX_IOPAD_LATCH_TIME 100 416#define MAX_IOPAD_LATCH_TIME 100
422
423# ifndef __ASSEMBLER__ 417# ifndef __ASSEMBLER__
424extern void __iomem *prm_base;
425extern void __iomem *cm_base;
426extern void __iomem *cm2_base;
427extern void __iomem *prcm_mpu_base;
428
429#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
430extern void omap_prm_base_init(void);
431extern void omap_cm_base_init(void);
432#else
433static inline void omap_prm_base_init(void)
434{
435}
436static inline void omap_cm_base_init(void)
437{
438}
439#endif
440 418
441/** 419/**
442 * struct omap_prcm_irq - describes a PRCM interrupt bit 420 * struct omap_prcm_irq - describes a PRCM interrupt bit
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
deleted file mode 100644
index 0f51e034e0aa..000000000000
--- a/arch/arm/mach-omap2/prcm.c
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/prcm.c
3 *
4 * OMAP 24xx Power Reset and Clock Management (PRCM) functions
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Copyright (C) 2007 Texas Instruments, Inc.
11 * Rajendra Nayak <rnayak@ti.com>
12 *
13 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
14 * Upgraded with OMAP4 support by Abhijit Pagare <abhijitpagare@ti.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/delay.h>
26#include <linux/export.h>
27
28#include "common.h"
29#include <plat/prcm.h>
30
31#include "clock.h"
32#include "clock2xxx.h"
33#include "cm2xxx_3xxx.h"
34#include "prm2xxx_3xxx.h"
35#include "prm44xx.h"
36#include "prminst44xx.h"
37#include "cminst44xx.h"
38#include "prm-regbits-24xx.h"
39#include "prm-regbits-44xx.h"
40#include "control.h"
41
42void __iomem *prm_base;
43void __iomem *cm_base;
44void __iomem *cm2_base;
45void __iomem *prcm_mpu_base;
46
47#define MAX_MODULE_ENABLE_WAIT 100000
48
49u32 omap_prcm_get_reset_sources(void)
50{
51 /* XXX This presumably needs modification for 34XX */
52 if (cpu_is_omap24xx() || cpu_is_omap34xx())
53 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
54 if (cpu_is_omap44xx())
55 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
56
57 return 0;
58}
59EXPORT_SYMBOL(omap_prcm_get_reset_sources);
60
61/* Resets clock rates and reboots the system. Only called from system.h */
62void omap_prcm_restart(char mode, const char *cmd)
63{
64 s16 prcm_offs = 0;
65
66 if (cpu_is_omap24xx()) {
67 omap2xxx_clk_prepare_for_reboot();
68
69 prcm_offs = WKUP_MOD;
70 } else if (cpu_is_omap34xx()) {
71 prcm_offs = OMAP3430_GR_MOD;
72 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
73 } else if (cpu_is_omap44xx()) {
74 omap4_prminst_global_warm_sw_reset(); /* never returns */
75 } else {
76 WARN_ON(1);
77 }
78
79 /*
80 * As per Errata i520, in some cases, user will not be able to
81 * access DDR memory after warm-reset.
82 * This situation occurs while the warm-reset happens during a read
83 * access to DDR memory. In that particular condition, DDR memory
84 * does not respond to a corrupted read command due to the warm
85 * reset occurrence but SDRC is waiting for read completion.
86 * SDRC is not sensitive to the warm reset, but the interconnect is
87 * reset on the fly, thus causing a misalignment between SDRC logic,
88 * interconnect logic and DDR memory state.
89 * WORKAROUND:
90 * Steps to perform before a Warm reset is trigged:
91 * 1. enable self-refresh on idle request
92 * 2. put SDRC in idle
93 * 3. wait until SDRC goes to idle
94 * 4. generate SW reset (Global SW reset)
95 *
96 * Steps to be performed after warm reset occurs (in bootloader):
97 * if HW warm reset is the source, apply below steps before any
98 * accesses to SDRAM:
99 * 1. Reset SMS and SDRC and wait till reset is complete
100 * 2. Re-initialize SMS, SDRC and memory
101 *
102 * NOTE: Above work around is required only if arch reset is implemented
103 * using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
104 * the WA since it resets SDRC as well as part of cold reset.
105 */
106
107 /* XXX should be moved to some OMAP2/3 specific code */
108 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
109 OMAP2_RM_RSTCTRL);
110 omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
111}
112
113/**
114 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
115 * @reg: physical address of module IDLEST register
116 * @mask: value to mask against to determine if the module is active
117 * @idlest: idle state indicator (0 or 1) for the clock
118 * @name: name of the clock (for printk)
119 *
120 * Returns 1 if the module indicated readiness in time, or 0 if it
121 * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
122 *
123 * XXX This function is deprecated. It should be removed once the
124 * hwmod conversion is complete.
125 */
126int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
127 const char *name)
128{
129 int i = 0;
130 int ena = 0;
131
132 if (idlest)
133 ena = 0;
134 else
135 ena = mask;
136
137 /* Wait for lock */
138 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
139 MAX_MODULE_ENABLE_WAIT, i);
140
141 if (i < MAX_MODULE_ENABLE_WAIT)
142 pr_debug("cm: Module associated with clock %s ready after %d loops\n",
143 name, i);
144 else
145 pr_err("cm: Module associated with clock %s didn't enable in %d tries\n",
146 name, MAX_MODULE_ENABLE_WAIT);
147
148 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
149};
150
151void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
152{
153 if (omap2_globals->prm)
154 prm_base = omap2_globals->prm;
155 if (omap2_globals->cm)
156 cm_base = omap2_globals->cm;
157 if (omap2_globals->cm2)
158 cm2_base = omap2_globals->cm2;
159 if (omap2_globals->prcm_mpu)
160 prcm_mpu_base = omap2_globals->prcm_mpu;
161
162 if (cpu_is_omap44xx() || soc_is_omap54xx()) {
163 omap_prm_base_init();
164 omap_cm_base_init();
165 }
166}
167
168/*
169 * Stubbed functions so that common files continue to build when
170 * custom builds are used
171 * XXX These are temporary and should be removed at the earliest possible
172 * opportunity
173 */
174int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
175 u16 clkctrl_offs)
176{
177 return 0;
178}
179
180void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
181 s16 cdoffs, u16 clkctrl_offs)
182{
183}
184
185void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
186 u16 clkctrl_offs)
187{
188}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index 928dbd4f20ed..c30e44a7fab0 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -20,6 +20,12 @@
20#include "prcm_mpu44xx.h" 20#include "prcm_mpu44xx.h"
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
23/*
24 * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
25 * block registers
26 */
27void __iomem *prcm_mpu_base;
28
23/* PRCM_MPU low-level functions */ 29/* PRCM_MPU low-level functions */
24 30
25u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
@@ -43,3 +49,14 @@ u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
43 49
44 return v; 50 return v;
45} 51}
52
53/**
54 * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
55 * @prcm_mpu: PRCM_MPU base virtual address
56 *
57 * XXX Will be replaced when the PRM/CM drivers are completed.
58 */
59void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
60{
61 prcm_mpu_base = prcm_mpu;
62}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 8a6e250f04b5..884af7bb4afd 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP44xx PRCM MPU instance offset macros 2 * OMAP44xx PRCM MPU instance offset macros
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley (paul@pwsan.com) 7 * Paul Walmsley (paul@pwsan.com)
@@ -25,6 +25,12 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "common.h"
29
30# ifndef __ASSEMBLER__
31extern void __iomem *prcm_mpu_base;
32# endif
33
28#define OMAP4430_PRCM_MPU_BASE 0x48243000 34#define OMAP4430_PRCM_MPU_BASE 0x48243000
29 35
30#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \ 36#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \
@@ -98,6 +104,7 @@ extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
98extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx); 104extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
99extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, 105extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
100 s16 idx); 106 s16 idx);
107extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
101# endif 108# endif
102 109
103#endif 110#endif
diff --git a/arch/arm/mach-omap2/prm-regbits-24xx.h b/arch/arm/mach-omap2/prm-regbits-24xx.h
index 6ac966103f34..91aa5106d637 100644
--- a/arch/arm/mach-omap2/prm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-24xx.h
@@ -14,7 +14,7 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm2xxx.h"
18 18
19/* Bits shared between registers */ 19/* Bits shared between registers */
20 20
@@ -107,12 +107,14 @@
107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15) 107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15)
108#define OMAP2420_CLKOUT2_DIV_SHIFT 11 108#define OMAP2420_CLKOUT2_DIV_SHIFT 11
109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11) 109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11)
110#define OMAP2420_CLKOUT2_DIV_WIDTH 3
110#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8 111#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8
111#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8) 112#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8)
112#define OMAP24XX_CLKOUT_EN_SHIFT 7 113#define OMAP24XX_CLKOUT_EN_SHIFT 7
113#define OMAP24XX_CLKOUT_EN_MASK (1 << 7) 114#define OMAP24XX_CLKOUT_EN_MASK (1 << 7)
114#define OMAP24XX_CLKOUT_DIV_SHIFT 3 115#define OMAP24XX_CLKOUT_DIV_SHIFT 3
115#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3) 116#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3)
117#define OMAP24XX_CLKOUT_DIV_WIDTH 3
116#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0 118#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0
117#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0) 119#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0)
118 120
@@ -209,9 +211,13 @@
209 211
210/* RM_RSTST_WKUP specific bits */ 212/* RM_RSTST_WKUP specific bits */
211/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ 213/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */
214#define OMAP24XX_EXTWMPU_RST_SHIFT 6
212#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6) 215#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6)
216#define OMAP24XX_SECU_WD_RST_SHIFT 5
213#define OMAP24XX_SECU_WD_RST_MASK (1 << 5) 217#define OMAP24XX_SECU_WD_RST_MASK (1 << 5)
218#define OMAP24XX_MPU_WD_RST_SHIFT 4
214#define OMAP24XX_MPU_WD_RST_MASK (1 << 4) 219#define OMAP24XX_MPU_WD_RST_MASK (1 << 4)
220#define OMAP24XX_SECU_VIOL_RST_SHIFT 3
215#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3) 221#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3)
216 222
217/* PM_WKEN_WKUP specific bits */ 223/* PM_WKEN_WKUP specific bits */
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 64c087af6a8b..b0a2142eeb91 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -14,7 +14,7 @@
14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H 14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H
15 15
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm3xxx.h"
18 18
19/* Shared register bits */ 19/* Shared register bits */
20 20
@@ -384,6 +384,7 @@
384/* PRM_CLKSEL */ 384/* PRM_CLKSEL */
385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0 385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0
386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0) 386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0)
387#define OMAP3430_SYS_CLKIN_SEL_WIDTH 3
387 388
388/* PRM_CLKOUT_CTRL */ 389/* PRM_CLKOUT_CTRL */
389#define OMAP3430_CLKOUT_EN_MASK (1 << 7) 390#define OMAP3430_CLKOUT_EN_MASK (1 << 7)
@@ -509,15 +510,25 @@
509#define OMAP3430_RSTTIME1_MASK (0xff << 0) 510#define OMAP3430_RSTTIME1_MASK (0xff << 0)
510 511
511/* PRM_RSTST */ 512/* PRM_RSTST */
513#define OMAP3430_ICECRUSHER_RST_SHIFT 10
512#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10) 514#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10)
515#define OMAP3430_ICEPICK_RST_SHIFT 9
513#define OMAP3430_ICEPICK_RST_MASK (1 << 9) 516#define OMAP3430_ICEPICK_RST_MASK (1 << 9)
517#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT 8
514#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8) 518#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8)
519#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT 7
515#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7) 520#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7)
521#define OMAP3430_EXTERNAL_WARM_RST_SHIFT 6
516#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6) 522#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6)
523#define OMAP3430_SECURE_WD_RST_SHIFT 5
517#define OMAP3430_SECURE_WD_RST_MASK (1 << 5) 524#define OMAP3430_SECURE_WD_RST_MASK (1 << 5)
525#define OMAP3430_MPU_WD_RST_SHIFT 4
518#define OMAP3430_MPU_WD_RST_MASK (1 << 4) 526#define OMAP3430_MPU_WD_RST_MASK (1 << 4)
527#define OMAP3430_SECURITY_VIOL_RST_SHIFT 3
519#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3) 528#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3)
529#define OMAP3430_GLOBAL_SW_RST_SHIFT 1
520#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1) 530#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1)
531#define OMAP3430_GLOBAL_COLD_RST_SHIFT 0
521#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) 532#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0)
522 533
523/* PRM_VOLTCTRL */ 534/* PRM_VOLTCTRL */
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 39d562169d18..a1a266ce90da 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions 2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
@@ -15,6 +15,28 @@
15 15
16#include "prcm-common.h" 16#include "prcm-common.h"
17 17
18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base;
20extern void omap2_set_globals_prm(void __iomem *prm);
21# endif
22
23
24/*
25 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
26 * module to softreset
27 */
28#define MAX_MODULE_SOFTRESET_WAIT 10000
29
30/*
31 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
32 * submodule to exit hardreset
33 */
34#define MAX_MODULE_HARDRESET_WAIT 10000
35
36/*
37 * Register bitfields
38 */
39
18/* 40/*
19 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP 41 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
20 * 42 *
@@ -52,5 +74,58 @@
52#define OMAP_POWERSTATE_SHIFT 0 74#define OMAP_POWERSTATE_SHIFT 0
53#define OMAP_POWERSTATE_MASK (0x3 << 0) 75#define OMAP_POWERSTATE_MASK (0x3 << 0)
54 76
77/*
78 * Standardized OMAP reset source bits
79 *
80 * To the extent these happen to match the hardware register bit
81 * shifts, it's purely coincidental. Used by omap-wdt.c.
82 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever
83 * there are any bits remaining in the global PRM_RSTST register that
84 * haven't been identified, or when the PRM code for the current SoC
85 * doesn't know how to interpret the register.
86 */
87#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
88#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
89#define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2
90#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
91#define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4
92#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
93#define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6
94#define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7
95#define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8
96#define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9
97#define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10
98#define OMAP_C2C_RST_SRC_ID_SHIFT 11
99#define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12
100
101#ifndef __ASSEMBLER__
102
103/**
104 * struct prm_reset_src_map - map register bitshifts to standard bitshifts
105 * @reg_shift: bitshift in the PRM reset source register
106 * @std_shift: bitshift equivalent in the standard reset source list
107 *
108 * The fields are signed because -1 is used as a terminator.
109 */
110struct prm_reset_src_map {
111 s8 reg_shift;
112 s8 std_shift;
113};
114
115/**
116 * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations
117 * @read_reset_sources: ptr to the Soc PRM-specific get_reset_source impl
118 */
119struct prm_ll_data {
120 u32 (*read_reset_sources)(void);
121};
122
123extern int prm_register(struct prm_ll_data *pld);
124extern int prm_unregister(struct prm_ll_data *pld);
125
126extern u32 prm_read_reset_sources(void);
127
128#endif
129
55 130
56#endif 131#endif
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
new file mode 100644
index 000000000000..bf24fc47603b
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -0,0 +1,139 @@
1/*
2 * OMAP2xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "clockdomain.h"
27#include "prm2xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30
31/*
32 * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP
33 * hardware register (which are specific to the OMAP2xxx SoCs) to
34 * reset source ID bit shifts (which is an OMAP SoC-independent
35 * enumeration)
36 */
37static struct prm_reset_src_map omap2xxx_prm_reset_src_map[] = {
38 { OMAP_GLOBALCOLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
39 { OMAP_GLOBALWARM_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
40 { OMAP24XX_SECU_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
41 { OMAP24XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
42 { OMAP24XX_SECU_WD_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
43 { OMAP24XX_EXTWMPU_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
44 { -1, -1 },
45};
46
47/**
48 * omap2xxx_prm_read_reset_sources - return the last SoC reset source
49 *
50 * Return a u32 representing the last reset sources of the SoC. The
51 * returned reset source bits are standardized across OMAP SoCs.
52 */
53static u32 omap2xxx_prm_read_reset_sources(void)
54{
55 struct prm_reset_src_map *p;
56 u32 r = 0;
57 u32 v;
58
59 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
60
61 p = omap2xxx_prm_reset_src_map;
62 while (p->reg_shift >= 0 && p->std_shift >= 0) {
63 if (v & (1 << p->reg_shift))
64 r |= 1 << p->std_shift;
65 p++;
66 }
67
68 return r;
69}
70
71/**
72 * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC
73 *
74 * Set the DPLL reset bit, which should reboot the SoC. This is the
75 * recommended way to restart the SoC. No return value.
76 */
77void omap2xxx_prm_dpll_reset(void)
78{
79 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
80 OMAP2_RM_RSTCTRL);
81 /* OCP barrier */
82 omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL);
83}
84
85int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
86{
87 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
88 clkdm->pwrdm.ptr->prcm_offs,
89 OMAP2_PM_PWSTCTRL);
90 return 0;
91}
92
93int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm)
94{
95 omap2_prm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
96 clkdm->pwrdm.ptr->prcm_offs,
97 OMAP2_PM_PWSTCTRL);
98 return 0;
99}
100
101struct pwrdm_ops omap2_pwrdm_operations = {
102 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
103 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
104 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
105 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
106 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
107 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
108 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
109 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
110 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
111};
112
113/*
114 *
115 */
116
117static struct prm_ll_data omap2xxx_prm_ll_data = {
118 .read_reset_sources = &omap2xxx_prm_read_reset_sources,
119};
120
121static int __init omap2xxx_prm_init(void)
122{
123 if (!cpu_is_omap24xx())
124 return 0;
125
126 return prm_register(&omap2xxx_prm_ll_data);
127}
128subsys_initcall(omap2xxx_prm_init);
129
130static void __exit omap2xxx_prm_exit(void)
131{
132 if (!cpu_is_omap24xx())
133 return;
134
135 /* Should never happen */
136 WARN(prm_unregister(&omap2xxx_prm_ll_data),
137 "%s: prm_ll_data function pointer mismatch\n", __func__);
138}
139__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
new file mode 100644
index 000000000000..fe8a14f190ab
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -0,0 +1,134 @@
1/*
2 * OMAP2xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
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 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP2420_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
25#define OMAP2430_PRM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
27
28/*
29 * OMAP2-specific global PRM registers
30 * Use __raw_{read,write}l() with these registers.
31 *
32 * With a few exceptions, these are the register names beginning with
33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
34 * bits.)
35 *
36 */
37
38#define OMAP2_PRCM_REVISION_OFFSET 0x0000
39#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
40#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
41#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
42
43#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
44#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
45#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
46#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
47
48#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
49#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
50#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
51#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
52#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
53#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
54#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
55#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
56#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
57#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
58#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
59#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
60#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
61#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
62#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
63#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
64#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
65#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
66#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
67#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
68
69#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
70#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
71
72#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
73#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
74
75#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
76#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
77#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
78#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
79#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
80#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
81#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
82#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
83#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
84#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
85
86/*
87 * Module specific PRM register offsets from PRM_BASE + domain offset
88 *
89 * Use prm_{read,write}_mod_reg() with these registers.
90 *
91 * With a few exceptions, these are the register names beginning with
92 * {PM,RM}_* on both OMAP2/3 SoC families.. (The exceptions are the
93 * IRQSTATUS and IRQENABLE bits.)
94 */
95
96/* Register offsets appearing on both OMAP2 and OMAP3 */
97
98#define OMAP2_RM_RSTCTRL 0x0050
99#define OMAP2_RM_RSTTIME 0x0054
100#define OMAP2_RM_RSTST 0x0058
101#define OMAP2_PM_PWSTCTRL 0x00e0
102#define OMAP2_PM_PWSTST 0x00e4
103
104#define PM_WKEN 0x00a0
105#define PM_WKEN1 PM_WKEN
106#define PM_WKST 0x00b0
107#define PM_WKST1 PM_WKST
108#define PM_WKDEP 0x00c8
109#define PM_EVGENCTRL 0x00d4
110#define PM_EVGENONTIM 0x00d8
111#define PM_EVGENOFFTIM 0x00dc
112
113/* OMAP2xxx specific register offsets */
114#define OMAP24XX_PM_WKEN2 0x00a4
115#define OMAP24XX_PM_WKST2 0x00b4
116
117#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
118#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
119#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
120#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
121
122#ifndef __ASSEMBLER__
123/* Function prototypes */
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126
127extern void omap2xxx_prm_dpll_reset(void);
128
129extern int __init prm2xxx_init(void);
130extern int __exit prm2xxx_exit(void);
131
132#endif
133
134#endif
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 9529984d8d2b..30517f5af707 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -15,82 +15,12 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irq.h>
19 18
20#include <plat/prcm.h>
21
22#include "soc.h"
23#include "common.h" 19#include "common.h"
24#include "vp.h" 20#include "powerdomain.h"
25
26#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
27#include "cm2xxx_3xxx.h"
28#include "prm-regbits-24xx.h" 22#include "prm-regbits-24xx.h"
29#include "prm-regbits-34xx.h" 23#include "clockdomain.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
50{
51 return __raw_readl(prm_base + module + idx);
52}
53
54void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
55{
56 __raw_writel(val, prm_base + module + idx);
57}
58
59/* Read-modify-write a register in a PRM module. Caller must lock */
60u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
61{
62 u32 v;
63
64 v = omap2_prm_read_mod_reg(module, idx);
65 v &= ~mask;
66 v |= bits;
67 omap2_prm_write_mod_reg(v, module, idx);
68
69 return v;
70}
71
72/* Read a PRM register, AND it, and shift the result down to bit 0 */
73u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
74{
75 u32 v;
76
77 v = omap2_prm_read_mod_reg(domain, idx);
78 v &= mask;
79 v >>= __ffs(mask);
80
81 return v;
82}
83
84u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
85{
86 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
87}
88
89u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
90{
91 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
92}
93
94 24
95/** 25/**
96 * omap2_prm_is_hardreset_asserted - read the HW reset line state of 26 * omap2_prm_is_hardreset_asserted - read the HW reset line state of
@@ -104,9 +34,6 @@ u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
104 */ 34 */
105int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 35int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
106{ 36{
107 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
108 return -EINVAL;
109
110 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, 37 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
111 (1 << shift)); 38 (1 << shift));
112} 39}
@@ -127,9 +54,6 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
127{ 54{
128 u32 mask; 55 u32 mask;
129 56
130 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
131 return -EINVAL;
132
133 mask = 1 << shift; 57 mask = 1 << shift;
134 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL); 58 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
135 59
@@ -156,9 +80,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
156 u32 rst, st; 80 u32 rst, st;
157 int c; 81 int c;
158 82
159 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
160 return -EINVAL;
161
162 rst = 1 << rst_shift; 83 rst = 1 << rst_shift;
163 st = 1 << st_shift; 84 st = 1 << st_shift;
164 85
@@ -178,188 +99,155 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
178 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 99 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
179} 100}
180 101
181/* PRM VP */
182
183/*
184 * struct omap3_vp - OMAP3 VP register access description.
185 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
186 */
187struct omap3_vp {
188 u32 tranxdone_status;
189};
190
191static struct omap3_vp omap3_vp[] = {
192 [OMAP3_VP_VDD_MPU_ID] = {
193 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
194 },
195 [OMAP3_VP_VDD_CORE_ID] = {
196 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
197 },
198};
199
200#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
201
202u32 omap3_prm_vp_check_txdone(u8 vp_id)
203{
204 struct omap3_vp *vp = &omap3_vp[vp_id];
205 u32 irqstatus;
206 102
207 irqstatus = omap2_prm_read_mod_reg(OCP_MOD, 103/* Powerdomain low-level functions */
208 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
209 return irqstatus & vp->tranxdone_status;
210}
211 104
212void omap3_prm_vp_clear_txdone(u8 vp_id) 105/* Common functions across OMAP2 and OMAP3 */
106int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
213{ 107{
214 struct omap3_vp *vp = &omap3_vp[vp_id]; 108 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
215 109 (pwrst << OMAP_POWERSTATE_SHIFT),
216 omap2_prm_write_mod_reg(vp->tranxdone_status, 110 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
217 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 111 return 0;
218} 112}
219 113
220u32 omap3_prm_vcvp_read(u8 offset) 114int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
221{ 115{
222 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset); 116 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
117 OMAP2_PM_PWSTCTRL,
118 OMAP_POWERSTATE_MASK);
223} 119}
224 120
225void omap3_prm_vcvp_write(u32 val, u8 offset) 121int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
226{ 122{
227 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset); 123 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
124 OMAP2_PM_PWSTST,
125 OMAP_POWERSTATEST_MASK);
228} 126}
229 127
230u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) 128int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
129 u8 pwrst)
231{ 130{
232 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset); 131 u32 m;
132
133 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
134
135 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
136 OMAP2_PM_PWSTCTRL);
137
138 return 0;
233} 139}
234 140
235/** 141int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
236 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events 142 u8 pwrst)
237 * @events: ptr to a u32, preallocated by caller
238 *
239 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
240 * MPU IRQs, and store the result into the u32 pointed to by @events.
241 * No return value.
242 */
243void omap3xxx_prm_read_pending_irqs(unsigned long *events)
244{ 143{
245 u32 mask, st; 144 u32 m;
145
146 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
246 147
247 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */ 148 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
248 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 149 OMAP2_PM_PWSTCTRL);
249 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
250 150
251 events[0] = mask & st; 151 return 0;
252} 152}
253 153
254/** 154int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
255 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
256 *
257 * Force any buffered writes to the PRM IP block to complete. Needed
258 * by the PRM IRQ handler, which reads and writes directly to the IP
259 * block, to avoid race conditions after acknowledging or clearing IRQ
260 * bits. No return value.
261 */
262void omap3xxx_prm_ocp_barrier(void)
263{ 155{
264 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 156 u32 m;
157
158 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
159
160 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
161 m);
265} 162}
266 163
267/** 164int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
268 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
269 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
270 *
271 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
272 * must be allocated by the caller. Intended to be used in the PRM
273 * interrupt handler suspend callback. The OCP barrier is needed to
274 * ensure the write to disable PRM interrupts reaches the PRM before
275 * returning; otherwise, spurious interrupts might occur. No return
276 * value.
277 */
278void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
279{ 165{
280 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, 166 u32 m;
281 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 167
282 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 168 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
283 169
284 /* OCP barrier */ 170 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 171 OMAP2_PM_PWSTCTRL, m);
286} 172}
287 173
288/** 174int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
289 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
290 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
291 *
292 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
293 * to be used in the PRM interrupt handler resume callback to restore
294 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
295 * barrier should be needed here; any pending PRM interrupts will fire
296 * once the writes reach the PRM. No return value.
297 */
298void omap3xxx_prm_restore_irqen(u32 *saved_mask)
299{ 175{
300 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, 176 u32 v;
301 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 177
178 v = pwrst << __ffs(OMAP_LOGICRETSTATE_MASK);
179 omap2_prm_rmw_mod_reg_bits(OMAP_LOGICRETSTATE_MASK, v, pwrdm->prcm_offs,
180 OMAP2_PM_PWSTCTRL);
181
182 return 0;
302} 183}
303 184
304/** 185int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
305 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
306 *
307 * Clear any previously-latched I/O wakeup events and ensure that the
308 * I/O wakeup gates are aligned with the current mux settings. Works
309 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
310 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
311 * return value.
312 */
313void omap3xxx_prm_reconfigure_io_chain(void)
314{ 186{
315 int i = 0; 187 u32 c = 0;
316 188
317 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 189 /*
318 PM_WKEN); 190 * REVISIT: pwrdm_wait_transition() may be better implemented
191 * via a callback and a periodic timer check -- how long do we expect
192 * powerdomain transitions to take?
193 */
319 194
320 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) & 195 /* XXX Is this udelay() value meaningful? */
321 OMAP3430_ST_IO_CHAIN_MASK, 196 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
322 MAX_IOPAD_LATCH_TIME, i); 197 OMAP_INTRANSITION_MASK) &&
323 if (i == MAX_IOPAD_LATCH_TIME) 198 (c++ < PWRDM_TRANSITION_BAILOUT))
324 pr_warn("PRM: I/O chain clock line assertion timed out\n"); 199 udelay(1);
325 200
326 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 201 if (c > PWRDM_TRANSITION_BAILOUT) {
327 PM_WKEN); 202 pr_err("powerdomain: %s: waited too long to complete transition\n",
203 pwrdm->name);
204 return -EAGAIN;
205 }
328 206
329 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD, 207 pr_debug("powerdomain: completed transition in %d loops\n", c);
330 PM_WKST);
331 208
332 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST); 209 return 0;
333} 210}
334 211
335/** 212int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
336 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches 213 struct clockdomain *clkdm2)
337 * 214{
338 * Activates the I/O wakeup event latches and allows events logged by 215 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
339 * those latches to signal a wakeup event to the PRCM. For I/O 216 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
340 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux 217 return 0;
341 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. 218}
342 * No return value. 219
343 */ 220int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
344static void __init omap3xxx_prm_enable_io_wakeup(void) 221 struct clockdomain *clkdm2)
222{
223 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
224 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
225 return 0;
226}
227
228int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
229 struct clockdomain *clkdm2)
345{ 230{
346 if (omap3_has_io_wakeup()) 231 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
347 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 232 PM_WKDEP, (1 << clkdm2->dep_bit));
348 PM_WKEN);
349} 233}
350 234
351static int __init omap3xxx_prcm_init(void) 235int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
352{ 236{
353 int ret = 0; 237 struct clkdm_dep *cd;
354 238 u32 mask = 0;
355 if (cpu_is_omap34xx()) { 239
356 omap3xxx_prm_enable_io_wakeup(); 240 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
357 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 241 if (!cd->clkdm)
358 if (!ret) 242 continue; /* only happens if data is erroneous */
359 irq_set_status_flags(omap_prcm_event_to_irq("io"), 243
360 IRQ_NOAUTOEN); 244 /* PRM accesses are slow, so minimize them */
245 mask |= 1 << cd->clkdm->dep_bit;
246 atomic_set(&cd->wkdep_usecount, 0);
361 } 247 }
362 248
363 return ret; 249 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
250 PM_WKDEP);
251 return 0;
364} 252}
365subsys_initcall(omap3xxx_prcm_init); 253
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index c19d249b4816..9624b40836d4 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 Power/Reset Management (PRM) register definitions 2 * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions
3 * 3 *
4 * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
@@ -19,160 +19,6 @@
19#include "prcm-common.h" 19#include "prcm-common.h"
20#include "prm.h" 20#include "prm.h"
21 21
22#define OMAP2420_PRM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
24#define OMAP2430_PRM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
26#define OMAP34XX_PRM_REGADDR(module, reg) \
27 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
28
29
30/*
31 * OMAP2-specific global PRM registers
32 * Use __raw_{read,write}l() with these registers.
33 *
34 * With a few exceptions, these are the register names beginning with
35 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
36 * bits.)
37 *
38 */
39
40#define OMAP2_PRCM_REVISION_OFFSET 0x0000
41#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
42#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
43#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
44
45#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
46#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
47#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
48#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
49
50#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
51#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
52#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
53#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
54#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
55#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
56#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
57#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
58#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
59#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
60#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
61#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
62#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
63#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
64#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
65#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
66#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
67#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
68#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
69#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
70
71#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
72#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
73
74#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
75#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
76
77#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
78#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
79#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
80#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
81#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
82#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
83#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
84#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
85#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
86#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
87
88/*
89 * OMAP3-specific global PRM registers
90 * Use __raw_{read,write}l() with these registers.
91 *
92 * With a few exceptions, these are the register names beginning with
93 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
94 * bits.)
95 */
96
97#define OMAP3_PRM_REVISION_OFFSET 0x0004
98#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
99#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
100#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
101
102#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
103#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
104#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
105#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
106
107
108#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
109#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
110#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
111#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
112#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
113#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
114#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
115#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
116#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
117#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
118#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
119#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
120#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
121#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
122#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
123#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
124#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
125#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
126#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
127#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
128#define OMAP3_PRM_RSTST_OFFSET 0x0058
129#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
130#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
131#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
132#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
133#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
134#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
135#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
136#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
137#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
138#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
139#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
140#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
141#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
142#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
143#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
144#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
145#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
146#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
147#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
148#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
149#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
150#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
151#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
152#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
153#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
154#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
155#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
156#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
157#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
158#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
159#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
160#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
161#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
162#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
163#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
164#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
165#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
166#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
167#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
168#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
169#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
170
171#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
172#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
173#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
174#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
175
176/* 22/*
177 * Module specific PRM register offsets from PRM_BASE + domain offset 23 * Module specific PRM register offsets from PRM_BASE + domain offset
178 * 24 *
@@ -200,66 +46,83 @@
200#define PM_EVGENONTIM 0x00d8 46#define PM_EVGENONTIM 0x00d8
201#define PM_EVGENOFFTIM 0x00dc 47#define PM_EVGENOFFTIM 0x00dc
202 48
203/* OMAP2xxx specific register offsets */
204#define OMAP24XX_PM_WKEN2 0x00a4
205#define OMAP24XX_PM_WKST2 0x00b4
206
207#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
208#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
209#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
210#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
211 49
212/* OMAP3 specific register offsets */ 50#ifndef __ASSEMBLER__
213#define OMAP3430ES2_PM_WKEN3 0x00f0
214#define OMAP3430ES2_PM_WKST3 0x00b8
215
216#define OMAP3430_PM_MPUGRPSEL 0x00a4
217#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
218#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
219
220#define OMAP3430_PM_IVAGRPSEL 0x00a8
221#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
222#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
223
224#define OMAP3430_PM_PREPWSTST 0x00e8
225
226#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
227#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
228 51
52#include <linux/io.h>
53#include "powerdomain.h"
229 54
230#ifndef __ASSEMBLER__
231/* Power/reset management domain register get/set */ 55/* Power/reset management domain register get/set */
232extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx); 56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
233extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx); 57{
234extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 58 return __raw_readl(prm_base + module + idx);
235extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 59}
236extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx); 60
237extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask); 61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{
63 __raw_writel(val, prm_base + module + idx);
64}
65
66/* Read-modify-write a register in a PRM module. Caller must lock */
67static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
68 s16 idx)
69{
70 u32 v;
71
72 v = omap2_prm_read_mod_reg(module, idx);
73 v &= ~mask;
74 v |= bits;
75 omap2_prm_write_mod_reg(v, module, idx);
76
77 return v;
78}
79
80/* Read a PRM register, AND it, and shift the result down to bit 0 */
81static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
82{
83 u32 v;
84
85 v = omap2_prm_read_mod_reg(domain, idx);
86 v &= mask;
87 v >>= __ffs(mask);
88
89 return v;
90}
91
92static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
93{
94 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
95}
96
97static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
98{
99 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
100}
238 101
239/* These omap2_ PRM functions apply to both OMAP2 and 3 */ 102/* These omap2_ PRM functions apply to both OMAP2 and 3 */
240extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
241extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 104extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
242extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 105extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
243 106
244/* OMAP3-specific VP functions */ 107extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
245u32 omap3_prm_vp_check_txdone(u8 vp_id); 108extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
246void omap3_prm_vp_clear_txdone(u8 vp_id); 109extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
247 110extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
248/* 111 u8 pwrst);
249 * OMAP3 access functions for voltage controller (VC) and 112extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
250 * voltage proccessor (VP) in the PRM. 113 u8 pwrst);
251 */ 114extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
252extern u32 omap3_prm_vcvp_read(u8 offset); 115extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
253extern void omap3_prm_vcvp_write(u32 val, u8 offset); 116extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
254extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 117extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
255 118
256extern void omap3xxx_prm_reconfigure_io_chain(void); 119extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
257 120 struct clockdomain *clkdm2);
258/* PRM interrupt-related functions */ 121extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
259extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); 122 struct clockdomain *clkdm2);
260extern void omap3xxx_prm_ocp_barrier(void); 123extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
261extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); 124 struct clockdomain *clkdm2);
262extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); 125extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
263 126
264#endif /* __ASSEMBLER */ 127#endif /* __ASSEMBLER */
265 128
@@ -289,6 +152,7 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
289/* Named PRCM_CLKSRC_CTRL on the 24XX */ 152/* Named PRCM_CLKSRC_CTRL on the 24XX */
290#define OMAP_SYSCLKDIV_SHIFT 6 153#define OMAP_SYSCLKDIV_SHIFT 6
291#define OMAP_SYSCLKDIV_MASK (0x3 << 6) 154#define OMAP_SYSCLKDIV_MASK (0x3 << 6)
155#define OMAP_SYSCLKDIV_WIDTH 2
292#define OMAP_AUTOEXTCLKMODE_SHIFT 3 156#define OMAP_AUTOEXTCLKMODE_SHIFT 3
293#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3) 157#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
294#define OMAP_SYSCLKSEL_SHIFT 0 158#define OMAP_SYSCLKSEL_SHIFT 0
@@ -348,7 +212,9 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
348 * 212 *
349 * 3430: RM_RSTST_CORE, RM_RSTST_EMU 213 * 3430: RM_RSTST_CORE, RM_RSTST_EMU
350 */ 214 */
215#define OMAP_GLOBALWARM_RST_SHIFT 1
351#define OMAP_GLOBALWARM_RST_MASK (1 << 1) 216#define OMAP_GLOBALWARM_RST_MASK (1 << 1)
217#define OMAP_GLOBALCOLD_RST_SHIFT 0
352#define OMAP_GLOBALCOLD_RST_MASK (1 << 0) 218#define OMAP_GLOBALCOLD_RST_MASK (1 << 0)
353 219
354/* 220/*
@@ -376,11 +242,4 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
376#define OMAP_LOGICRETSTATE_MASK (1 << 2) 242#define OMAP_LOGICRETSTATE_MASK (1 << 2)
377 243
378 244
379/*
380 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
381 * submodule to exit hardreset
382 */
383#define MAX_MODULE_HARDRESET_WAIT 10000
384
385
386#endif 245#endif
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index e7dbb6cf1255..53ec9cbaa3d3 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,9 +19,10 @@
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 "powerdomain.h"
25#include "prm33xx.h" 26#include "prm33xx.h"
26#include "prm-regbits-33xx.h" 27#include "prm-regbits-33xx.h"
27 28
@@ -133,3 +134,204 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
133 134
134 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 135 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
135} 136}
137
138static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
139{
140 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
141 (pwrst << OMAP_POWERSTATE_SHIFT),
142 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
143 return 0;
144}
145
146static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
147{
148 u32 v;
149
150 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
151 v &= OMAP_POWERSTATE_MASK;
152 v >>= OMAP_POWERSTATE_SHIFT;
153
154 return v;
155}
156
157static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
158{
159 u32 v;
160
161 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
162 v &= OMAP_POWERSTATEST_MASK;
163 v >>= OMAP_POWERSTATEST_SHIFT;
164
165 return v;
166}
167
168static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
169{
170 u32 v;
171
172 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
173 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
174 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
175
176 return v;
177}
178
179static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
180{
181 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
182 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
183 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
184 return 0;
185}
186
187static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
188{
189 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
190 AM33XX_LASTPOWERSTATEENTERED_MASK,
191 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
192 return 0;
193}
194
195static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
196{
197 u32 m;
198
199 m = pwrdm->logicretstate_mask;
200 if (!m)
201 return -EINVAL;
202
203 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
204 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
205
206 return 0;
207}
208
209static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
210{
211 u32 v;
212
213 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
214 v &= AM33XX_LOGICSTATEST_MASK;
215 v >>= AM33XX_LOGICSTATEST_SHIFT;
216
217 return v;
218}
219
220static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
221{
222 u32 v, m;
223
224 m = pwrdm->logicretstate_mask;
225 if (!m)
226 return -EINVAL;
227
228 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
229 v &= m;
230 v >>= __ffs(m);
231
232 return v;
233}
234
235static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
236 u8 pwrst)
237{
238 u32 m;
239
240 m = pwrdm->mem_on_mask[bank];
241 if (!m)
242 return -EINVAL;
243
244 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
245 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
246
247 return 0;
248}
249
250static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
251 u8 pwrst)
252{
253 u32 m;
254
255 m = pwrdm->mem_ret_mask[bank];
256 if (!m)
257 return -EINVAL;
258
259 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
260 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
261
262 return 0;
263}
264
265static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
266{
267 u32 m, v;
268
269 m = pwrdm->mem_pwrst_mask[bank];
270 if (!m)
271 return -EINVAL;
272
273 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
274 v &= m;
275 v >>= __ffs(m);
276
277 return v;
278}
279
280static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
281{
282 u32 m, v;
283
284 m = pwrdm->mem_retst_mask[bank];
285 if (!m)
286 return -EINVAL;
287
288 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
289 v &= m;
290 v >>= __ffs(m);
291
292 return v;
293}
294
295static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
296{
297 u32 c = 0;
298
299 /*
300 * REVISIT: pwrdm_wait_transition() may be better implemented
301 * via a callback and a periodic timer check -- how long do we expect
302 * powerdomain transitions to take?
303 */
304
305 /* XXX Is this udelay() value meaningful? */
306 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
307 & OMAP_INTRANSITION_MASK) &&
308 (c++ < PWRDM_TRANSITION_BAILOUT))
309 udelay(1);
310
311 if (c > PWRDM_TRANSITION_BAILOUT) {
312 pr_err("powerdomain: %s: waited too long to complete transition\n",
313 pwrdm->name);
314 return -EAGAIN;
315 }
316
317 pr_debug("powerdomain: completed transition in %d loops\n", c);
318
319 return 0;
320}
321
322struct pwrdm_ops am33xx_pwrdm_operations = {
323 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
324 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
325 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
326 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
327 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
328 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
329 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
330 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
331 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
332 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
333 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
334 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
335 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
336 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
337};
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
new file mode 100644
index 000000000000..b86116cf0db9
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -0,0 +1,417 @@
1/*
2 * OMAP3xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "prm3xxx.h"
27#include "prm2xxx_3xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-34xx.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49/*
50 * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware
51 * register (which are specific to OMAP3xxx SoCs) to reset source ID
52 * bit shifts (which is an OMAP SoC-independent enumeration)
53 */
54static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = {
55 { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
56 { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
57 { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
58 { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
59 { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
60 { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
61 { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT,
62 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
63 { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT,
64 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
65 { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
66 { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT },
67 { -1, -1 },
68};
69
70/* PRM VP */
71
72/*
73 * struct omap3_vp - OMAP3 VP register access description.
74 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
75 */
76struct omap3_vp {
77 u32 tranxdone_status;
78};
79
80static struct omap3_vp omap3_vp[] = {
81 [OMAP3_VP_VDD_MPU_ID] = {
82 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
83 },
84 [OMAP3_VP_VDD_CORE_ID] = {
85 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
86 },
87};
88
89#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
90
91u32 omap3_prm_vp_check_txdone(u8 vp_id)
92{
93 struct omap3_vp *vp = &omap3_vp[vp_id];
94 u32 irqstatus;
95
96 irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
97 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
98 return irqstatus & vp->tranxdone_status;
99}
100
101void omap3_prm_vp_clear_txdone(u8 vp_id)
102{
103 struct omap3_vp *vp = &omap3_vp[vp_id];
104
105 omap2_prm_write_mod_reg(vp->tranxdone_status,
106 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
107}
108
109u32 omap3_prm_vcvp_read(u8 offset)
110{
111 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
112}
113
114void omap3_prm_vcvp_write(u32 val, u8 offset)
115{
116 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
117}
118
119u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
120{
121 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
122}
123
124/**
125 * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC
126 *
127 * Set the DPLL3 reset bit, which should reboot the SoC. This is the
128 * recommended way to restart the SoC, considering Errata i520. No
129 * return value.
130 */
131void omap3xxx_prm_dpll3_reset(void)
132{
133 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
134 OMAP2_RM_RSTCTRL);
135 /* OCP barrier */
136 omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL);
137}
138
139/**
140 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
141 * @events: ptr to a u32, preallocated by caller
142 *
143 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
144 * MPU IRQs, and store the result into the u32 pointed to by @events.
145 * No return value.
146 */
147void omap3xxx_prm_read_pending_irqs(unsigned long *events)
148{
149 u32 mask, st;
150
151 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */
152 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
153 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
154
155 events[0] = mask & st;
156}
157
158/**
159 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
160 *
161 * Force any buffered writes to the PRM IP block to complete. Needed
162 * by the PRM IRQ handler, which reads and writes directly to the IP
163 * block, to avoid race conditions after acknowledging or clearing IRQ
164 * bits. No return value.
165 */
166void omap3xxx_prm_ocp_barrier(void)
167{
168 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
169}
170
171/**
172 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
173 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
174 *
175 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
176 * must be allocated by the caller. Intended to be used in the PRM
177 * interrupt handler suspend callback. The OCP barrier is needed to
178 * ensure the write to disable PRM interrupts reaches the PRM before
179 * returning; otherwise, spurious interrupts might occur. No return
180 * value.
181 */
182void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
183{
184 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
185 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
186 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
187
188 /* OCP barrier */
189 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
190}
191
192/**
193 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
194 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
195 *
196 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
197 * to be used in the PRM interrupt handler resume callback to restore
198 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
199 * barrier should be needed here; any pending PRM interrupts will fire
200 * once the writes reach the PRM. No return value.
201 */
202void omap3xxx_prm_restore_irqen(u32 *saved_mask)
203{
204 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
205 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
206}
207
208/**
209 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
210 *
211 * Clear any previously-latched I/O wakeup events and ensure that the
212 * I/O wakeup gates are aligned with the current mux settings. Works
213 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
214 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
215 * return value.
216 */
217void omap3xxx_prm_reconfigure_io_chain(void)
218{
219 int i = 0;
220
221 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
222 PM_WKEN);
223
224 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
225 OMAP3430_ST_IO_CHAIN_MASK,
226 MAX_IOPAD_LATCH_TIME, i);
227 if (i == MAX_IOPAD_LATCH_TIME)
228 pr_warn("PRM: I/O chain clock line assertion timed out\n");
229
230 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
231 PM_WKEN);
232
233 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
234 PM_WKST);
235
236 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
237}
238
239/**
240 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
241 *
242 * Activates the I/O wakeup event latches and allows events logged by
243 * those latches to signal a wakeup event to the PRCM. For I/O
244 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
245 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
246 * No return value.
247 */
248static void __init omap3xxx_prm_enable_io_wakeup(void)
249{
250 if (omap3_has_io_wakeup())
251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
252 PM_WKEN);
253}
254
255/**
256 * omap3xxx_prm_read_reset_sources - return the last SoC reset source
257 *
258 * Return a u32 representing the last reset sources of the SoC. The
259 * returned reset source bits are standardized across OMAP SoCs.
260 */
261static u32 omap3xxx_prm_read_reset_sources(void)
262{
263 struct prm_reset_src_map *p;
264 u32 r = 0;
265 u32 v;
266
267 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
268
269 p = omap3xxx_prm_reset_src_map;
270 while (p->reg_shift >= 0 && p->std_shift >= 0) {
271 if (v & (1 << p->reg_shift))
272 r |= 1 << p->std_shift;
273 p++;
274 }
275
276 return r;
277}
278
279/* Powerdomain low-level functions */
280
281/* Applicable only for OMAP3. Not supported on OMAP2 */
282static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
283{
284 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 OMAP3430_PM_PREPWSTST,
286 OMAP3430_LASTPOWERSTATEENTERED_MASK);
287}
288
289static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
290{
291 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
292 OMAP2_PM_PWSTST,
293 OMAP3430_LOGICSTATEST_MASK);
294}
295
296static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
297{
298 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
299 OMAP2_PM_PWSTCTRL,
300 OMAP3430_LOGICSTATEST_MASK);
301}
302
303static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
304{
305 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
306 OMAP3430_PM_PREPWSTST,
307 OMAP3430_LASTLOGICSTATEENTERED_MASK);
308}
309
310static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
311{
312 switch (bank) {
313 case 0:
314 return OMAP3430_LASTMEM1STATEENTERED_MASK;
315 case 1:
316 return OMAP3430_LASTMEM2STATEENTERED_MASK;
317 case 2:
318 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
319 case 3:
320 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
321 default:
322 WARN_ON(1); /* should never happen */
323 return -EEXIST;
324 }
325 return 0;
326}
327
328static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
329{
330 u32 m;
331
332 m = omap3_get_mem_bank_lastmemst_mask(bank);
333
334 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
335 OMAP3430_PM_PREPWSTST, m);
336}
337
338static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
339{
340 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
341 return 0;
342}
343
344static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
345{
346 return omap2_prm_rmw_mod_reg_bits(0,
347 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
348 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
349}
350
351static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
352{
353 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
354 0, pwrdm->prcm_offs,
355 OMAP2_PM_PWSTCTRL);
356}
357
358struct pwrdm_ops omap3_pwrdm_operations = {
359 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
360 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
361 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
362 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
363 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
364 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
365 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
366 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
367 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
368 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
369 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
370 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
371 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
372 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
373 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
374 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
375 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
376};
377
378/*
379 *
380 */
381
382static struct prm_ll_data omap3xxx_prm_ll_data = {
383 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
384};
385
386static int __init omap3xxx_prm_init(void)
387{
388 int ret;
389
390 if (!cpu_is_omap34xx())
391 return 0;
392
393 ret = prm_register(&omap3xxx_prm_ll_data);
394 if (ret)
395 return ret;
396
397 omap3xxx_prm_enable_io_wakeup();
398 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
399 if (!ret)
400 irq_set_status_flags(omap_prcm_event_to_irq("io"),
401 IRQ_NOAUTOEN);
402
403
404 return ret;
405}
406subsys_initcall(omap3xxx_prm_init);
407
408static void __exit omap3xxx_prm_exit(void)
409{
410 if (!cpu_is_omap34xx())
411 return;
412
413 /* Should never happen */
414 WARN(prm_unregister(&omap3xxx_prm_ll_data),
415 "%s: prm_ll_data function pointer mismatch\n", __func__);
416}
417__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
new file mode 100644
index 000000000000..10cd41a8129e
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -0,0 +1,162 @@
1/*
2 * OMAP3xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
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 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP34XX_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
25
26
27/*
28 * OMAP3-specific global PRM registers
29 * Use __raw_{read,write}l() with these registers.
30 *
31 * With a few exceptions, these are the register names beginning with
32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
33 * bits.)
34 */
35
36#define OMAP3_PRM_REVISION_OFFSET 0x0004
37#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
38#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
39#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
40
41#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
42#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
43#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
44#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
45
46
47#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
48#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
49#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
50#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
51#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
52#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
53#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
54#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
55#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
56#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
57#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
58#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
59#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
60#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
61#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
62#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
63#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
64#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
65#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
66#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
67#define OMAP3_PRM_RSTST_OFFSET 0x0058
68#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
69#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
70#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
71#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
72#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
73#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
74#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
75#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
76#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
77#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
78#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
79#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
80#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
81#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
82#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
83#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
84#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
85#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
86#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
87#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
88#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
89#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
90#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
91#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
92#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
93#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
94#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
95#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
96#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
97#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
98#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
99#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
100#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
101#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
102#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
103#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
104#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
105#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
106#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
107#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
108#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
109
110#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
111#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
112#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
113#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
114
115/* OMAP3 specific register offsets */
116#define OMAP3430ES2_PM_WKEN3 0x00f0
117#define OMAP3430ES2_PM_WKST3 0x00b8
118
119#define OMAP3430_PM_MPUGRPSEL 0x00a4
120#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
121#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
122
123#define OMAP3430_PM_IVAGRPSEL 0x00a8
124#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
125#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
126
127#define OMAP3430_PM_PREPWSTST 0x00e8
128
129#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
130#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
131
132
133#ifndef __ASSEMBLER__
134
135/* OMAP3-specific VP functions */
136u32 omap3_prm_vp_check_txdone(u8 vp_id);
137void omap3_prm_vp_clear_txdone(u8 vp_id);
138
139/*
140 * OMAP3 access functions for voltage controller (VC) and
141 * voltage proccessor (VP) in the PRM.
142 */
143extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146
147extern void omap3xxx_prm_reconfigure_io_chain(void);
148
149/* PRM interrupt-related functions */
150extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
151extern void omap3xxx_prm_ocp_barrier(void);
152extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
153extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
154
155extern void omap3xxx_prm_dpll3_reset(void);
156
157extern u32 omap3xxx_prm_get_reset_sources(void);
158
159#endif /* __ASSEMBLER */
160
161
162#endif
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index f0c4d5f4a174..6d3467af205d 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * OMAP4 PRM module functions 2 * OMAP4 PRM module functions
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson 6 * Benoît Cousson
7 * Paul Walmsley 7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify 10 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -17,7 +18,6 @@
17#include <linux/err.h> 18#include <linux/err.h>
18#include <linux/io.h> 19#include <linux/io.h>
19 20
20#include <plat/prcm.h>
21 21
22#include "soc.h" 22#include "soc.h"
23#include "iomap.h" 23#include "iomap.h"
@@ -27,6 +27,9 @@
27#include "prm-regbits-44xx.h" 27#include "prm-regbits-44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
29#include "prminst44xx.h" 29#include "prminst44xx.h"
30#include "powerdomain.h"
31
32/* Static data */
30 33
31static const struct omap_prcm_irq omap4_prcm_irqs[] = { 34static const struct omap_prcm_irq omap4_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0), 35 OMAP_PRCM_IRQ("wkup", 0, 0),
@@ -46,6 +49,33 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
46 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
47}; 50};
48 51
52/*
53 * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
54 * hardware register (which are specific to OMAP44xx SoCs) to reset
55 * source ID bit shifts (which is an OMAP SoC-independent
56 * enumeration)
57 */
58static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
59 { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT,
60 OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
61 { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT,
62 OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
63 { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
64 OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
65 { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
66 { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
67 { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
68 { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT,
69 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
70 { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT,
71 OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT },
72 { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT,
73 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
74 { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
75 { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT },
76 { -1, -1 },
77};
78
49/* PRM low-level functions */ 79/* PRM low-level functions */
50 80
51/* Read a register in a CM/PRM instance in the PRM module */ 81/* Read a register in a CM/PRM instance in the PRM module */
@@ -291,12 +321,324 @@ static void __init omap44xx_prm_enable_io_wakeup(void)
291 OMAP4_PRM_IO_PMCTRL_OFFSET); 321 OMAP4_PRM_IO_PMCTRL_OFFSET);
292} 322}
293 323
294static int __init omap4xxx_prcm_init(void) 324/**
325 * omap44xx_prm_read_reset_sources - return the last SoC reset source
326 *
327 * Return a u32 representing the last reset sources of the SoC. The
328 * returned reset source bits are standardized across OMAP SoCs.
329 */
330static u32 omap44xx_prm_read_reset_sources(void)
331{
332 struct prm_reset_src_map *p;
333 u32 r = 0;
334 u32 v;
335
336 v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
337 OMAP4_RM_RSTST);
338
339 p = omap44xx_prm_reset_src_map;
340 while (p->reg_shift >= 0 && p->std_shift >= 0) {
341 if (v & (1 << p->reg_shift))
342 r |= 1 << p->std_shift;
343 p++;
344 }
345
346 return r;
347}
348
349/* Powerdomain low-level functions */
350
351static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
352{
353 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
354 (pwrst << OMAP_POWERSTATE_SHIFT),
355 pwrdm->prcm_partition,
356 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
357 return 0;
358}
359
360static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
361{
362 u32 v;
363
364 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
365 OMAP4_PM_PWSTCTRL);
366 v &= OMAP_POWERSTATE_MASK;
367 v >>= OMAP_POWERSTATE_SHIFT;
368
369 return v;
370}
371
372static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
373{
374 u32 v;
375
376 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
377 OMAP4_PM_PWSTST);
378 v &= OMAP_POWERSTATEST_MASK;
379 v >>= OMAP_POWERSTATEST_SHIFT;
380
381 return v;
382}
383
384static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
385{
386 u32 v;
387
388 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
389 OMAP4_PM_PWSTST);
390 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
391 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
392
393 return v;
394}
395
396static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
397{
398 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
399 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
400 pwrdm->prcm_partition,
401 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
402 return 0;
403}
404
405static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
406{
407 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
408 OMAP4430_LASTPOWERSTATEENTERED_MASK,
409 pwrdm->prcm_partition,
410 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
411 return 0;
412}
413
414static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
415{
416 u32 v;
417
418 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
419 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
420 pwrdm->prcm_partition, pwrdm->prcm_offs,
421 OMAP4_PM_PWSTCTRL);
422
423 return 0;
424}
425
426static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
427 u8 pwrst)
428{
429 u32 m;
430
431 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
432
433 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
434 pwrdm->prcm_partition, pwrdm->prcm_offs,
435 OMAP4_PM_PWSTCTRL);
436
437 return 0;
438}
439
440static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
441 u8 pwrst)
442{
443 u32 m;
444
445 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
446
447 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
448 pwrdm->prcm_partition, pwrdm->prcm_offs,
449 OMAP4_PM_PWSTCTRL);
450
451 return 0;
452}
453
454static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
455{
456 u32 v;
457
458 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
459 OMAP4_PM_PWSTST);
460 v &= OMAP4430_LOGICSTATEST_MASK;
461 v >>= OMAP4430_LOGICSTATEST_SHIFT;
462
463 return v;
464}
465
466static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
295{ 467{
296 if (cpu_is_omap44xx()) { 468 u32 v;
297 omap44xx_prm_enable_io_wakeup(); 469
298 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 470 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
471 OMAP4_PM_PWSTCTRL);
472 v &= OMAP4430_LOGICRETSTATE_MASK;
473 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
474
475 return v;
476}
477
478/**
479 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
480 * @pwrdm: struct powerdomain * to read the state for
481 *
482 * Reads the previous logic powerstate for a powerdomain. This
483 * function must determine the previous logic powerstate by first
484 * checking the previous powerstate for the domain. If that was OFF,
485 * then logic has been lost. If previous state was RETENTION, the
486 * function reads the setting for the next retention logic state to
487 * see the actual value. In every other case, the logic is
488 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
489 * depending whether the logic was retained or not.
490 */
491static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
492{
493 int state;
494
495 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
496
497 if (state == PWRDM_POWER_OFF)
498 return PWRDM_POWER_OFF;
499
500 if (state != PWRDM_POWER_RET)
501 return PWRDM_POWER_RET;
502
503 return omap4_pwrdm_read_logic_retst(pwrdm);
504}
505
506static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
507{
508 u32 m, v;
509
510 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
511
512 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
513 OMAP4_PM_PWSTST);
514 v &= m;
515 v >>= __ffs(m);
516
517 return v;
518}
519
520static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
521{
522 u32 m, v;
523
524 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
525
526 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
527 OMAP4_PM_PWSTCTRL);
528 v &= m;
529 v >>= __ffs(m);
530
531 return v;
532}
533
534/**
535 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
536 * @pwrdm: struct powerdomain * to read mem powerstate for
537 * @bank: memory bank index
538 *
539 * Reads the previous memory powerstate for a powerdomain. This
540 * function must determine the previous memory powerstate by first
541 * checking the previous powerstate for the domain. If that was OFF,
542 * then logic has been lost. If previous state was RETENTION, the
543 * function reads the setting for the next memory retention state to
544 * see the actual value. In every other case, the logic is
545 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
546 * depending whether logic was retained or not.
547 */
548static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
549{
550 int state;
551
552 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
553
554 if (state == PWRDM_POWER_OFF)
555 return PWRDM_POWER_OFF;
556
557 if (state != PWRDM_POWER_RET)
558 return PWRDM_POWER_RET;
559
560 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
561}
562
563static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
564{
565 u32 c = 0;
566
567 /*
568 * REVISIT: pwrdm_wait_transition() may be better implemented
569 * via a callback and a periodic timer check -- how long do we expect
570 * powerdomain transitions to take?
571 */
572
573 /* XXX Is this udelay() value meaningful? */
574 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
575 pwrdm->prcm_offs,
576 OMAP4_PM_PWSTST) &
577 OMAP_INTRANSITION_MASK) &&
578 (c++ < PWRDM_TRANSITION_BAILOUT))
579 udelay(1);
580
581 if (c > PWRDM_TRANSITION_BAILOUT) {
582 pr_err("powerdomain: %s: waited too long to complete transition\n",
583 pwrdm->name);
584 return -EAGAIN;
299 } 585 }
586
587 pr_debug("powerdomain: completed transition in %d loops\n", c);
588
300 return 0; 589 return 0;
301} 590}
302subsys_initcall(omap4xxx_prcm_init); 591
592struct pwrdm_ops omap4_pwrdm_operations = {
593 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
594 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
595 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
596 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
597 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
598 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
599 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
600 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
601 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
602 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
603 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
604 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
605 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
606 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
607 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
608 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
609};
610
611/*
612 * XXX document
613 */
614static struct prm_ll_data omap44xx_prm_ll_data = {
615 .read_reset_sources = &omap44xx_prm_read_reset_sources,
616};
617
618static int __init omap44xx_prm_init(void)
619{
620 int ret;
621
622 if (!cpu_is_omap44xx())
623 return 0;
624
625 ret = prm_register(&omap44xx_prm_ll_data);
626 if (ret)
627 return ret;
628
629 omap44xx_prm_enable_io_wakeup();
630
631 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
632}
633subsys_initcall(omap44xx_prm_init);
634
635static void __exit omap44xx_prm_exit(void)
636{
637 if (!cpu_is_omap44xx())
638 return;
639
640 /* Should never happen */
641 WARN(prm_unregister(&omap44xx_prm_ll_data),
642 "%s: prm_ll_data function pointer mismatch\n", __func__);
643}
644__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index ee72ae6bd8c9..c8e1accdc90e 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -771,6 +771,8 @@ extern void omap44xx_prm_ocp_barrier(void);
771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask); 771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
772extern void omap44xx_prm_restore_irqen(u32 *saved_mask); 772extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
773 773
774extern u32 omap44xx_prm_get_reset_sources(void);
775
774# endif 776# endif
775 777
776#endif 778#endif
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 6b4d332be2f6..d2e0798a4c82 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,11 +24,13 @@
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>
29 28
30#include "prm2xxx_3xxx.h" 29#include "prm2xxx_3xxx.h"
30#include "prm2xxx.h"
31#include "prm3xxx.h"
31#include "prm44xx.h" 32#include "prm44xx.h"
33#include "common.h"
32 34
33/* 35/*
34 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs 36 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -53,6 +55,16 @@ static struct irq_chip_generic **prcm_irq_chips;
53 */ 55 */
54static struct omap_prcm_irq_setup *prcm_irq_setup; 56static struct omap_prcm_irq_setup *prcm_irq_setup;
55 57
58/* prm_base: base virtual address of the PRM IP block */
59void __iomem *prm_base;
60
61/*
62 * prm_ll_data: function pointers to SoC-specific implementations of
63 * common PRM functions
64 */
65static struct prm_ll_data null_prm_ll_data;
66static struct prm_ll_data *prm_ll_data = &null_prm_ll_data;
67
56/* Private functions */ 68/* Private functions */
57 69
58/* 70/*
@@ -319,64 +331,82 @@ err:
319 return -ENOMEM; 331 return -ENOMEM;
320} 332}
321 333
322/* 334/**
323 * Stubbed functions so that common files continue to build when 335 * omap2_set_globals_prm - set the PRM base address (for early use)
324 * custom builds are used 336 * @prm: PRM base virtual address
325 * XXX These are temporary and should be removed at the earliest possible 337 *
326 * opportunity 338 * XXX Will be replaced when the PRM/CM drivers are completed.
327 */ 339 */
328u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx) 340void __init omap2_set_globals_prm(void __iomem *prm)
329{ 341{
330 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 342 prm_base = prm;
331 return 0;
332} 343}
333 344
334void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 345/**
346 * prm_read_reset_sources - return the sources of the SoC's last reset
347 *
348 * Return a u32 bitmask representing the reset sources that caused the
349 * SoC to reset. The low-level per-SoC functions called by this
350 * function remap the SoC-specific reset source bits into an
351 * OMAP-common set of reset source bits, defined in
352 * arch/arm/mach-omap2/prm.h. Returns the standardized reset source
353 * u32 bitmask from the hardware upon success, or returns (1 <<
354 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources()
355 * function was registered.
356 */
357u32 prm_read_reset_sources(void)
335{ 358{
336 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 359 u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT;
337}
338 360
339u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, 361 if (prm_ll_data->read_reset_sources)
340 s16 module, s16 idx) 362 ret = prm_ll_data->read_reset_sources();
341{ 363 else
342 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 364 WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__);
343 return 0;
344}
345 365
346u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 366 return ret;
347{
348 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
349 return 0;
350} 367}
351 368
352u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 369/**
370 * prm_register - register per-SoC low-level data with the PRM
371 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
372 *
373 * Register per-SoC low-level OMAP PRM data and function pointers with
374 * the OMAP PRM common interface. The caller must keep the data
375 * pointed to by @pld valid until it calls prm_unregister() and
376 * it returns successfully. Returns 0 upon success, -EINVAL if @pld
377 * is NULL, or -EEXIST if prm_register() has already been called
378 * without an intervening prm_unregister().
379 */
380int prm_register(struct prm_ll_data *pld)
353{ 381{
354 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 382 if (!pld)
355 return 0; 383 return -EINVAL;
356}
357 384
358u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) 385 if (prm_ll_data != &null_prm_ll_data)
359{ 386 return -EEXIST;
360 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
361 return 0;
362}
363 387
364int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 388 prm_ll_data = pld;
365{
366 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
367 return 0;
368}
369 389
370int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
371{
372 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
373 return 0; 390 return 0;
374} 391}
375 392
376int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, 393/**
377 u8 st_shift) 394 * prm_unregister - unregister per-SoC low-level data & function pointers
395 * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister
396 *
397 * Unregister per-SoC low-level OMAP PRM data and function pointers
398 * that were previously registered with prm_register(). The
399 * caller may not destroy any of the data pointed to by @pld until
400 * this function returns successfully. Returns 0 upon success, or
401 * -EINVAL if @pld is NULL or if @pld does not match the struct
402 * prm_ll_data * previously registered by prm_register().
403 */
404int prm_unregister(struct prm_ll_data *pld)
378{ 405{
379 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 406 if (!pld || prm_ll_data != pld)
407 return -EINVAL;
408
409 prm_ll_data = &null_prm_ll_data;
410
380 return 0; 411 return 0;
381} 412}
382
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 46f2efb36596..a2ede2d65481 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -30,4 +30,6 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
31 u16 rstctrl_offs); 31 u16 rstctrl_offs);
32 32
33extern void omap_prm_base_init(void);
34
33#endif 35#endif
diff --git a/arch/arm/mach-omap2/scrm44xx.h b/arch/arm/mach-omap2/scrm44xx.h
index 701bf2d32949..e897ac89a3fd 100644
--- a/arch/arm/mach-omap2/scrm44xx.h
+++ b/arch/arm/mach-omap2/scrm44xx.h
@@ -127,12 +127,14 @@
127/* AUXCLKREQ0 */ 127/* AUXCLKREQ0 */
128#define OMAP4_MAPPING_SHIFT 2 128#define OMAP4_MAPPING_SHIFT 2
129#define OMAP4_MAPPING_MASK (0x7 << 2) 129#define OMAP4_MAPPING_MASK (0x7 << 2)
130#define OMAP4_MAPPING_WIDTH 3
130#define OMAP4_ACCURACY_SHIFT 1 131#define OMAP4_ACCURACY_SHIFT 1
131#define OMAP4_ACCURACY_MASK (1 << 1) 132#define OMAP4_ACCURACY_MASK (1 << 1)
132 133
133/* AUXCLK0 */ 134/* AUXCLK0 */
134#define OMAP4_CLKDIV_SHIFT 16 135#define OMAP4_CLKDIV_SHIFT 16
135#define OMAP4_CLKDIV_MASK (0xf << 16) 136#define OMAP4_CLKDIV_MASK (0xf << 16)
137#define OMAP4_CLKDIV_WIDTH 4
136#define OMAP4_DISABLECLK_SHIFT 9 138#define OMAP4_DISABLECLK_SHIFT 9
137#define OMAP4_DISABLECLK_MASK (1 << 9) 139#define OMAP4_DISABLECLK_MASK (1 << 9)
138#define OMAP4_ENABLE_SHIFT 8 140#define OMAP4_ENABLE_SHIFT 8
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..3ed0d62333c5 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;
@@ -115,12 +114,10 @@ int omap2_sdrc_get_params(unsigned long r,
115} 114}
116 115
117 116
118void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 117void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms)
119{ 118{
120 if (omap2_globals->sdrc) 119 omap2_sdrc_base = sdrc;
121 omap2_sdrc_base = omap2_globals->sdrc; 120 omap2_sms_base = sms;
122 if (omap2_globals->sms)
123 omap2_sms_base = omap2_globals->sms;
124} 121}
125 122
126/** 123/**
@@ -160,19 +157,3 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
160 sdrc_write_reg(l, SDRC_POWER); 157 sdrc_write_reg(l, SDRC_POWER);
161 omap2_sms_save_context(); 158 omap2_sms_save_context();
162} 159}
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..446aa13511fd 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,60 @@ 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
54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
55
56
57/**
58 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
59 * @rate: SDRC clock rate (in Hz)
60 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
61 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
62 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
63 * @mr: Value to program to SDRC_MR for this rate
64 *
65 * This structure holds a pre-computed set of register values for the
66 * SDRC for a given SDRC clock rate and SDRAM chip. These are
67 * intended to be pre-computed and specified in an array in the board-*.c
68 * files. The structure is keyed off the 'rate' field.
69 */
70struct omap_sdrc_params {
71 unsigned long rate;
72 u32 actim_ctrla;
73 u32 actim_ctrlb;
74 u32 rfr_ctrl;
75 u32 mr;
76};
77
78#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
79void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
80 struct omap_sdrc_params *sdrc_cs1);
81#else
82static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
83 struct omap_sdrc_params *sdrc_cs1) {};
84#endif
85
86int omap2_sdrc_get_params(unsigned long r,
87 struct omap_sdrc_params **sdrc_cs0,
88 struct omap_sdrc_params **sdrc_cs1);
89void omap2_sms_save_context(void);
90void omap2_sms_restore_context(void);
91
92struct memory_timings {
93 u32 m_type; /* ddr = 1, sdr = 0 */
94 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
95 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
96 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
97 u32 base_cs; /* base chip select to use for calculations */
98};
99
100extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
101struct omap_sdrc_params *rx51_get_sdram_timings(void);
102
103u32 omap2xxx_sdrc_dll_is_unlocked(void);
104u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
105
106
53#else 107#else
54#define OMAP242X_SDRC_REGADDR(reg) \ 108#define OMAP242X_SDRC_REGADDR(reg) \
55 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) 109 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
@@ -57,6 +111,7 @@ static inline u32 sms_read_reg(u16 reg)
57 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) 111 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
58#define OMAP34XX_SDRC_REGADDR(reg) \ 112#define OMAP34XX_SDRC_REGADDR(reg) \
59 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 113 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
114
60#endif /* __ASSEMBLER__ */ 115#endif /* __ASSEMBLER__ */
61 116
62/* Minimum frequency that the SDRC DLL can lock at */ 117/* Minimum frequency that the SDRC DLL can lock at */
@@ -74,4 +129,85 @@ static inline u32 sms_read_reg(u16 reg)
74 */ 129 */
75#define SDRC_MPURATE_LOOPS 96 130#define SDRC_MPURATE_LOOPS 96
76 131
132/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
133
134#define SDRC_SYSCONFIG 0x010
135#define SDRC_CS_CFG 0x040
136#define SDRC_SHARING 0x044
137#define SDRC_ERR_TYPE 0x04C
138#define SDRC_DLLA_CTRL 0x060
139#define SDRC_DLLA_STATUS 0x064
140#define SDRC_DLLB_CTRL 0x068
141#define SDRC_DLLB_STATUS 0x06C
142#define SDRC_POWER 0x070
143#define SDRC_MCFG_0 0x080
144#define SDRC_MR_0 0x084
145#define SDRC_EMR2_0 0x08c
146#define SDRC_ACTIM_CTRL_A_0 0x09c
147#define SDRC_ACTIM_CTRL_B_0 0x0a0
148#define SDRC_RFR_CTRL_0 0x0a4
149#define SDRC_MANUAL_0 0x0a8
150#define SDRC_MCFG_1 0x0B0
151#define SDRC_MR_1 0x0B4
152#define SDRC_EMR2_1 0x0BC
153#define SDRC_ACTIM_CTRL_A_1 0x0C4
154#define SDRC_ACTIM_CTRL_B_1 0x0C8
155#define SDRC_RFR_CTRL_1 0x0D4
156#define SDRC_MANUAL_1 0x0D8
157
158#define SDRC_POWER_AUTOCOUNT_SHIFT 8
159#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
160#define SDRC_POWER_CLKCTRL_SHIFT 4
161#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
162#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
163
164/*
165 * These values represent the number of memory clock cycles between
166 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
167 * rows per device, and include a subtraction of a 50 cycle window in the
168 * event that the autorefresh command is delayed due to other SDRC activity.
169 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
170 * counter reaches 0.
171 *
172 * These represent optimal values for common parts, it won't work for all.
173 * As long as you scale down, most parameters are still work, they just
174 * become sub-optimal. The RFR value goes in the opposite direction. If you
175 * don't adjust it down as your clock period increases the refresh interval
176 * will not be met. Setting all parameters for complete worst case may work,
177 * but may cut memory performance by 2x. Due to errata the DLLs need to be
178 * unlocked and their value needs run time calibration. A dynamic call is
179 * need for that as no single right value exists acorss production samples.
180 *
181 * Only the FULL speed values are given. Current code is such that rate
182 * changes must be made at DPLLoutx2. The actual value adjustment for low
183 * frequency operation will be handled by omap_set_performance()
184 *
185 * By having the boot loader boot up in the fastest L4 speed available likely
186 * will result in something which you can switch between.
187 */
188#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
189#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
190#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
191#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
192#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
193
194
195/*
196 * SMS register access
197 */
198
199#define OMAP242X_SMS_REGADDR(reg) \
200 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
201#define OMAP243X_SMS_REGADDR(reg) \
202 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
203#define OMAP343X_SMS_REGADDR(reg) \
204 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
205
206/* SMS register offsets - read/write with sms_{read,write}_reg() */
207
208#define SMS_SYSCONFIG 0x010
209/* REVISIT: fill in other SMS registers here */
210
211
212
77#endif 213#endif
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 73e55e485329..26c1728e09ca 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -24,14 +24,12 @@
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"
33#include "common.h" 31#include "common.h"
34#include "prm2xxx_3xxx.h" 32#include "prm2xxx.h"
35#include "clock.h" 33#include "clock.h"
36#include "sdrc.h" 34#include "sdrc.h"
37 35
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index a507cd6cf4f1..aa30a3c20883 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -28,19 +28,20 @@
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>
37 32
33#include "common.h"
34#include "omap_hwmod.h"
35#include "omap_device.h"
36#include "omap-pm.h"
37#include "soc.h"
38#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
39#include "pm.h" 39#include "pm.h"
40#include "cm2xxx_3xxx.h" 40#include "cm2xxx_3xxx.h"
41#include "prm-regbits-34xx.h" 41#include "prm-regbits-34xx.h"
42#include "control.h" 42#include "control.h"
43#include "mux.h" 43#include "mux.h"
44#include "serial.h"
44 45
45/* 46/*
46 * NOTE: By default the serial auto_suspend timeout is disabled as it causes 47 * NOTE: By default the serial auto_suspend timeout is disabled as it causes
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/mach-omap2/serial.h
index 65fce44dce34..6a6806271fcf 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/mach-omap2/serial.h
@@ -29,11 +29,6 @@
29 */ 29 */
30#define OMAP_UART_INFO_OFS 0x3ffc 30#define OMAP_UART_INFO_OFS 0x3ffc
31 31
32/* OMAP1 serial ports */
33#define OMAP1_UART1_BASE 0xfffb0000
34#define OMAP1_UART2_BASE 0xfffb0800
35#define OMAP1_UART3_BASE 0xfffb9800
36
37/* OMAP2 serial ports */ 32/* OMAP2 serial ports */
38#define OMAP2_UART1_BASE 0x4806a000 33#define OMAP2_UART1_BASE 0x4806a000
39#define OMAP2_UART2_BASE 0x4806c000 34#define OMAP2_UART2_BASE 0x4806c000
@@ -76,20 +71,14 @@
76#define ZOOM_UART_VIRT 0xfa400000 71#define ZOOM_UART_VIRT 0xfa400000
77 72
78#define OMAP_PORT_SHIFT 2 73#define OMAP_PORT_SHIFT 2
79#define OMAP7XX_PORT_SHIFT 0
80#define ZOOM_PORT_SHIFT 1 74#define ZOOM_PORT_SHIFT 1
81 75
82#define OMAP1510_BASE_BAUD (12000000/16)
83#define OMAP16XX_BASE_BAUD (48000000/16)
84#define OMAP24XX_BASE_BAUD (48000000/16) 76#define OMAP24XX_BASE_BAUD (48000000/16)
85 77
86/* 78/*
87 * DEBUG_LL port encoding stored into the UART1 scratchpad register by 79 * DEBUG_LL port encoding stored into the UART1 scratchpad register by
88 * decomp_setup in uncompress.h 80 * decomp_setup in uncompress.h
89 */ 81 */
90#define OMAP1UART1 11
91#define OMAP1UART2 12
92#define OMAP1UART3 13
93#define OMAP2UART1 21 82#define OMAP2UART1 21
94#define OMAP2UART2 22 83#define OMAP2UART2 22
95#define OMAP2UART3 23 84#define OMAP2UART3 23
@@ -109,15 +98,6 @@
109#define OMAP5UART4 OMAP4UART4 98#define OMAP5UART4 OMAP4UART4
110#define ZOOM_UART 95 /* Only on zoom2/3 */ 99#define ZOOM_UART 95 /* Only on zoom2/3 */
111 100
112/* This is only used by 8250.c for omap1510 */
113#define is_omap_port(pt) ({int __ret = 0; \
114 if ((pt)->port.mapbase == OMAP1_UART1_BASE || \
115 (pt)->port.mapbase == OMAP1_UART2_BASE || \
116 (pt)->port.mapbase == OMAP1_UART3_BASE) \
117 __ret = 1; \
118 __ret; \
119 })
120
121#ifndef __ASSEMBLER__ 101#ifndef __ASSEMBLER__
122 102
123struct omap_board_data; 103struct omap_board_data;
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 506987979c1c..474dba7263e3 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -26,12 +26,12 @@
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"
33#include "cm2xxx_3xxx.h" 33#include "cm3xxx.h"
34#include "prm2xxx_3xxx.h" 34#include "prm3xxx.h"
35#include "sdrc.h" 35#include "sdrc.h"
36#include "control.h" 36#include "control.h"
37 37
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 a04bc25a1d26..b9753fe27232 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/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 8f7326cd435b..680a7c56cc3e 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index b140d6578529..a1e9edd673f4 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 2d0ceaa23fb8..1446331b576a 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -32,7 +32,7 @@
32#include "soc.h" 32#include "soc.h"
33#include "iomap.h" 33#include "iomap.h"
34#include "sdrc.h" 34#include "sdrc.h"
35#include "cm2xxx_3xxx.h" 35#include "cm3xxx.h"
36 36
37/* 37/*
38 * This file needs be built unconditionally as ARM to interoperate correctly 38 * This file needs be built unconditionally as ARM to interoperate correctly
diff --git a/arch/arm/mach-omap2/ti81xx.h b/arch/arm/mach-omap2/ti81xx.h
index 8f9843f78422..a1e6caf0dba6 100644
--- a/arch/arm/mach-omap2/ti81xx.h
+++ b/arch/arm/mach-omap2/ti81xx.h
@@ -22,6 +22,15 @@
22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE 22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE
23#define TI81XX_PRCM_BASE 0x48180000 23#define TI81XX_PRCM_BASE 0x48180000
24 24
25/*
26 * Adjust TAP register base such that omap3_check_revision accesses the correct
27 * TI81XX register for checking device ID (it adds 0x204 to tap base while
28 * TI81XX DEVICE ID register is at offset 0x600 from control base).
29 */
30#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
31 TI81XX_CONTROL_DEVICE_ID - 0x204)
32
33
25#define TI81XX_ARM_INTC_BASE 0x48200000 34#define TI81XX_ARM_INTC_BASE 0x48200000
26 35
27#endif /* __ASM_ARCH_TI81XX_H */ 36#endif /* __ASM_ARCH_TI81XX_H */
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 69e46631a7cd..565e5755c9bc 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 44c42057b61c..3fa2bdb44106 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -26,9 +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>
31
32#include "soc.h" 29#include "soc.h"
33#include "twl-common.h" 30#include "twl-common.h"
34#include "pm.h" 31#include "pm.h"
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 3c434498e12e..d1dbe125b34f 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -25,10 +25,10 @@
25 25
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#include <plat/usb.h> 28#include "soc.h"
29#include <plat/omap_device.h> 29#include "omap_device.h"
30
31#include "mux.h" 30#include "mux.h"
31#include "usb.h"
32 32
33#ifdef CONFIG_MFD_OMAP_USB_HOST 33#ifdef CONFIG_MFD_OMAP_USB_HOST
34 34
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 51da21cb78f1..7b33b375fe77 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -25,12 +25,10 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/usb/musb.h> 26#include <linux/usb/musb.h>
27 27
28#include <plat/usb.h> 28#include "omap_device.h"
29#include <plat/omap_device.h> 29#include "soc.h"
30
31#include "am35xx.h"
32
33#include "mux.h" 30#include "mux.h"
31#include "usb.h"
34 32
35static struct musb_hdrc_config musb_config = { 33static struct musb_hdrc_config musb_config = {
36 .multipoint = 1, 34 .multipoint = 1,
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 805bea6edf17..a8795ff19e6d 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -15,10 +15,11 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/platform_data/usb-omap.h>
18 19
19#include <linux/usb/musb.h> 20#include <linux/usb/musb.h>
20 21
21#include <plat/gpmc.h> 22#include "gpmc.h"
22 23
23#include "mux.h" 24#include "mux.h"
24 25
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
new file mode 100644
index 000000000000..9b986ead7c45
--- /dev/null
+++ b/arch/arm/mach-omap2/usb.h
@@ -0,0 +1,82 @@
1#include <linux/platform_data/usb-omap.h>
2
3/* AM35x */
4/* USB 2.0 PHY Control */
5#define CONF2_PHY_GPIOMODE (1 << 23)
6#define CONF2_OTGMODE (3 << 14)
7#define CONF2_NO_OVERRIDE (0 << 14)
8#define CONF2_FORCE_HOST (1 << 14)
9#define CONF2_FORCE_DEVICE (2 << 14)
10#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
11#define CONF2_SESENDEN (1 << 13)
12#define CONF2_VBDTCTEN (1 << 12)
13#define CONF2_REFFREQ_24MHZ (2 << 8)
14#define CONF2_REFFREQ_26MHZ (7 << 8)
15#define CONF2_REFFREQ_13MHZ (6 << 8)
16#define CONF2_REFFREQ (0xf << 8)
17#define CONF2_PHYCLKGD (1 << 7)
18#define CONF2_VBUSSENSE (1 << 6)
19#define CONF2_PHY_PLLON (1 << 5)
20#define CONF2_RESET (1 << 4)
21#define CONF2_PHYPWRDN (1 << 3)
22#define CONF2_OTGPWRDN (1 << 2)
23#define CONF2_DATPOL (1 << 1)
24
25/* TI81XX specific definitions */
26#define USBCTRL0 0x620
27#define USBSTAT0 0x624
28
29/* TI816X PHY controls bits */
30#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
31#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
32
33/* TI814X PHY controls bits */
34#define USBPHY_CM_PWRDN (1 << 0)
35#define USBPHY_OTG_PWRDN (1 << 1)
36#define USBPHY_CHGDET_DIS (1 << 2)
37#define USBPHY_CHGDET_RSTRT (1 << 3)
38#define USBPHY_SRCONDM (1 << 4)
39#define USBPHY_SINKONDP (1 << 5)
40#define USBPHY_CHGISINK_EN (1 << 6)
41#define USBPHY_CHGVSRC_EN (1 << 7)
42#define USBPHY_DMPULLUP (1 << 8)
43#define USBPHY_DPPULLUP (1 << 9)
44#define USBPHY_CDET_EXTCTL (1 << 10)
45#define USBPHY_GPIO_MODE (1 << 12)
46#define USBPHY_DPOPBUFCTL (1 << 13)
47#define USBPHY_DMOPBUFCTL (1 << 14)
48#define USBPHY_DPINPUT (1 << 15)
49#define USBPHY_DMINPUT (1 << 16)
50#define USBPHY_DPGPIO_PD (1 << 17)
51#define USBPHY_DMGPIO_PD (1 << 18)
52#define USBPHY_OTGVDET_EN (1 << 19)
53#define USBPHY_OTGSESSEND_EN (1 << 20)
54#define USBPHY_DATA_POLARITY (1 << 23)
55
56struct usbhs_omap_board_data {
57 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
58
59 /* have to be valid if phy_reset is true and portx is in phy mode */
60 int reset_gpio_port[OMAP3_HS_USB_PORTS];
61
62 /* Set this to true for ES2.x silicon */
63 unsigned es2_compatibility:1;
64
65 unsigned phy_reset:1;
66
67 /*
68 * Regulators for USB PHYs.
69 * Each PHY can have a separate regulator.
70 */
71 struct regulator *regulator[OMAP3_HS_USB_PORTS];
72};
73
74extern void usb_musb_init(struct omap_musb_board_data *board_data);
75extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
76
77extern void am35x_musb_reset(void);
78extern void am35x_musb_phy_power(u8 on);
79extern void am35x_musb_clear_irq(void);
80extern void am35x_set_mode(u8 musb_mode);
81extern void ti81xx_musb_phy_power(u8 on);
82
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index b893c8e6f88f..48b22a0a0c88 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -22,7 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24#include "common.h" 24#include "common.h"
25 25#include "soc.h"
26#include "prm-regbits-44xx.h" 26#include "prm-regbits-44xx.h"
27#include "prm44xx.h" 27#include "prm44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index b2f1c67043a2..7c2b4ed38f02 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * OMAP2+ MPU WD_TIMER-specific code 2 * OMAP2+ MPU WD_TIMER-specific code
3 * 3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
4 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * 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 8 * the Free Software Foundation; either version 2 of the License, or
@@ -11,10 +13,14 @@
11#include <linux/io.h> 13#include <linux/io.h>
12#include <linux/err.h> 14#include <linux/err.h>
13 15
14#include <plat/omap_hwmod.h> 16#include <linux/platform_data/omap-wd-timer.h>
15 17
18#include "omap_hwmod.h"
19#include "omap_device.h"
16#include "wd_timer.h" 20#include "wd_timer.h"
17#include "common.h" 21#include "common.h"
22#include "prm.h"
23#include "soc.h"
18 24
19/* 25/*
20 * In order to avoid any assumptions from bootloader regarding WDT 26 * In order to avoid any assumptions from bootloader regarding WDT
@@ -26,9 +32,6 @@
26#define OMAP_WDT_WPS 0x34 32#define OMAP_WDT_WPS 0x34
27#define OMAP_WDT_SPR 0x48 33#define OMAP_WDT_SPR 0x48
28 34
29/* Maximum microseconds to wait for OMAP module to softreset */
30#define MAX_MODULE_SOFTRESET_WAIT 10000
31
32int omap2_wd_timer_disable(struct omap_hwmod *oh) 35int omap2_wd_timer_disable(struct omap_hwmod *oh)
33{ 36{
34 void __iomem *base; 37 void __iomem *base;
@@ -99,3 +102,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 102 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh); 103 omap2_wd_timer_disable(oh);
101} 104}
105
106static int __init omap_init_wdt(void)
107{
108 int id = -1;
109 struct platform_device *pdev;
110 struct omap_hwmod *oh;
111 char *oh_name = "wd_timer2";
112 char *dev_name = "omap_wdt";
113 struct omap_wd_timer_platform_data pdata;
114
115 if (!cpu_class_is_omap2() || of_have_populated_dt())
116 return 0;
117
118 oh = omap_hwmod_lookup(oh_name);
119 if (!oh) {
120 pr_err("Could not look up wd_timer%d hwmod\n", id);
121 return -EINVAL;
122 }
123
124 pdata.read_reset_sources = prm_read_reset_sources;
125
126 pdev = omap_device_build(dev_name, id, oh, &pdata,
127 sizeof(struct omap_wd_timer_platform_data),
128 NULL, 0, 0);
129 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
130 dev_name, oh->name);
131 return 0;
132}
133subsys_initcall(omap_init_wdt);
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/menelaus.h b/arch/arm/plat-omap/include/plat/menelaus.h
deleted file mode 100644
index 4a970ec62dd1..000000000000
--- a/arch/arm/plat-omap/include/plat/menelaus.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/menelaus.h
3 *
4 * Functions to access Menelaus power management chip
5 */
6
7#ifndef __ASM_ARCH_MENELAUS_H
8#define __ASM_ARCH_MENELAUS_H
9
10struct device;
11
12struct menelaus_platform_data {
13 int (* late_init)(struct device *dev);
14};
15
16extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
17 void *data);
18extern void menelaus_unregister_mmc_callback(void);
19extern int menelaus_set_mmc_opendrain(int slot, int enable);
20extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on);
21
22extern int menelaus_set_vmem(unsigned int mV);
23extern int menelaus_set_vio(unsigned int mV);
24extern int menelaus_set_vmmc(unsigned int mV);
25extern int menelaus_set_vaux(unsigned int mV);
26extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
27extern int menelaus_set_slot_sel(int enable);
28extern int menelaus_get_slot_pin_states(void);
29extern int menelaus_set_vcore_sw(unsigned int mV);
30extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
31
32#define EN_VPLL_SLEEP (1 << 7)
33#define EN_VMMC_SLEEP (1 << 6)
34#define EN_VAUX_SLEEP (1 << 5)
35#define EN_VIO_SLEEP (1 << 4)
36#define EN_VMEM_SLEEP (1 << 3)
37#define EN_DC3_SLEEP (1 << 2)
38#define EN_DC2_SLEEP (1 << 1)
39#define EN_VC_SLEEP (1 << 0)
40
41extern int menelaus_set_regulator_sleep(int enable, u32 val);
42
43#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
44#define omap_has_menelaus() 1
45#else
46#define omap_has_menelaus() 0
47#endif
48
49#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/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
deleted file mode 100644
index 267f43bb2a4e..000000000000
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/prcm.h
3 *
4 * Access definations for use in OMAP24XX clock and power management
5 *
6 * Copyright (C) 2005 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * XXX This file is deprecated. The PRCM is an OMAP2+-only subsystem,
23 * so this file doesn't belong in plat-omap/include/plat. Please
24 * do not add anything new to this file.
25 */
26
27#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
28#define __ASM_ARM_ARCH_OMAP_PRCM_H
29
30u32 omap_prcm_get_reset_sources(void);
31int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
32 const char *name);
33
34#endif
35
36
37
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/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
deleted file mode 100644
index 7f7b112acccb..000000000000
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ /dev/null
@@ -1,204 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Initially based on:
7 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Author: Greg Lonnon <glonnon@ridgerun.com>
10 *
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/types.h>
21#include <linux/serial_reg.h>
22
23#include <asm/memory.h>
24#include <asm/mach-types.h>
25
26#include <plat/serial.h>
27
28#define MDR1_MODE_MASK 0x07
29
30volatile u8 *uart_base;
31int uart_shift;
32
33/*
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
36 */
37static void set_omap_uart_info(unsigned char port)
38{
39 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
46}
47
48static void putc(int c)
49{
50 if (!uart_base)
51 return;
52
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
60}
61
62static inline void flush(void)
63{
64}
65
66/*
67 * Macros to configure UART1 and debug UART
68 */
69#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
76 }
77
78#define DEBUG_LL_OMAP7XX(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
81
82#define DEBUG_LL_OMAP1(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
85
86#define DEBUG_LL_OMAP2(p, mach) \
87 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP2UART##p)
89
90#define DEBUG_LL_OMAP3(p, mach) \
91 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP3UART##p)
93
94#define DEBUG_LL_OMAP4(p, mach) \
95 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
96 OMAP4UART##p)
97
98#define DEBUG_LL_OMAP5(p, mach) \
99 _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT, \
100 OMAP5UART##p)
101/* Zoom2/3 shift is different for UART1 and external port */
102#define DEBUG_LL_ZOOM(mach) \
103 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
104
105#define DEBUG_LL_TI81XX(p, mach) \
106 _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
107 TI81XXUART##p)
108
109#define DEBUG_LL_AM33XX(p, mach) \
110 _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
111 AM33XXUART##p)
112
113static inline void arch_decomp_setup(void)
114{
115 int port = 0;
116
117 /*
118 * Initialize the port based on the machine ID from the bootloader.
119 * Note that we're using macros here instead of switch statement
120 * as machine_is functions are optimized out for the boards that
121 * are not selected.
122 */
123 do {
124 /* omap7xx/8xx based boards using UART1 with shift 0 */
125 DEBUG_LL_OMAP7XX(1, herald);
126 DEBUG_LL_OMAP7XX(1, omap_perseus2);
127
128 /* omap15xx/16xx based boards using UART1 */
129 DEBUG_LL_OMAP1(1, ams_delta);
130 DEBUG_LL_OMAP1(1, nokia770);
131 DEBUG_LL_OMAP1(1, omap_h2);
132 DEBUG_LL_OMAP1(1, omap_h3);
133 DEBUG_LL_OMAP1(1, omap_innovator);
134 DEBUG_LL_OMAP1(1, omap_osk);
135 DEBUG_LL_OMAP1(1, omap_palmte);
136 DEBUG_LL_OMAP1(1, omap_palmz71);
137
138 /* omap15xx/16xx based boards using UART2 */
139 DEBUG_LL_OMAP1(2, omap_palmtt);
140
141 /* omap15xx/16xx based boards using UART3 */
142 DEBUG_LL_OMAP1(3, sx1);
143
144 /* omap2 based boards using UART1 */
145 DEBUG_LL_OMAP2(1, omap_2430sdp);
146 DEBUG_LL_OMAP2(1, omap_apollon);
147 DEBUG_LL_OMAP2(1, omap_h4);
148
149 /* omap2 based boards using UART3 */
150 DEBUG_LL_OMAP2(3, nokia_n800);
151 DEBUG_LL_OMAP2(3, nokia_n810);
152 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
153
154 /* omap3 based boards using UART1 */
155 DEBUG_LL_OMAP2(1, omap3evm);
156 DEBUG_LL_OMAP3(1, omap_3430sdp);
157 DEBUG_LL_OMAP3(1, omap_3630sdp);
158 DEBUG_LL_OMAP3(1, omap3530_lv_som);
159 DEBUG_LL_OMAP3(1, omap3_torpedo);
160
161 /* omap3 based boards using UART3 */
162 DEBUG_LL_OMAP3(3, cm_t35);
163 DEBUG_LL_OMAP3(3, cm_t3517);
164 DEBUG_LL_OMAP3(3, cm_t3730);
165 DEBUG_LL_OMAP3(3, craneboard);
166 DEBUG_LL_OMAP3(3, devkit8000);
167 DEBUG_LL_OMAP3(3, igep0020);
168 DEBUG_LL_OMAP3(3, igep0030);
169 DEBUG_LL_OMAP3(3, nokia_rm680);
170 DEBUG_LL_OMAP3(3, nokia_rm696);
171 DEBUG_LL_OMAP3(3, nokia_rx51);
172 DEBUG_LL_OMAP3(3, omap3517evm);
173 DEBUG_LL_OMAP3(3, omap3_beagle);
174 DEBUG_LL_OMAP3(3, omap3_pandora);
175 DEBUG_LL_OMAP3(3, omap_ldp);
176 DEBUG_LL_OMAP3(3, overo);
177 DEBUG_LL_OMAP3(3, touchbook);
178
179 /* omap4 based boards using UART3 */
180 DEBUG_LL_OMAP4(3, omap_4430sdp);
181 DEBUG_LL_OMAP4(3, omap4_panda);
182
183 /* omap5 based boards using UART3 */
184 DEBUG_LL_OMAP5(3, omap5_sevm);
185
186 /* zoom2/3 external uart */
187 DEBUG_LL_ZOOM(omap_zoom2);
188 DEBUG_LL_ZOOM(omap_zoom3);
189
190 /* TI8168 base boards using UART3 */
191 DEBUG_LL_TI81XX(3, ti8168evm);
192
193 /* TI8148 base boards using UART1 */
194 DEBUG_LL_TI81XX(1, ti8148evm);
195
196 /* AM33XX base boards using UART1 */
197 DEBUG_LL_AM33XX(1, am335xevm);
198 } while (0);
199}
200
201/*
202 * nothing to do
203 */
204#define arch_decomp_wdog()
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
deleted file mode 100644
index 87ee140fefaa..000000000000
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ /dev/null
@@ -1,179 +0,0 @@
1// include/asm-arm/mach-omap/usb.h
2
3#ifndef __ASM_ARCH_OMAP_USB_H
4#define __ASM_ARCH_OMAP_USB_H
5
6#include <linux/io.h>
7#include <linux/platform_device.h>
8#include <linux/usb/musb.h>
9
10#define OMAP3_HS_USB_PORTS 3
11
12enum usbhs_omap_port_mode {
13 OMAP_USBHS_PORT_MODE_UNUSED,
14 OMAP_EHCI_PORT_MODE_PHY,
15 OMAP_EHCI_PORT_MODE_TLL,
16 OMAP_EHCI_PORT_MODE_HSIC,
17 OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
18 OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
19 OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
20 OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
21 OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
22 OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
23 OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
24 OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
25 OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
26 OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
27};
28
29struct usbhs_omap_board_data {
30 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
31
32 /* have to be valid if phy_reset is true and portx is in phy mode */
33 int reset_gpio_port[OMAP3_HS_USB_PORTS];
34
35 /* Set this to true for ES2.x silicon */
36 unsigned es2_compatibility:1;
37
38 unsigned phy_reset:1;
39
40 /*
41 * Regulators for USB PHYs.
42 * Each PHY can have a separate regulator.
43 */
44 struct regulator *regulator[OMAP3_HS_USB_PORTS];
45};
46
47#ifdef CONFIG_ARCH_OMAP2PLUS
48
49struct ehci_hcd_omap_platform_data {
50 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
51 int reset_gpio_port[OMAP3_HS_USB_PORTS];
52 struct regulator *regulator[OMAP3_HS_USB_PORTS];
53 unsigned phy_reset:1;
54};
55
56struct ohci_hcd_omap_platform_data {
57 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
58 unsigned es2_compatibility:1;
59};
60
61struct usbhs_omap_platform_data {
62 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
63
64 struct ehci_hcd_omap_platform_data *ehci_data;
65 struct ohci_hcd_omap_platform_data *ohci_data;
66};
67
68struct usbtll_omap_platform_data {
69 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
70};
71/*-------------------------------------------------------------------------*/
72
73struct omap_musb_board_data {
74 u8 interface_type;
75 u8 mode;
76 u16 power;
77 unsigned extvbus:1;
78 void (*set_phy_power)(u8 on);
79 void (*clear_irq)(void);
80 void (*set_mode)(u8 mode);
81 void (*reset)(void);
82};
83
84enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
85
86extern void usb_musb_init(struct omap_musb_board_data *board_data);
87
88extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
89extern int omap_tll_enable(void);
90extern int omap_tll_disable(void);
91
92extern int omap4430_phy_power(struct device *dev, int ID, int on);
93extern int omap4430_phy_set_clk(struct device *dev, int on);
94extern int omap4430_phy_init(struct device *dev);
95extern int omap4430_phy_exit(struct device *dev);
96extern int omap4430_phy_suspend(struct device *dev, int suspend);
97
98#endif
99
100extern void am35x_musb_reset(void);
101extern void am35x_musb_phy_power(u8 on);
102extern void am35x_musb_clear_irq(void);
103extern void am35x_set_mode(u8 musb_mode);
104extern void ti81xx_musb_phy_power(u8 on);
105
106/* AM35x */
107/* USB 2.0 PHY Control */
108#define CONF2_PHY_GPIOMODE (1 << 23)
109#define CONF2_OTGMODE (3 << 14)
110#define CONF2_NO_OVERRIDE (0 << 14)
111#define CONF2_FORCE_HOST (1 << 14)
112#define CONF2_FORCE_DEVICE (2 << 14)
113#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
114#define CONF2_SESENDEN (1 << 13)
115#define CONF2_VBDTCTEN (1 << 12)
116#define CONF2_REFFREQ_24MHZ (2 << 8)
117#define CONF2_REFFREQ_26MHZ (7 << 8)
118#define CONF2_REFFREQ_13MHZ (6 << 8)
119#define CONF2_REFFREQ (0xf << 8)
120#define CONF2_PHYCLKGD (1 << 7)
121#define CONF2_VBUSSENSE (1 << 6)
122#define CONF2_PHY_PLLON (1 << 5)
123#define CONF2_RESET (1 << 4)
124#define CONF2_PHYPWRDN (1 << 3)
125#define CONF2_OTGPWRDN (1 << 2)
126#define CONF2_DATPOL (1 << 1)
127
128/* TI81XX specific definitions */
129#define USBCTRL0 0x620
130#define USBSTAT0 0x624
131
132/* TI816X PHY controls bits */
133#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
134#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
135
136/* TI814X PHY controls bits */
137#define USBPHY_CM_PWRDN (1 << 0)
138#define USBPHY_OTG_PWRDN (1 << 1)
139#define USBPHY_CHGDET_DIS (1 << 2)
140#define USBPHY_CHGDET_RSTRT (1 << 3)
141#define USBPHY_SRCONDM (1 << 4)
142#define USBPHY_SINKONDP (1 << 5)
143#define USBPHY_CHGISINK_EN (1 << 6)
144#define USBPHY_CHGVSRC_EN (1 << 7)
145#define USBPHY_DMPULLUP (1 << 8)
146#define USBPHY_DPPULLUP (1 << 9)
147#define USBPHY_CDET_EXTCTL (1 << 10)
148#define USBPHY_GPIO_MODE (1 << 12)
149#define USBPHY_DPOPBUFCTL (1 << 13)
150#define USBPHY_DMOPBUFCTL (1 << 14)
151#define USBPHY_DPINPUT (1 << 15)
152#define USBPHY_DMINPUT (1 << 16)
153#define USBPHY_DPGPIO_PD (1 << 17)
154#define USBPHY_DMGPIO_PD (1 << 18)
155#define USBPHY_OTGVDET_EN (1 << 19)
156#define USBPHY_OTGSESSEND_EN (1 << 20)
157#define USBPHY_DATA_POLARITY (1 << 23)
158
159#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
160u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
161u32 omap1_usb1_init(unsigned nwires);
162u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup);
163#else
164static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device)
165{
166 return 0;
167}
168static inline u32 omap1_usb1_init(unsigned nwires)
169{
170 return 0;
171
172}
173static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
174{
175 return 0;
176}
177#endif
178
179#endif /* __ASM_ARCH_OMAP_USB_H */
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