aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-05 10:22:45 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2012-09-05 10:22:45 -0400
commit593d0a3e9f813db910dc50574532914db21d09ff (patch)
tree12d8413ee57b4383ca8c906996ffe02be6d377a5 /arch/arm/mach-omap2
parent50e900417b8096939d12a46848f965e27a905e36 (diff)
parent4cb38750d49010ae72e718d46605ac9ba5a851b4 (diff)
Merge commit '4cb38750d49010ae72e718d46605ac9ba5a851b4' into stable/for-linus-3.6
* commit '4cb38750d49010ae72e718d46605ac9ba5a851b4': (6849 commits) bcma: fix invalid PMU chip control masks [libata] pata_cmd64x: whitespace cleanup libata-acpi: fix up for acpi_pm_device_sleep_state API sata_dwc_460ex: device tree may specify dma_channel ahci, trivial: fixed coding style issues related to braces ahci_platform: add hibernation callbacks libata-eh.c: local functions should not be exposed globally libata-transport.c: local functions should not be exposed globally sata_dwc_460ex: support hardreset ata: use module_pci_driver drivers/ata/pata_pcmcia.c: adjust suspicious bit operation pata_imx: Convert to clk_prepare_enable/clk_disable_unprepare ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327) v2 [libata] Prevent interface errors with Seagate FreeAgent GoFlex drivers/acpi/glue: revert accidental license-related 6b66d95895c bits libata-acpi: add missing inlines in libata.h i2c-omap: Add support for I2C_M_STOP message flag i2c: Fall back to emulated SMBus if the operation isn't supported natively i2c: Add SCCB support i2c-tiny-usb: Add support for the Robofuzz OSIF USB/I2C converter ...
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Kconfig25
-rw-r--r--arch/arm/mach-omap2/Makefile59
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c90
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c14
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c3
-rw-r--r--arch/arm/mach-omap2/board-apollon.c20
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c89
-rw-r--r--arch/arm/mach-omap2/board-flash.c5
-rw-r--r--arch/arm/mach-omap2/board-generic.c58
-rw-r--r--arch/arm/mach-omap2/board-h4.c13
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c30
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c78
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c3
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c5
-rw-r--r--arch/arm/mach-omap2/board-overo.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c6
-rw-r--r--arch/arm/mach-omap2/clock.c18
-rw-r--r--arch/arm/mach-omap2/clock.h14
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c43
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c49
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c1105
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c102
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c138
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c77
-rw-r--r--arch/arm/mach-omap2/clockdomain.h8
-rw-r--r--arch/arm/mach-omap2/clockdomain33xx.c74
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c10
-rw-r--r--arch/arm/mach-omap2/clockdomains2420_data.c2
-rw-r--r--arch/arm/mach-omap2/clockdomains2430_data.c2
-rw-r--r--arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains33xx_data.c196
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c159
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c4
-rw-r--r--arch/arm/mach-omap2/clockdomains_common_data.c24
-rw-r--r--arch/arm/mach-omap2/cm-regbits-33xx.h687
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h4
-rw-r--r--arch/arm/mach-omap2/cm.h11
-rw-r--r--arch/arm/mach-omap2/cm33xx.c313
-rw-r--r--arch/arm/mach-omap2/cm33xx.h420
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c18
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h25
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c33
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h1
-rw-r--r--arch/arm/mach-omap2/common.c34
-rw-r--r--arch/arm/mach-omap2/common.h27
-rw-r--r--arch/arm/mach-omap2/control.c43
-rw-r--r--arch/arm/mach-omap2/control.h46
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c79
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c8
-rw-r--r--arch/arm/mach-omap2/devices.c112
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c26
-rw-r--r--arch/arm/mach-omap2/drm.c61
-rw-r--r--arch/arm/mach-omap2/dsp.c7
-rw-r--r--arch/arm/mach-omap2/gpmc.c3
-rw-r--r--arch/arm/mach-omap2/hdq1w.c26
-rw-r--r--arch/arm/mach-omap2/id.c57
-rw-r--r--arch/arm/mach-omap2/include/mach/am35xx.h2
-rw-r--r--arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h1
-rw-r--r--arch/arm/mach-omap2/include/mach/debug-macro.S25
-rw-r--r--arch/arm/mach-omap2/include/mach/omap-wakeupgen.h7
-rw-r--r--arch/arm/mach-omap2/io.c59
-rw-r--r--arch/arm/mach-omap2/iomap.h27
-rw-r--r--arch/arm/mach-omap2/irq.c24
-rw-r--r--arch/arm/mach-omap2/mailbox.c2
-rw-r--r--arch/arm/mach-omap2/msdi.c73
-rw-r--r--arch/arm/mach-omap2/mux.c4
-rw-r--r--arch/arm/mach-omap2/mux.h11
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S21
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c24
-rw-r--r--arch/arm/mach-omap2/omap-iommu.c6
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c6
-rw-r--r--arch/arm/mach-omap2/omap-smp.c52
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c114
-rw-r--r--arch/arm/mach-omap2/omap4-common.c14
-rw-r--r--arch/arm/mach-omap2/omap4-sar-layout.h12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c575
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c16
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c188
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c49
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.h22
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c3
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c6
-rw-r--r--arch/arm/mach-omap2/opp.c3
-rw-r--r--arch/arm/mach-omap2/pm.h19
-rw-r--r--arch/arm/mach-omap2/pm34xx.c79
-rw-r--r--arch/arm/mach-omap2/powerdomain.c22
-rw-r--r--arch/arm/mach-omap2/powerdomain.h27
-rw-r--r--arch/arm/mach-omap2/powerdomain33xx.c229
-rw-r--r--arch/arm/mach-omap2/powerdomains33xx_data.c185
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c139
-rw-r--r--arch/arm/mach-omap2/prcm-common.h14
-rw-r--r--arch/arm/mach-omap2/prcm.c25
-rw-r--r--arch/arm/mach-omap2/prm-regbits-33xx.h357
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c62
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h68
-rw-r--r--arch/arm/mach-omap2/prm33xx.c135
-rw-r--r--arch/arm/mach-omap2/prm33xx.h129
-rw-r--r--arch/arm/mach-omap2/prm44xx.c63
-rw-r--r--arch/arm/mach-omap2/prm44xx.h2
-rw-r--r--arch/arm/mach-omap2/prm_common.c70
-rw-r--r--arch/arm/mach-omap2/serial.c67
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c29
-rw-r--r--arch/arm/mach-omap2/smartreflex.c1165
-rw-r--r--arch/arm/mach-omap2/smartreflex.h256
-rw-r--r--arch/arm/mach-omap2/sr_device.c41
-rw-r--r--arch/arm/mach-omap2/timer.c93
-rw-r--r--arch/arm/mach-omap2/twl-common.c15
-rw-r--r--arch/arm/mach-omap2/usb-fs.c359
-rw-r--r--arch/arm/mach-omap2/usb-musb.c6
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/mach-omap2/voltage.h22
-rw-r--r--arch/arm/mach-omap2/voltagedomains33xx_data.c43
116 files changed, 6572 insertions, 3098 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4cf5142f22cc..dd0fbf76ac79 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -9,7 +9,7 @@ config ARCH_OMAP2PLUS_TYPICAL
9 select REGULATOR 9 select REGULATOR
10 select PM_RUNTIME 10 select PM_RUNTIME
11 select VFP 11 select VFP
12 select NEON if ARCH_OMAP3 || ARCH_OMAP4 12 select NEON if ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5
13 select SERIAL_OMAP 13 select SERIAL_OMAP
14 select SERIAL_OMAP_CONSOLE 14 select SERIAL_OMAP_CONSOLE
15 select I2C 15 select I2C
@@ -21,12 +21,16 @@ config ARCH_OMAP2PLUS_TYPICAL
21 help 21 help
22 Compile a kernel suitable for booting most boards 22 Compile a kernel suitable for booting most boards
23 23
24config SOC_HAS_OMAP2_SDRC
25 bool "OMAP2 SDRAM Controller support"
26
24config ARCH_OMAP2 27config ARCH_OMAP2
25 bool "TI OMAP2" 28 bool "TI OMAP2"
26 depends on ARCH_OMAP2PLUS 29 depends on ARCH_OMAP2PLUS
27 default y 30 default y
28 select CPU_V6 31 select CPU_V6
29 select MULTI_IRQ_HANDLER 32 select MULTI_IRQ_HANDLER
33 select SOC_HAS_OMAP2_SDRC
30 34
31config ARCH_OMAP3 35config ARCH_OMAP3
32 bool "TI OMAP3" 36 bool "TI OMAP3"
@@ -35,9 +39,11 @@ config ARCH_OMAP3
35 select CPU_V7 39 select CPU_V7
36 select USB_ARCH_HAS_EHCI if USB_SUPPORT 40 select USB_ARCH_HAS_EHCI if USB_SUPPORT
37 select ARCH_HAS_OPP 41 select ARCH_HAS_OPP
42 select PM_RUNTIME if CPU_IDLE
38 select PM_OPP if PM 43 select PM_OPP if PM
39 select ARM_CPU_SUSPEND if PM 44 select ARM_CPU_SUSPEND if PM
40 select MULTI_IRQ_HANDLER 45 select MULTI_IRQ_HANDLER
46 select SOC_HAS_OMAP2_SDRC
41 47
42config ARCH_OMAP4 48config ARCH_OMAP4
43 bool "TI OMAP4" 49 bool "TI OMAP4"
@@ -52,10 +58,17 @@ config ARCH_OMAP4
52 select PL310_ERRATA_727915 58 select PL310_ERRATA_727915
53 select ARM_ERRATA_720789 59 select ARM_ERRATA_720789
54 select ARCH_HAS_OPP 60 select ARCH_HAS_OPP
61 select PM_RUNTIME if CPU_IDLE
55 select PM_OPP if PM 62 select PM_OPP if PM
56 select USB_ARCH_HAS_EHCI if USB_SUPPORT 63 select USB_ARCH_HAS_EHCI if USB_SUPPORT
57 select ARM_CPU_SUSPEND if PM 64 select ARM_CPU_SUSPEND if PM
58 65
66config SOC_OMAP5
67 bool "TI OMAP5"
68 select CPU_V7
69 select ARM_GIC
70 select HAVE_SMP
71
59comment "OMAP Core Type" 72comment "OMAP Core Type"
60 depends on ARCH_OMAP2 73 depends on ARCH_OMAP2
61 74
@@ -64,19 +77,19 @@ config SOC_OMAP2420
64 depends on ARCH_OMAP2 77 depends on ARCH_OMAP2
65 default y 78 default y
66 select OMAP_DM_TIMER 79 select OMAP_DM_TIMER
67 select ARCH_OMAP_OTG 80 select SOC_HAS_OMAP2_SDRC
68 81
69config SOC_OMAP2430 82config SOC_OMAP2430
70 bool "OMAP2430 support" 83 bool "OMAP2430 support"
71 depends on ARCH_OMAP2 84 depends on ARCH_OMAP2
72 default y 85 default y
73 select ARCH_OMAP_OTG 86 select SOC_HAS_OMAP2_SDRC
74 87
75config SOC_OMAP3430 88config SOC_OMAP3430
76 bool "OMAP3430 support" 89 bool "OMAP3430 support"
77 depends on ARCH_OMAP3 90 depends on ARCH_OMAP3
78 default y 91 default y
79 select ARCH_OMAP_OTG 92 select SOC_HAS_OMAP2_SDRC
80 93
81config SOC_TI81XX 94config SOC_TI81XX
82 bool "TI81XX support" 95 bool "TI81XX support"
@@ -85,8 +98,10 @@ config SOC_TI81XX
85 98
86config SOC_AM33XX 99config SOC_AM33XX
87 bool "AM33XX support" 100 bool "AM33XX support"
88 depends on ARCH_OMAP3
89 default y 101 default y
102 select CPU_V7
103 select ARM_CPU_SUSPEND if PM
104 select MULTI_IRQ_HANDLER
90 105
91config OMAP_PACKAGE_ZAF 106config OMAP_PACKAGE_ZAF
92 bool 107 bool
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fa742f3c2629..f6a24b3f9c4f 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -6,7 +6,7 @@
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 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o
8 8
9omap-2-3-common = irq.o sdrc.o 9omap-2-3-common = irq.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
11 omap_hwmod_common_data.o 11 omap_hwmod_common_data.o
12clock-common = clock.o clock_common_data.o \ 12clock-common = clock.o clock_common_data.o \
@@ -16,19 +16,24 @@ secure-common = omap-smc.o omap-secure.o
16obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) 16obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
17obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common) 17obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
18obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common) 18obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
19obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
20obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
19 21
20ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 22ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
21obj-y += mcbsp.o 23obj-y += mcbsp.o
22endif 24endif
23 25
24obj-$(CONFIG_TWL4030_CORE) += omap_twl.o 26obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
27obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
25 28
26# SMP support ONLY available for OMAP4 29# SMP support ONLY available for OMAP4
27 30
28obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 31obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
29obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 32obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
30obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o 33omap-4-5-common = omap4-common.o omap-wakeupgen.o \
31obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o 34 sleep44xx.o
35obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common)
36obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common)
32 37
33plus_sec := $(call as-instr,.arch_extension sec,+sec) 38plus_sec := $(call as-instr,.arch_extension sec,+sec)
34AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) 39AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -66,12 +71,12 @@ ifeq ($(CONFIG_PM),y)
66obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o 71obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
67obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o 72obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
68obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 73obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
69obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
70obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o 74obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o
71obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o 75obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o
72obj-$(CONFIG_PM_DEBUG) += pm-debug.o 76obj-$(CONFIG_PM_DEBUG) += pm-debug.o
73obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o 77
74obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o 78obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
79obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
75 80
76AFLAGS_sleep24xx.o :=-Wa,-march=armv6 81AFLAGS_sleep24xx.o :=-Wa,-march=armv6
77AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) 82AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -82,14 +87,22 @@ endif
82 87
83endif 88endif
84 89
90ifeq ($(CONFIG_CPU_IDLE),y)
91obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
92obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
93endif
94
85# PRCM 95# PRCM
96omap-prcm-4-5-common = prcm.o cminst44xx.o cm44xx.o \
97 prcm_mpu44xx.o prminst44xx.o \
98 vc44xx_data.o vp44xx_data.o
86obj-y += prm_common.o 99obj-y += prm_common.o
87obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o 100obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
88obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o 101obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
89obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 102obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
90obj-$(CONFIG_ARCH_OMAP4) += prcm.o cminst44xx.o cm44xx.o 103obj-$(CONFIG_SOC_AM33XX) += prcm.o prm33xx.o cm33xx.o
91obj-$(CONFIG_ARCH_OMAP4) += prcm_mpu44xx.o prminst44xx.o 104obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) prm44xx.o
92obj-$(CONFIG_ARCH_OMAP4) += vc44xx_data.o vp44xx_data.o prm44xx.o 105obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
93 106
94# OMAP voltage domains 107# OMAP voltage domains
95voltagedomain-common := voltage.o vc.o vp.o 108voltagedomain-common := voltage.o vc.o vp.o
@@ -99,6 +112,9 @@ obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common)
99obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o 112obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
100obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) 113obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
101obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o 114obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
115obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
116obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
117obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
102 118
103# OMAP powerdomain framework 119# OMAP powerdomain framework
104powerdomain-common += powerdomain.o powerdomain-common.o 120powerdomain-common += powerdomain.o powerdomain-common.o
@@ -113,10 +129,14 @@ obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o
113obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) 129obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
114obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o 130obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o
115obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o 131obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
132obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
133obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o
134obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
135obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
136obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o
116 137
117# PRCM clockdomain control 138# PRCM clockdomain control
118clockdomain-common += clockdomain.o 139clockdomain-common += clockdomain.o
119clockdomain-common += clockdomains_common_data.o
120obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common) 140obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common)
121obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o 141obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o
122obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o 142obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o
@@ -129,6 +149,11 @@ obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o
129obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common) 149obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
130obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o 150obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o
131obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o 151obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
152obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
153obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o
154obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
155obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
156obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o
132 157
133# Clock framework 158# Clock framework
134obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o 159obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
@@ -146,6 +171,10 @@ obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o
146obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o 171obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
147obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o 172obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o
148obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o 173obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
174obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
175obj-$(CONFIG_SOC_AM33XX) += clock33xx_data.o
176obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
177obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
149 178
150# OMAP2 clock rate set data (old "OPP" data) 179# OMAP2 clock rate set data (old "OPP" data)
151obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o 180obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
@@ -173,6 +202,7 @@ obj-$(CONFIG_OMAP3_EMU) += emu.o
173# L3 interconnect 202# L3 interconnect
174obj-$(CONFIG_ARCH_OMAP3) += omap_l3_smx.o 203obj-$(CONFIG_ARCH_OMAP3) += omap_l3_smx.o
175obj-$(CONFIG_ARCH_OMAP4) += omap_l3_noc.o 204obj-$(CONFIG_ARCH_OMAP4) += omap_l3_noc.o
205obj-$(CONFIG_SOC_OMAP5) += omap_l3_noc.o
176 206
177obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 207obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
178mailbox_mach-objs := mailbox.o 208mailbox_mach-objs := mailbox.o
@@ -189,6 +219,10 @@ endif
189# OMAP2420 MSDI controller integration support ("MMC") 219# OMAP2420 MSDI controller integration support ("MMC")
190obj-$(CONFIG_SOC_OMAP2420) += msdi.o 220obj-$(CONFIG_SOC_OMAP2420) += msdi.o
191 221
222ifneq ($(CONFIG_DRM_OMAP),)
223obj-y += drm.o
224endif
225
192# Specific board support 226# Specific board support
193obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 227obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
194obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 228obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
@@ -244,9 +278,6 @@ obj-y += $(omap-flash-y) $(omap-flash-m)
244omap-hsmmc-$(CONFIG_MMC_OMAP_HS) := hsmmc.o 278omap-hsmmc-$(CONFIG_MMC_OMAP_HS) := hsmmc.o
245obj-y += $(omap-hsmmc-m) $(omap-hsmmc-y) 279obj-y += $(omap-hsmmc-m) $(omap-hsmmc-y)
246 280
247
248usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o
249obj-y += $(usbfs-m) $(usbfs-y)
250obj-y += usb-musb.o 281obj-y += usb-musb.o
251obj-y += omap_phy_internal.o 282obj-y += omap_phy_internal.o
252 283
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
index 447682c4e11c..2c90ac686686 100644
--- a/arch/arm/mach-omap2/am35xx-emac.c
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -15,27 +15,13 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include <linux/clk.h> 18#include <linux/err.h>
19#include <linux/davinci_emac.h> 19#include <linux/davinci_emac.h>
20#include <linux/platform_device.h> 20#include <asm/system.h>
21#include <plat/irqs.h> 21#include <plat/omap_device.h>
22#include <mach/am35xx.h> 22#include <mach/am35xx.h>
23
24#include "control.h" 23#include "control.h"
25 24#include "am35xx-emac.h"
26static struct mdio_platform_data am35xx_emac_mdio_pdata;
27
28static struct resource am35xx_emac_mdio_resources[] = {
29 DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET, SZ_4K),
30};
31
32static struct platform_device am35xx_emac_mdio_device = {
33 .name = "davinci_mdio",
34 .id = 0,
35 .num_resources = ARRAY_SIZE(am35xx_emac_mdio_resources),
36 .resource = am35xx_emac_mdio_resources,
37 .dev.platform_data = &am35xx_emac_mdio_pdata,
38};
39 25
40static void am35xx_enable_emac_int(void) 26static void am35xx_enable_emac_int(void)
41{ 27{
@@ -69,41 +55,57 @@ static struct emac_platform_data am35xx_emac_pdata = {
69 .interrupt_disable = am35xx_disable_emac_int, 55 .interrupt_disable = am35xx_disable_emac_int,
70}; 56};
71 57
72static struct resource am35xx_emac_resources[] = { 58static struct mdio_platform_data am35xx_mdio_pdata;
73 DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE, 0x30000),
74 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RXTHRESH_IRQ),
75 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RX_PULSE_IRQ),
76 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_TX_PULSE_IRQ),
77 DEFINE_RES_IRQ(INT_35XX_EMAC_C0_MISC_PULSE_IRQ),
78};
79 59
80static struct platform_device am35xx_emac_device = { 60static int __init omap_davinci_emac_dev_init(struct omap_hwmod *oh,
81 .name = "davinci_emac", 61 void *pdata, int pdata_len)
82 .id = -1, 62{
83 .num_resources = ARRAY_SIZE(am35xx_emac_resources), 63 struct platform_device *pdev;
84 .resource = am35xx_emac_resources, 64
85 .dev = { 65 pdev = omap_device_build(oh->class->name, 0, oh, pdata, pdata_len,
86 .platform_data = &am35xx_emac_pdata, 66 NULL, 0, false);
87 }, 67 if (IS_ERR(pdev)) {
88}; 68 WARN(1, "Can't build omap_device for %s:%s.\n",
69 oh->class->name, oh->name);
70 return PTR_ERR(pdev);
71 }
72
73 return 0;
74}
89 75
90void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en) 76void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en)
91{ 77{
78 struct omap_hwmod *oh;
92 u32 v; 79 u32 v;
93 int err; 80 int ret;
94 81
95 am35xx_emac_pdata.rmii_en = rmii_en; 82 oh = omap_hwmod_lookup("davinci_mdio");
96 am35xx_emac_mdio_pdata.bus_freq = mdio_bus_freq; 83 if (!oh) {
97 err = platform_device_register(&am35xx_emac_device); 84 pr_err("Could not find davinci_mdio hwmod\n");
98 if (err) { 85 return;
99 pr_err("AM35x: failed registering EMAC device: %d\n", err); 86 }
87
88 am35xx_mdio_pdata.bus_freq = mdio_bus_freq;
89
90 ret = omap_davinci_emac_dev_init(oh, &am35xx_mdio_pdata,
91 sizeof(am35xx_mdio_pdata));
92 if (ret) {
93 pr_err("Could not build davinci_mdio hwmod device\n");
100 return; 94 return;
101 } 95 }
102 96
103 err = platform_device_register(&am35xx_emac_mdio_device); 97 oh = omap_hwmod_lookup("davinci_emac");
104 if (err) { 98 if (!oh) {
105 pr_err("AM35x: failed registering EMAC MDIO device: %d\n", err); 99 pr_err("Could not find davinci_emac hwmod\n");
106 platform_device_unregister(&am35xx_emac_device); 100 return;
101 }
102
103 am35xx_emac_pdata.rmii_en = rmii_en;
104
105 ret = omap_davinci_emac_dev_init(oh, &am35xx_emac_pdata,
106 sizeof(am35xx_emac_pdata));
107 if (ret) {
108 pr_err("Could not build davinci_emac hwmod device\n");
107 return; 109 return;
108 } 110 }
109 111
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 99ca6bad5c30..9511584fdc4f 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -218,9 +218,6 @@ static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
218}; 218};
219 219
220static struct twl4030_platform_data sdp2430_twldata = { 220static struct twl4030_platform_data sdp2430_twldata = {
221 .irq_base = TWL4030_IRQ_BASE,
222 .irq_end = TWL4030_IRQ_END,
223
224 /* platform_data for children goes here */ 221 /* platform_data for children goes here */
225 .gpio = &sdp2430_gpio_data, 222 .gpio = &sdp2430_gpio_data,
226 .vmmc1 = &sdp2430_vmmc1, 223 .vmmc1 = &sdp2430_vmmc1,
@@ -254,16 +251,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
254 {} /* Terminator */ 251 {} /* Terminator */
255}; 252};
256 253
257static struct omap_usb_config sdp2430_usb_config __initdata = {
258 .otg = 1,
259#ifdef CONFIG_USB_GADGET_OMAP
260 .hmc_mode = 0x0,
261#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
262 .hmc_mode = 0x1,
263#endif
264 .pins[0] = 3,
265};
266
267#ifdef CONFIG_OMAP_MUX 254#ifdef CONFIG_OMAP_MUX
268static struct omap_board_mux board_mux[] __initdata = { 255static struct omap_board_mux board_mux[] __initdata = {
269 { .reg_offset = OMAP_MUX_TERMINATOR }, 256 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -280,7 +267,6 @@ static void __init omap_2430sdp_init(void)
280 omap_serial_init(); 267 omap_serial_init();
281 omap_sdrc_init(NULL, NULL); 268 omap_sdrc_init(NULL, NULL);
282 omap_hsmmc_init(mmc); 269 omap_hsmmc_init(mmc);
283 omap2_usbfs_init(&sdp2430_usb_config);
284 270
285 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP); 271 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
286 usb_musb_init(NULL); 272 usb_musb_init(NULL);
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 8e17284a803f..ad8a7d94afcd 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -821,6 +821,9 @@ static void __init omap_4430sdp_display_init(void)
821#ifdef CONFIG_OMAP_MUX 821#ifdef CONFIG_OMAP_MUX
822static struct omap_board_mux board_mux[] __initdata = { 822static struct omap_board_mux board_mux[] __initdata = {
823 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 823 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
824 /* NIRQ2 for twl6040 */
825 OMAP4_MUX(SYS_NIRQ2, OMAP_MUX_MODE0 |
826 OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
824 { .reg_offset = OMAP_MUX_TERMINATOR }, 827 { .reg_offset = OMAP_MUX_TERMINATOR },
825}; 828};
826 829
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 502c31e123be..e5fa46bfde2f 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -35,7 +35,6 @@
35#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
36 36
37#include <plat/led.h> 37#include <plat/led.h>
38#include <plat/usb.h>
39#include <plat/board.h> 38#include <plat/board.h>
40#include "common.h" 39#include "common.h"
41#include <plat/gpmc.h> 40#include <plat/gpmc.h>
@@ -253,13 +252,6 @@ out:
253 clk_put(gpmc_fck); 252 clk_put(gpmc_fck);
254} 253}
255 254
256static struct omap_usb_config apollon_usb_config __initdata = {
257 .register_dev = 1,
258 .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */
259
260 .pins[0] = 6,
261};
262
263static struct panel_generic_dpi_data apollon_panel_data = { 255static struct panel_generic_dpi_data apollon_panel_data = {
264 .name = "apollon", 256 .name = "apollon",
265}; 257};
@@ -297,15 +289,6 @@ static void __init apollon_led_init(void)
297 gpio_request_array(apollon_gpio_leds, ARRAY_SIZE(apollon_gpio_leds)); 289 gpio_request_array(apollon_gpio_leds, ARRAY_SIZE(apollon_gpio_leds));
298} 290}
299 291
300static void __init apollon_usb_init(void)
301{
302 /* USB device */
303 /* DEVICE_SUSPEND */
304 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
305 gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend");
306 omap2_usbfs_init(&apollon_usb_config);
307}
308
309#ifdef CONFIG_OMAP_MUX 292#ifdef CONFIG_OMAP_MUX
310static struct omap_board_mux board_mux[] __initdata = { 293static struct omap_board_mux board_mux[] __initdata = {
311 { .reg_offset = OMAP_MUX_TERMINATOR }, 294 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -321,7 +304,6 @@ static void __init omap_apollon_init(void)
321 apollon_init_smc91x(); 304 apollon_init_smc91x();
322 apollon_led_init(); 305 apollon_led_init();
323 apollon_flash_init(); 306 apollon_flash_init();
324 apollon_usb_init();
325 307
326 /* REVISIT: where's the correct place */ 308 /* REVISIT: where's the correct place */
327 omap_mux_init_signal("sys_nirq", OMAP_PULL_ENA | OMAP_PULL_UP); 309 omap_mux_init_signal("sys_nirq", OMAP_PULL_ENA | OMAP_PULL_UP);
@@ -329,7 +311,7 @@ static void __init omap_apollon_init(void)
329 /* LCD PWR_EN */ 311 /* LCD PWR_EN */
330 omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP); 312 omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP);
331 313
332 /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ 314 /* Use Internal loop-back in MMC/SDIO Module Input Clock selection */
333 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); 315 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
334 v |= (1 << 24); 316 v |= (1 << 24);
335 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); 317 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index ded100c80a91..97d719047af3 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -490,6 +490,71 @@ static struct twl4030_platform_data cm_t35_twldata = {
490 .power = &cm_t35_power_data, 490 .power = &cm_t35_power_data,
491}; 491};
492 492
493#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
494#include <media/omap3isp.h>
495#include "devices.h"
496
497static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
498 {
499 I2C_BOARD_INFO("mt9t001", 0x5d),
500 },
501 {
502 I2C_BOARD_INFO("tvp5150", 0x5c),
503 },
504};
505
506static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
507 {
508 .board_info = &cm_t35_isp_i2c_boardinfo[0],
509 .i2c_adapter_id = 3,
510 },
511 { NULL, 0, },
512};
513
514static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
515 {
516 .board_info = &cm_t35_isp_i2c_boardinfo[1],
517 .i2c_adapter_id = 3,
518 },
519 { NULL, 0, },
520};
521
522static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
523 {
524 .subdevs = cm_t35_isp_primary_subdevs,
525 .interface = ISP_INTERFACE_PARALLEL,
526 .bus = {
527 .parallel = {
528 .clk_pol = 1,
529 },
530 },
531 },
532 {
533 .subdevs = cm_t35_isp_secondary_subdevs,
534 .interface = ISP_INTERFACE_PARALLEL,
535 .bus = {
536 .parallel = {
537 .clk_pol = 0,
538 },
539 },
540 },
541 { NULL, 0, },
542};
543
544static struct isp_platform_data cm_t35_isp_pdata = {
545 .subdevs = cm_t35_isp_subdevs,
546};
547
548static void __init cm_t35_init_camera(void)
549{
550 if (omap3_init_camera(&cm_t35_isp_pdata) < 0)
551 pr_warn("CM-T3x: Failed registering camera device!\n");
552}
553
554#else
555static inline void cm_t35_init_camera(void) {}
556#endif /* CONFIG_VIDEO_OMAP3 */
557
493static void __init cm_t35_init_i2c(void) 558static void __init cm_t35_init_i2c(void)
494{ 559{
495 omap3_pmic_get_config(&cm_t35_twldata, TWL_COMMON_PDATA_USB, 560 omap3_pmic_get_config(&cm_t35_twldata, TWL_COMMON_PDATA_USB,
@@ -497,6 +562,8 @@ static void __init cm_t35_init_i2c(void)
497 TWL_COMMON_PDATA_AUDIO); 562 TWL_COMMON_PDATA_AUDIO);
498 563
499 omap3_pmic_init("tps65930", &cm_t35_twldata); 564 omap3_pmic_init("tps65930", &cm_t35_twldata);
565
566 omap_register_i2c_bus(3, 400, NULL, 0);
500} 567}
501 568
502#ifdef CONFIG_OMAP_MUX 569#ifdef CONFIG_OMAP_MUX
@@ -574,6 +641,27 @@ static struct omap_board_mux board_mux[] __initdata = {
574 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 641 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
575 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 642 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
576 643
644 /* Camera */
645 OMAP3_MUX(CAM_HS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
646 OMAP3_MUX(CAM_VS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
647 OMAP3_MUX(CAM_XCLKA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
648 OMAP3_MUX(CAM_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
649 OMAP3_MUX(CAM_FLD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
650 OMAP3_MUX(CAM_D0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
651 OMAP3_MUX(CAM_D1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
652 OMAP3_MUX(CAM_D2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
653 OMAP3_MUX(CAM_D3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
654 OMAP3_MUX(CAM_D4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
655 OMAP3_MUX(CAM_D5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
656 OMAP3_MUX(CAM_D6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
657 OMAP3_MUX(CAM_D7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
658 OMAP3_MUX(CAM_D8, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
659 OMAP3_MUX(CAM_D9, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
660 OMAP3_MUX(CAM_STROBE, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
661
662 OMAP3_MUX(CAM_D10, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLDOWN),
663 OMAP3_MUX(CAM_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLDOWN),
664
577 /* display controls */ 665 /* display controls */
578 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 666 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
579 OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 667 OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
@@ -646,6 +734,7 @@ static void __init cm_t3x_common_init(void)
646 734
647 usb_musb_init(NULL); 735 usb_musb_init(NULL);
648 cm_t35_init_usbh(); 736 cm_t35_init_usbh();
737 cm_t35_init_camera();
649} 738}
650 739
651static void __init cm_t35_init(void) 740static void __init cm_t35_init(void)
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 70a81f900bb5..53c39d239d6e 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -97,11 +97,6 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
97 97
98 gpmc_onenand_init(&board_onenand_data); 98 gpmc_onenand_init(&board_onenand_data);
99} 99}
100#else
101void
102__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
103{
104}
105#endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */ 100#endif /* CONFIG_MTD_ONENAND_OMAP2 || CONFIG_MTD_ONENAND_OMAP2_MODULE */
106 101
107#if defined(CONFIG_MTD_NAND_OMAP2) || \ 102#if defined(CONFIG_MTD_NAND_OMAP2) || \
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 202934657867..6f93a20536ea 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -25,23 +25,12 @@
25#include "common-board-devices.h" 25#include "common-board-devices.h"
26 26
27#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)) 27#if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
28#define omap_intc_of_init NULL 28#define intc_of_init NULL
29#endif 29#endif
30#ifndef CONFIG_ARCH_OMAP4 30#ifndef CONFIG_ARCH_OMAP4
31#define gic_of_init NULL 31#define gic_of_init NULL
32#endif 32#endif
33 33
34static struct of_device_id irq_match[] __initdata = {
35 { .compatible = "ti,omap2-intc", .data = omap_intc_of_init, },
36 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
37 { }
38};
39
40static void __init omap_init_irq(void)
41{
42 of_irq_init(irq_match);
43}
44
45static struct of_device_id omap_dt_match_table[] __initdata = { 34static struct of_device_id omap_dt_match_table[] __initdata = {
46 { .compatible = "simple-bus", }, 35 { .compatible = "simple-bus", },
47 { .compatible = "ti,omap-infra", }, 36 { .compatible = "ti,omap-infra", },
@@ -65,7 +54,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
65 .reserve = omap_reserve, 54 .reserve = omap_reserve,
66 .map_io = omap242x_map_io, 55 .map_io = omap242x_map_io,
67 .init_early = omap2420_init_early, 56 .init_early = omap2420_init_early,
68 .init_irq = omap_init_irq, 57 .init_irq = omap_intc_of_init,
69 .handle_irq = omap2_intc_handle_irq, 58 .handle_irq = omap2_intc_handle_irq,
70 .init_machine = omap_generic_init, 59 .init_machine = omap_generic_init,
71 .timer = &omap2_timer, 60 .timer = &omap2_timer,
@@ -84,7 +73,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
84 .reserve = omap_reserve, 73 .reserve = omap_reserve,
85 .map_io = omap243x_map_io, 74 .map_io = omap243x_map_io,
86 .init_early = omap2430_init_early, 75 .init_early = omap2430_init_early,
87 .init_irq = omap_init_irq, 76 .init_irq = omap_intc_of_init,
88 .handle_irq = omap2_intc_handle_irq, 77 .handle_irq = omap2_intc_handle_irq,
89 .init_machine = omap_generic_init, 78 .init_machine = omap_generic_init,
90 .timer = &omap2_timer, 79 .timer = &omap2_timer,
@@ -103,7 +92,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
103 .reserve = omap_reserve, 92 .reserve = omap_reserve,
104 .map_io = omap3_map_io, 93 .map_io = omap3_map_io,
105 .init_early = omap3430_init_early, 94 .init_early = omap3430_init_early,
106 .init_irq = omap_init_irq, 95 .init_irq = omap_intc_of_init,
107 .handle_irq = omap3_intc_handle_irq, 96 .handle_irq = omap3_intc_handle_irq,
108 .init_machine = omap_generic_init, 97 .init_machine = omap_generic_init,
109 .timer = &omap3_timer, 98 .timer = &omap3_timer,
@@ -112,6 +101,24 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
112MACHINE_END 101MACHINE_END
113#endif 102#endif
114 103
104#ifdef CONFIG_SOC_AM33XX
105static const char *am33xx_boards_compat[] __initdata = {
106 "ti,am33xx",
107 NULL,
108};
109
110DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
111 .reserve = omap_reserve,
112 .map_io = am33xx_map_io,
113 .init_early = am33xx_init_early,
114 .init_irq = omap_intc_of_init,
115 .handle_irq = omap3_intc_handle_irq,
116 .init_machine = omap_generic_init,
117 .timer = &omap3_am33xx_timer,
118 .dt_compat = am33xx_boards_compat,
119MACHINE_END
120#endif
121
115#ifdef CONFIG_ARCH_OMAP4 122#ifdef CONFIG_ARCH_OMAP4
116static const char *omap4_boards_compat[] __initdata = { 123static const char *omap4_boards_compat[] __initdata = {
117 "ti,omap4", 124 "ti,omap4",
@@ -122,7 +129,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
122 .reserve = omap_reserve, 129 .reserve = omap_reserve,
123 .map_io = omap4_map_io, 130 .map_io = omap4_map_io,
124 .init_early = omap4430_init_early, 131 .init_early = omap4430_init_early,
125 .init_irq = omap_init_irq, 132 .init_irq = omap_gic_of_init,
126 .handle_irq = gic_handle_irq, 133 .handle_irq = gic_handle_irq,
127 .init_machine = omap_generic_init, 134 .init_machine = omap_generic_init,
128 .init_late = omap4430_init_late, 135 .init_late = omap4430_init_late,
@@ -131,3 +138,22 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
131 .restart = omap_prcm_restart, 138 .restart = omap_prcm_restart,
132MACHINE_END 139MACHINE_END
133#endif 140#endif
141
142#ifdef CONFIG_SOC_OMAP5
143static const char *omap5_boards_compat[] __initdata = {
144 "ti,omap5",
145 NULL,
146};
147
148DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
149 .reserve = omap_reserve,
150 .map_io = omap5_map_io,
151 .init_early = omap5_init_early,
152 .init_irq = omap_gic_of_init,
153 .handle_irq = gic_handle_irq,
154 .init_machine = omap_generic_init,
155 .timer = &omap5_timer,
156 .dt_compat = omap5_boards_compat,
157 .restart = omap_prcm_restart,
158MACHINE_END
159#endif
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 876becf8205a..ace20482e3e1 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -32,7 +32,6 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <plat/usb.h>
36#include <plat/board.h> 35#include <plat/board.h>
37#include "common.h" 36#include "common.h"
38#include <plat/menelaus.h> 37#include <plat/menelaus.h>
@@ -329,17 +328,6 @@ static void __init h4_init_flash(void)
329 h4_flash_resource.end = base + SZ_64M - 1; 328 h4_flash_resource.end = base + SZ_64M - 1;
330} 329}
331 330
332static struct omap_usb_config h4_usb_config __initdata = {
333 /* S1.10 OFF -- usb "download port"
334 * usb0 switched to Mini-B port and isp1105 transceiver;
335 * S2.POS3 = ON, S2.POS4 = OFF ... to enable battery charging
336 */
337 .register_dev = 1,
338 .pins[0] = 3,
339/* .hmc_mode = 0x14,*/ /* 0:dev 1:host 2:disable */
340 .hmc_mode = 0x00, /* 0:dev|otg 1:disable 2:disable */
341};
342
343static struct at24_platform_data m24c01 = { 331static struct at24_platform_data m24c01 = {
344 .byte_len = SZ_1K / 8, 332 .byte_len = SZ_1K / 8,
345 .page_size = 16, 333 .page_size = 16,
@@ -381,7 +369,6 @@ static void __init omap_h4_init(void)
381 ARRAY_SIZE(h4_i2c_board_info)); 369 ARRAY_SIZE(h4_i2c_board_info));
382 370
383 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices)); 371 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
384 omap2_usbfs_init(&h4_usb_config);
385 omap_serial_init(); 372 omap_serial_init();
386 omap_sdrc_init(NULL, NULL); 373 omap_sdrc_init(NULL, NULL);
387 h4_init_flash(); 374 h4_init_flash();
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 8ca14e88a31a..2c5d0ed75285 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -83,11 +83,9 @@ static struct musb_hdrc_config musb_config = {
83}; 83};
84 84
85static struct musb_hdrc_platform_data tusb_data = { 85static struct musb_hdrc_platform_data tusb_data = {
86#if defined(CONFIG_USB_MUSB_OTG) 86#ifdef CONFIG_USB_GADGET_MUSB_HDRC
87 .mode = MUSB_OTG, 87 .mode = MUSB_OTG,
88#elif defined(CONFIG_USB_MUSB_PERIPHERAL) 88#else
89 .mode = MUSB_PERIPHERAL,
90#else /* defined(CONFIG_USB_MUSB_HOST) */
91 .mode = MUSB_HOST, 89 .mode = MUSB_HOST,
92#endif 90#endif
93 .set_power = tusb_set_power, 91 .set_power = tusb_set_power,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 79c6909eeb78..6202fc76e490 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
81static struct { 81static struct {
82 int mmc1_gpio_wp; 82 int mmc1_gpio_wp;
83 int usb_pwr_level; 83 int usb_pwr_level;
84 int reset_gpio; 84 int dvi_pd_gpio;
85 int usr_button_gpio; 85 int usr_button_gpio;
86 int mmc_caps; 86 int mmc_caps;
87} beagle_config = { 87} beagle_config = {
88 .mmc1_gpio_wp = -EINVAL, 88 .mmc1_gpio_wp = -EINVAL,
89 .usb_pwr_level = GPIOF_OUT_INIT_LOW, 89 .usb_pwr_level = GPIOF_OUT_INIT_LOW,
90 .reset_gpio = 129, 90 .dvi_pd_gpio = -EINVAL,
91 .usr_button_gpio = 4, 91 .usr_button_gpio = 4,
92 .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 92 .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
93}; 93};
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
126 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n"); 126 printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
127 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX; 127 omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
128 beagle_config.mmc1_gpio_wp = 29; 128 beagle_config.mmc1_gpio_wp = 29;
129 beagle_config.reset_gpio = 170; 129 beagle_config.dvi_pd_gpio = 170;
130 beagle_config.usr_button_gpio = 7; 130 beagle_config.usr_button_gpio = 7;
131 break; 131 break;
132 case 6: 132 case 6:
133 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n"); 133 printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
134 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3; 134 omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
135 beagle_config.mmc1_gpio_wp = 23; 135 beagle_config.mmc1_gpio_wp = 23;
136 beagle_config.reset_gpio = 170; 136 beagle_config.dvi_pd_gpio = 170;
137 beagle_config.usr_button_gpio = 7; 137 beagle_config.usr_button_gpio = 7;
138 break; 138 break;
139 case 5: 139 case 5:
140 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n"); 140 printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
141 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4; 141 omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
142 beagle_config.mmc1_gpio_wp = 23; 142 beagle_config.mmc1_gpio_wp = 23;
143 beagle_config.reset_gpio = 170; 143 beagle_config.dvi_pd_gpio = 170;
144 beagle_config.usr_button_gpio = 7; 144 beagle_config.usr_button_gpio = 7;
145 break; 145 break;
146 case 0: 146 case 0:
@@ -274,11 +274,9 @@ static int beagle_twl_gpio_setup(struct device *dev,
274 if (r) 274 if (r)
275 pr_err("%s: unable to configure nDVI_PWR_EN\n", 275 pr_err("%s: unable to configure nDVI_PWR_EN\n",
276 __func__); 276 __func__);
277 r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, 277
278 "DVI_LDO_EN"); 278 beagle_config.dvi_pd_gpio = gpio + 2;
279 if (r) 279
280 pr_err("%s: unable to configure DVI_LDO_EN\n",
281 __func__);
282 } else { 280 } else {
283 /* 281 /*
284 * REVISIT: need ehci-omap hooks for external VBUS 282 * REVISIT: need ehci-omap hooks for external VBUS
@@ -287,7 +285,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
287 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 285 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
288 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 286 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
289 } 287 }
290 dvi_panel.power_down_gpio = beagle_config.reset_gpio; 288 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
291 289
292 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, 290 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
293 "nEN_USB_PWR"); 291 "nEN_USB_PWR");
@@ -435,7 +433,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
435 433
436static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 434static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
437 435
438 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 436 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
439 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 437 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
440 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 438 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
441 439
@@ -499,7 +497,7 @@ static void __init omap3_beagle_init(void)
499 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 497 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
500 omap3_beagle_init_rev(); 498 omap3_beagle_init_rev();
501 499
502 if (beagle_config.mmc1_gpio_wp != -EINVAL) 500 if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
503 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT); 501 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
504 mmc[0].caps = beagle_config.mmc_caps; 502 mmc[0].caps = beagle_config.mmc_caps;
505 omap_hsmmc_init(mmc); 503 omap_hsmmc_init(mmc);
@@ -510,15 +508,13 @@ static void __init omap3_beagle_init(void)
510 508
511 platform_add_devices(omap3_beagle_devices, 509 platform_add_devices(omap3_beagle_devices,
512 ARRAY_SIZE(omap3_beagle_devices)); 510 ARRAY_SIZE(omap3_beagle_devices));
511 if (gpio_is_valid(beagle_config.dvi_pd_gpio))
512 omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT);
513 omap_display_init(&beagle_dss_data); 513 omap_display_init(&beagle_dss_data);
514 omap_serial_init(); 514 omap_serial_init();
515 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 515 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
516 mt46h32m32lf6_sdrc_params); 516 mt46h32m32lf6_sdrc_params);
517 517
518 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
519 /* REVISIT leave DVI powered down until it's needed ... */
520 gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
521
522 usb_musb_init(NULL); 518 usb_musb_init(NULL);
523 usbhs_init(&usbhs_bdata); 519 usbhs_init(&usbhs_bdata);
524 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 520 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 639bd07ea38a..ef230a0eb5eb 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -24,6 +24,10 @@
24#include <linux/leds.h> 24#include <linux/leds.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26 26
27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand.h>
30
27#include <linux/spi/spi.h> 31#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 32#include <linux/spi/ads7846.h>
29#include <linux/i2c/twl.h> 33#include <linux/i2c/twl.h>
@@ -43,6 +47,7 @@
43 47
44#include <plat/board.h> 48#include <plat/board.h>
45#include <plat/usb.h> 49#include <plat/usb.h>
50#include <plat/nand.h>
46#include "common.h" 51#include "common.h"
47#include <plat/mcspi.h> 52#include <plat/mcspi.h>
48#include <video/omapdss.h> 53#include <video/omapdss.h>
@@ -53,7 +58,6 @@
53#include "hsmmc.h" 58#include "hsmmc.h"
54#include "common-board-devices.h" 59#include "common-board-devices.h"
55 60
56#define OMAP3_EVM_TS_GPIO 175
57#define OMAP3_EVM_EHCI_VBUS 22 61#define OMAP3_EVM_EHCI_VBUS 22
58#define OMAP3_EVM_EHCI_SELECT 61 62#define OMAP3_EVM_EHCI_SELECT 61
59 63
@@ -355,6 +359,19 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
355 359
356 platform_device_register(&leds_gpio); 360 platform_device_register(&leds_gpio);
357 361
362 /* Enable VBUS switch by setting TWL4030.GPIO2DIR as output
363 * for starting USB tranceiver
364 */
365#ifdef CONFIG_TWL4030_CORE
366 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
367 u8 val;
368
369 twl_i2c_read_u8(TWL4030_MODULE_GPIO, &val, REG_GPIODATADIR1);
370 val |= 0x04; /* TWL4030.GPIO2DIR BIT at GPIODATADIR1(0x9B) */
371 twl_i2c_write_u8(TWL4030_MODULE_GPIO, val, REG_GPIODATADIR1);
372 }
373#endif
374
358 return 0; 375 return 0;
359} 376}
360 377
@@ -461,6 +478,28 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
461}; 478};
462#endif 479#endif
463 480
481/* VAUX2 for USB */
482static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
483 REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */
484 REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */
485 REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
486 REGULATOR_SUPPLY("vaux2", NULL),
487};
488
489static struct regulator_init_data omap3evm_vaux2 = {
490 .constraints = {
491 .min_uV = 2800000,
492 .max_uV = 2800000,
493 .apply_uV = true,
494 .valid_modes_mask = REGULATOR_MODE_NORMAL
495 | REGULATOR_MODE_STANDBY,
496 .valid_ops_mask = REGULATOR_CHANGE_MODE
497 | REGULATOR_CHANGE_STATUS,
498 },
499 .num_consumer_supplies = ARRAY_SIZE(omap3evm_vaux2_supplies),
500 .consumer_supplies = omap3evm_vaux2_supplies,
501};
502
464static struct twl4030_platform_data omap3evm_twldata = { 503static struct twl4030_platform_data omap3evm_twldata = {
465 /* platform_data for children goes here */ 504 /* platform_data for children goes here */
466 .keypad = &omap3evm_kp_data, 505 .keypad = &omap3evm_kp_data,
@@ -607,6 +646,37 @@ static struct regulator_consumer_supply dummy_supplies[] = {
607 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), 646 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
608}; 647};
609 648
649static struct mtd_partition omap3evm_nand_partitions[] = {
650 /* All the partition sizes are listed in terms of NAND block size */
651 {
652 .name = "X-Loader",
653 .offset = 0,
654 .size = 4*(SZ_128K),
655 .mask_flags = MTD_WRITEABLE
656 },
657 {
658 .name = "U-Boot",
659 .offset = MTDPART_OFS_APPEND,
660 .size = 14*(SZ_128K),
661 .mask_flags = MTD_WRITEABLE
662 },
663 {
664 .name = "U-Boot Env",
665 .offset = MTDPART_OFS_APPEND,
666 .size = 2*(SZ_128K)
667 },
668 {
669 .name = "Kernel",
670 .offset = MTDPART_OFS_APPEND,
671 .size = 40*(SZ_128K)
672 },
673 {
674 .name = "File system",
675 .size = MTDPART_SIZ_FULL,
676 .offset = MTDPART_OFS_APPEND,
677 },
678};
679
610static void __init omap3_evm_init(void) 680static void __init omap3_evm_init(void)
611{ 681{
612 struct omap_board_mux *obm; 682 struct omap_board_mux *obm;
@@ -623,6 +693,9 @@ static void __init omap3_evm_init(void)
623 omap_mux_init_gpio(63, OMAP_PIN_INPUT); 693 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
624 omap_hsmmc_init(mmc); 694 omap_hsmmc_init(mmc);
625 695
696 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
697 omap3evm_twldata.vaux2 = &omap3evm_vaux2;
698
626 omap3_evm_i2c_init(); 699 omap3_evm_i2c_init();
627 700
628 omap_display_init(&omap3_evm_dss_data); 701 omap_display_init(&omap3_evm_dss_data);
@@ -656,6 +729,9 @@ static void __init omap3_evm_init(void)
656 } 729 }
657 usb_musb_init(&musb_board_data); 730 usb_musb_init(&musb_board_data);
658 usbhs_init(&usbhs_bdata); 731 usbhs_init(&usbhs_bdata);
732 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
733 ARRAY_SIZE(omap3evm_nand_partitions));
734
659 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 735 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
660 omap3evm_init_smsc911x(); 736 omap3evm_init_smsc911x();
661 omap3_evm_display_init(); 737 omap3_evm_display_init();
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 932e1778aff9..fca93d1afd43 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -93,9 +93,6 @@ static struct twl4030_usb_data omap3logic_usb_data = {
93 93
94 94
95static struct twl4030_platform_data omap3logic_twldata = { 95static struct twl4030_platform_data omap3logic_twldata = {
96 .irq_base = TWL4030_IRQ_BASE,
97 .irq_end = TWL4030_IRQ_END,
98
99 /* platform_data for children goes here */ 96 /* platform_data for children goes here */
100 .gpio = &omap3logic_gpio_data, 97 .gpio = &omap3logic_gpio_data,
101 .vmmc1 = &omap3logic_vmmc1, 98 .vmmc1 = &omap3logic_vmmc1,
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 982fb2622ab8..70f6d1d25463 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -106,7 +106,7 @@ static struct platform_device leds_gpio = {
106static struct omap_abe_twl6040_data panda_abe_audio_data = { 106static struct omap_abe_twl6040_data panda_abe_audio_data = {
107 /* Audio out */ 107 /* Audio out */
108 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, 108 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
109 /* HandsFree through expasion connector */ 109 /* HandsFree through expansion connector */
110 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, 110 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
111 /* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */ 111 /* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */
112 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, 112 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
@@ -379,6 +379,9 @@ static struct omap_board_mux board_mux[] __initdata = {
379 OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), 379 OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
380 /* dispc2_data0 */ 380 /* dispc2_data0 */
381 OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5), 381 OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
382 /* NIRQ2 for twl6040 */
383 OMAP4_MUX(SYS_NIRQ2, OMAP_MUX_MODE0 |
384 OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
382 { .reg_offset = OMAP_MUX_TERMINATOR }, 385 { .reg_offset = OMAP_MUX_TERMINATOR },
383}; 386};
384 387
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 8fa2fc3a4c3c..779734d8ba37 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -494,8 +494,8 @@ static void __init overo_init(void)
494 494
495 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 495 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
496 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 496 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
497 omap_hsmmc_init(mmc);
498 overo_i2c_init(); 497 overo_i2c_init();
498 omap_hsmmc_init(mmc);
499 omap_display_init(&overo_dss_data); 499 omap_display_init(&overo_dss_data);
500 omap_serial_init(); 500 omap_serial_init();
501 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 501 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index ff53deccecab..df2534de3361 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -144,7 +144,6 @@ static struct lis3lv02d_platform_data rx51_lis3lv02d_data = {
144 .release_resources = lis302_release, 144 .release_resources = lis302_release,
145 .st_min_limits = {-32, 3, 3}, 145 .st_min_limits = {-32, 3, 3},
146 .st_max_limits = {-3, 32, 32}, 146 .st_max_limits = {-3, 32, 32},
147 .irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO),
148}; 147};
149#endif 148#endif
150 149
@@ -1030,7 +1029,6 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
1030 { 1029 {
1031 I2C_BOARD_INFO("lis3lv02d", 0x1d), 1030 I2C_BOARD_INFO("lis3lv02d", 0x1d),
1032 .platform_data = &rx51_lis3lv02d_data, 1031 .platform_data = &rx51_lis3lv02d_data,
1033 .irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO),
1034 }, 1032 },
1035#endif 1033#endif
1036}; 1034};
@@ -1056,6 +1054,10 @@ static int __init rx51_i2c_init(void)
1056 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); 1054 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
1057 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 1055 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
1058 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 1056 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
1057#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
1058 rx51_lis3lv02d_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
1059 rx51_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
1060#endif
1059 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3, 1061 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
1060 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3)); 1062 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
1061 return 0; 1063 return 0;
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 5c4e66542169..ea3f565ba1a4 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -398,24 +398,6 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
398 return omap2_clksel_set_parent(clk, new_parent); 398 return omap2_clksel_set_parent(clk, new_parent);
399} 399}
400 400
401/* OMAP3/4 non-CORE DPLL clkops */
402
403#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
404
405const struct clkops clkops_omap3_noncore_dpll_ops = {
406 .enable = omap3_noncore_dpll_enable,
407 .disable = omap3_noncore_dpll_disable,
408 .allow_idle = omap3_dpll_allow_idle,
409 .deny_idle = omap3_dpll_deny_idle,
410};
411
412const struct clkops clkops_omap3_core_dpll_ops = {
413 .allow_idle = omap3_dpll_allow_idle,
414 .deny_idle = omap3_dpll_deny_idle,
415};
416
417#endif
418
419/* 401/*
420 * OMAP2+ clock reset and init functions 402 * OMAP2+ clock reset and init functions
421 */ 403 */
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index a1bb23a23351..35ec5f3d9a73 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -155,4 +155,18 @@ extern const struct clkops clkops_omap3_noncore_dpll_ops;
155extern const struct clkops clkops_omap3_core_dpll_ops; 155extern const struct clkops clkops_omap3_core_dpll_ops;
156extern const struct clkops clkops_omap4_dpllmx_ops; 156extern const struct clkops clkops_omap4_dpllmx_ops;
157 157
158/* clksel_rate blocks shared between OMAP44xx and AM33xx */
159extern const struct clksel_rate div_1_0_rates[];
160extern const struct clksel_rate div_1_1_rates[];
161extern const struct clksel_rate div_1_2_rates[];
162extern const struct clksel_rate div_1_3_rates[];
163extern const struct clksel_rate div_1_4_rates[];
164extern const struct clksel_rate div31_1to31_rates[];
165
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);
171
158#endif 172#endif
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index bace9308a4db..002745181ad6 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1774,8 +1774,6 @@ static struct omap_clk omap2420_clks[] = {
1774 CLK(NULL, "osc_ck", &osc_ck, CK_242X), 1774 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1775 CLK(NULL, "sys_ck", &sys_ck, CK_242X), 1775 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1776 CLK(NULL, "alt_ck", &alt_ck, CK_242X), 1776 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1777 CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_242X),
1778 CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_242X),
1779 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X), 1777 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1780 /* internal analog sources */ 1778 /* internal analog sources */
1781 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X), 1779 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
@@ -1784,8 +1782,6 @@ static struct omap_clk omap2420_clks[] = {
1784 /* internal prcm root sources */ 1782 /* internal prcm root sources */
1785 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X), 1783 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1786 CLK(NULL, "core_ck", &core_ck, CK_242X), 1784 CLK(NULL, "core_ck", &core_ck, CK_242X),
1787 CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_242X),
1788 CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_242X),
1789 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X), 1785 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1790 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X), 1786 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1791 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X), 1787 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
@@ -1901,42 +1897,9 @@ static struct omap_clk omap2420_clks[] = {
1901 CLK(NULL, "pka_ick", &pka_ick, CK_242X), 1897 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1902 CLK(NULL, "usb_fck", &usb_fck, CK_242X), 1898 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1903 CLK("musb-hdrc", "fck", &osc_ck, CK_242X), 1899 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1904 CLK("omap_timer.1", "32k_ck", &func_32k_ck, CK_243X), 1900 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
1905 CLK("omap_timer.2", "32k_ck", &func_32k_ck, CK_243X), 1901 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
1906 CLK("omap_timer.3", "32k_ck", &func_32k_ck, CK_243X), 1902 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
1907 CLK("omap_timer.4", "32k_ck", &func_32k_ck, CK_243X),
1908 CLK("omap_timer.5", "32k_ck", &func_32k_ck, CK_243X),
1909 CLK("omap_timer.6", "32k_ck", &func_32k_ck, CK_243X),
1910 CLK("omap_timer.7", "32k_ck", &func_32k_ck, CK_243X),
1911 CLK("omap_timer.8", "32k_ck", &func_32k_ck, CK_243X),
1912 CLK("omap_timer.9", "32k_ck", &func_32k_ck, CK_243X),
1913 CLK("omap_timer.10", "32k_ck", &func_32k_ck, CK_243X),
1914 CLK("omap_timer.11", "32k_ck", &func_32k_ck, CK_243X),
1915 CLK("omap_timer.12", "32k_ck", &func_32k_ck, CK_243X),
1916 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_243X),
1917 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_243X),
1918 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_243X),
1919 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_243X),
1920 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_243X),
1921 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_243X),
1922 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_243X),
1923 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_243X),
1924 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_243X),
1925 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_243X),
1926 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_243X),
1927 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_243X),
1928 CLK("omap_timer.1", "alt_ck", &alt_ck, CK_243X),
1929 CLK("omap_timer.2", "alt_ck", &alt_ck, CK_243X),
1930 CLK("omap_timer.3", "alt_ck", &alt_ck, CK_243X),
1931 CLK("omap_timer.4", "alt_ck", &alt_ck, CK_243X),
1932 CLK("omap_timer.5", "alt_ck", &alt_ck, CK_243X),
1933 CLK("omap_timer.6", "alt_ck", &alt_ck, CK_243X),
1934 CLK("omap_timer.7", "alt_ck", &alt_ck, CK_243X),
1935 CLK("omap_timer.8", "alt_ck", &alt_ck, CK_243X),
1936 CLK("omap_timer.9", "alt_ck", &alt_ck, CK_243X),
1937 CLK("omap_timer.10", "alt_ck", &alt_ck, CK_243X),
1938 CLK("omap_timer.11", "alt_ck", &alt_ck, CK_243X),
1939 CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X),
1940}; 1903};
1941 1904
1942/* 1905/*
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 3b4d09a50399..cacabb070e22 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1858,11 +1858,6 @@ static struct omap_clk omap2430_clks[] = {
1858 CLK(NULL, "osc_ck", &osc_ck, CK_243X), 1858 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1859 CLK(NULL, "sys_ck", &sys_ck, CK_243X), 1859 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1860 CLK(NULL, "alt_ck", &alt_ck, CK_243X), 1860 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1861 CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_243X),
1862 CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_243X),
1863 CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_243X),
1864 CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_243X),
1865 CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_243X),
1866 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X), 1861 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1867 /* internal analog sources */ 1862 /* internal analog sources */
1868 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X), 1863 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
@@ -1871,11 +1866,6 @@ static struct omap_clk omap2430_clks[] = {
1871 /* internal prcm root sources */ 1866 /* internal prcm root sources */
1872 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X), 1867 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1873 CLK(NULL, "core_ck", &core_ck, CK_243X), 1868 CLK(NULL, "core_ck", &core_ck, CK_243X),
1874 CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_243X),
1875 CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_243X),
1876 CLK("omap-mcbsp.3", "prcm_fck", &func_96m_ck, CK_243X),
1877 CLK("omap-mcbsp.4", "prcm_fck", &func_96m_ck, CK_243X),
1878 CLK("omap-mcbsp.5", "prcm_fck", &func_96m_ck, CK_243X),
1879 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X), 1869 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1880 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X), 1870 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1881 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X), 1871 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
@@ -2000,42 +1990,9 @@ static struct omap_clk omap2430_clks[] = {
2000 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X), 1990 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2001 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X), 1991 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2002 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X), 1992 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2003 CLK("omap_timer.1", "32k_ck", &func_32k_ck, CK_243X), 1993 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2004 CLK("omap_timer.2", "32k_ck", &func_32k_ck, CK_243X), 1994 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2005 CLK("omap_timer.3", "32k_ck", &func_32k_ck, CK_243X), 1995 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2006 CLK("omap_timer.4", "32k_ck", &func_32k_ck, CK_243X),
2007 CLK("omap_timer.5", "32k_ck", &func_32k_ck, CK_243X),
2008 CLK("omap_timer.6", "32k_ck", &func_32k_ck, CK_243X),
2009 CLK("omap_timer.7", "32k_ck", &func_32k_ck, CK_243X),
2010 CLK("omap_timer.8", "32k_ck", &func_32k_ck, CK_243X),
2011 CLK("omap_timer.9", "32k_ck", &func_32k_ck, CK_243X),
2012 CLK("omap_timer.10", "32k_ck", &func_32k_ck, CK_243X),
2013 CLK("omap_timer.11", "32k_ck", &func_32k_ck, CK_243X),
2014 CLK("omap_timer.12", "32k_ck", &func_32k_ck, CK_243X),
2015 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_243X),
2016 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_243X),
2017 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_243X),
2018 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_243X),
2019 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_243X),
2020 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_243X),
2021 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_243X),
2022 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_243X),
2023 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_243X),
2024 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_243X),
2025 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_243X),
2026 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_243X),
2027 CLK("omap_timer.1", "alt_ck", &alt_ck, CK_243X),
2028 CLK("omap_timer.2", "alt_ck", &alt_ck, CK_243X),
2029 CLK("omap_timer.3", "alt_ck", &alt_ck, CK_243X),
2030 CLK("omap_timer.4", "alt_ck", &alt_ck, CK_243X),
2031 CLK("omap_timer.5", "alt_ck", &alt_ck, CK_243X),
2032 CLK("omap_timer.6", "alt_ck", &alt_ck, CK_243X),
2033 CLK("omap_timer.7", "alt_ck", &alt_ck, CK_243X),
2034 CLK("omap_timer.8", "alt_ck", &alt_ck, CK_243X),
2035 CLK("omap_timer.9", "alt_ck", &alt_ck, CK_243X),
2036 CLK("omap_timer.10", "alt_ck", &alt_ck, CK_243X),
2037 CLK("omap_timer.11", "alt_ck", &alt_ck, CK_243X),
2038 CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X),
2039}; 1996};
2040 1997
2041/* 1998/*
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
new file mode 100644
index 000000000000..25bbcc7ca4dc
--- /dev/null
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -0,0 +1,1105 @@
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#include <plat/am33xx.h>
22
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 smartreflex0_fck = {
552 .name = "smartreflex0_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 smartreflex1_fck = {
560 .name = "smartreflex1_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(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
1017 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
1018 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
1019 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
1020 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
1021 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
1022 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
1023 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
1024 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
1025 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
1026 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
1027 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
1028 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
1029 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
1030 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
1031 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
1032 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
1033 CLK("davinci-mcasp.0", NULL, &mcasp0_fck, CK_AM33XX),
1034 CLK("davinci-mcasp.1", NULL, &mcasp1_fck, CK_AM33XX),
1035 CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX),
1036 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
1037 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
1038 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
1039 CLK(NULL, "gpt1_fck", &timer1_fck, CK_AM33XX),
1040 CLK(NULL, "gpt2_fck", &timer2_fck, CK_AM33XX),
1041 CLK(NULL, "gpt3_fck", &timer3_fck, CK_AM33XX),
1042 CLK(NULL, "gpt4_fck", &timer4_fck, CK_AM33XX),
1043 CLK(NULL, "gpt5_fck", &timer5_fck, CK_AM33XX),
1044 CLK(NULL, "gpt6_fck", &timer6_fck, CK_AM33XX),
1045 CLK(NULL, "gpt7_fck", &timer7_fck, CK_AM33XX),
1046 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
1047 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
1048 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
1049 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
1050 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
1051 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
1052 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
1053 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
1054 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
1055 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
1056 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
1057 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
1058 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
1059 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
1060 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
1061 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
1062 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
1063 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
1064 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
1065 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
1066 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
1067 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
1068 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
1069 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
1070 CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX),
1071};
1072
1073int __init am33xx_clk_init(void)
1074{
1075 struct omap_clk *c;
1076 u32 cpu_clkflg;
1077
1078 if (soc_is_am33xx()) {
1079 cpu_mask = RATE_IN_AM33XX;
1080 cpu_clkflg = CK_AM33XX;
1081 }
1082
1083 clk_init(&omap2_clk_functions);
1084
1085 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
1086 clk_preinit(c->lk.clk);
1087
1088 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
1089 if (c->cpu & cpu_clkflg) {
1090 clkdev_add(&c->lk);
1091 clk_register(c->lk.clk);
1092 omap2_init_clk_clkdm(c->lk.clk);
1093 }
1094 }
1095
1096 recalculate_root_clocks();
1097
1098 /*
1099 * Only enable those clocks we will need, let the drivers
1100 * enable other clocks as necessary
1101 */
1102 clk_enable_init_clocks();
1103
1104 return 0;
1105}
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0e8cc8..83bed9ad3017 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -93,18 +93,6 @@ static struct clk virt_16_8m_ck = {
93 .rate = 16800000, 93 .rate = 16800000,
94}; 94};
95 95
96static struct clk virt_19_2m_ck = {
97 .name = "virt_19_2m_ck",
98 .ops = &clkops_null,
99 .rate = 19200000,
100};
101
102static struct clk virt_26m_ck = {
103 .name = "virt_26m_ck",
104 .ops = &clkops_null,
105 .rate = 26000000,
106};
107
108static struct clk virt_38_4m_ck = { 96static struct clk virt_38_4m_ck = {
109 .name = "virt_38_4m_ck", 97 .name = "virt_38_4m_ck",
110 .ops = &clkops_null, 98 .ops = &clkops_null,
@@ -145,8 +133,8 @@ static const struct clksel osc_sys_clksel[] = {
145 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates }, 133 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
146 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates }, 134 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
147 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates }, 135 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
148 { .parent = &virt_19_2m_ck, .rates = osc_sys_19_2m_rates }, 136 { .parent = &virt_19200000_ck, .rates = osc_sys_19_2m_rates },
149 { .parent = &virt_26m_ck, .rates = osc_sys_26m_rates }, 137 { .parent = &virt_26000000_ck, .rates = osc_sys_26m_rates },
150 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates }, 138 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
151 { .parent = NULL }, 139 { .parent = NULL },
152}; 140};
@@ -2490,13 +2478,13 @@ static struct clk uart4_fck = {
2490}; 2478};
2491 2479
2492static struct clk uart4_fck_am35xx = { 2480static struct clk uart4_fck_am35xx = {
2493 .name = "uart4_fck", 2481 .name = "uart4_fck",
2494 .ops = &clkops_omap2_dflt_wait, 2482 .ops = &clkops_omap2_dflt_wait,
2495 .parent = &per_48m_fck, 2483 .parent = &core_48m_fck,
2496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2497 .enable_bit = OMAP3430_EN_UART4_SHIFT, 2485 .enable_bit = AM35XX_EN_UART4_SHIFT,
2498 .clkdm_name = "core_l4_clkdm", 2486 .clkdm_name = "core_l4_clkdm",
2499 .recalc = &followparent_recalc, 2487 .recalc = &followparent_recalc,
2500}; 2488};
2501 2489
2502static struct clk gpt2_fck = { 2490static struct clk gpt2_fck = {
@@ -3201,8 +3189,12 @@ static struct clk vpfe_fck = {
3201}; 3189};
3202 3190
3203/* 3191/*
3204 * The UART1/2 functional clock acts as the functional 3192 * The UART1/2 functional clock acts as the functional clock for
3205 * clock for UART4. No separate fclk control available. 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.
3206 */ 3198 */
3207static struct clk uart4_ick_am35xx = { 3199static struct clk uart4_ick_am35xx = {
3208 .name = "uart4_ick", 3200 .name = "uart4_ick",
@@ -3230,17 +3222,12 @@ static struct omap_clk omap3xxx_clks[] = {
3230 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX), 3222 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3231 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX), 3223 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3232 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3224 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3233 CLK(NULL, "virt_19_2m_ck", &virt_19_2m_ck, CK_3XXX), 3225 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3234 CLK(NULL, "virt_26m_ck", &virt_26m_ck, CK_3XXX), 3226 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3235 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX), 3227 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3236 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX), 3228 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3237 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX), 3229 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3238 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX), 3230 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3239 CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_3XXX),
3240 CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_3XXX),
3241 CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_3XXX),
3242 CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_3XXX),
3243 CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_3XXX),
3244 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX), 3231 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3245 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX), 3232 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3246 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX), 3233 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
@@ -3307,8 +3294,6 @@ static struct omap_clk omap3xxx_clks[] = {
3307 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3294 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3308 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3295 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3309 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3296 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3310 CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX),
3311 CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX),
3312 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), 3297 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3313 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3298 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3314 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX), 3299 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
@@ -3391,15 +3376,15 @@ static struct omap_clk omap3xxx_clks[] = {
3391 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3376 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3392 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3377 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3393 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3378 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3394 CLK("usbhs_omap", "utmi_p1_gfclk", &dummy_ck, CK_3XXX), 3379 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3395 CLK("usbhs_omap", "utmi_p2_gfclk", &dummy_ck, CK_3XXX), 3380 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3396 CLK("usbhs_omap", "xclk60mhsp1_ck", &dummy_ck, CK_3XXX), 3381 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3397 CLK("usbhs_omap", "xclk60mhsp2_ck", &dummy_ck, CK_3XXX), 3382 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3398 CLK("usbhs_omap", "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX), 3383 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3399 CLK("usbhs_omap", "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX), 3384 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3400 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX), 3385 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3401 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX), 3386 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3402 CLK("usbhs_omap", "init_60m_fclk", &dummy_ck, CK_3XXX), 3387 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3403 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX), 3388 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3404 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX), 3389 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3405 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX), 3390 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
@@ -3413,9 +3398,6 @@ static struct omap_clk omap3xxx_clks[] = {
3413 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX), 3398 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3414 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX), 3399 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3415 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX), 3400 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3416 CLK("omap-mcbsp.2", "prcm_fck", &per_96m_fck, CK_3XXX),
3417 CLK("omap-mcbsp.3", "prcm_fck", &per_96m_fck, CK_3XXX),
3418 CLK("omap-mcbsp.4", "prcm_fck", &per_96m_fck, CK_3XXX),
3419 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX), 3401 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3420 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), 3402 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3421 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), 3403 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
@@ -3474,38 +3456,16 @@ static struct omap_clk omap3xxx_clks[] = {
3474 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), 3456 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3475 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), 3457 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3476 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), 3458 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3477 CLK("davinci_emac", NULL, &emac_ick, CK_AM35XX), 3459 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3478 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX), 3460 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3479 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), 3461 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3480 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), 3462 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3481 CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX), 3463 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3482 CLK("musb-am35x", "fck", &hsotgusb_fck_am35xx, CK_AM35XX), 3464 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3483 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX), 3465 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3484 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX), 3466 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3485 CLK("omap_timer.1", "32k_ck", &omap_32k_fck, CK_3XXX), 3467 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3486 CLK("omap_timer.2", "32k_ck", &omap_32k_fck, CK_3XXX), 3468 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3487 CLK("omap_timer.3", "32k_ck", &omap_32k_fck, CK_3XXX),
3488 CLK("omap_timer.4", "32k_ck", &omap_32k_fck, CK_3XXX),
3489 CLK("omap_timer.5", "32k_ck", &omap_32k_fck, CK_3XXX),
3490 CLK("omap_timer.6", "32k_ck", &omap_32k_fck, CK_3XXX),
3491 CLK("omap_timer.7", "32k_ck", &omap_32k_fck, CK_3XXX),
3492 CLK("omap_timer.8", "32k_ck", &omap_32k_fck, CK_3XXX),
3493 CLK("omap_timer.9", "32k_ck", &omap_32k_fck, CK_3XXX),
3494 CLK("omap_timer.10", "32k_ck", &omap_32k_fck, CK_3XXX),
3495 CLK("omap_timer.11", "32k_ck", &omap_32k_fck, CK_3XXX),
3496 CLK("omap_timer.12", "32k_ck", &omap_32k_fck, CK_3XXX),
3497 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_3XXX),
3498 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_3XXX),
3499 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_3XXX),
3500 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_3XXX),
3501 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_3XXX),
3502 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_3XXX),
3503 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_3XXX),
3504 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_3XXX),
3505 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_3XXX),
3506 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_3XXX),
3507 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_3XXX),
3508 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_3XXX),
3509}; 3469};
3510 3470
3511 3471
@@ -3514,7 +3474,7 @@ int __init omap3xxx_clk_init(void)
3514 struct omap_clk *c; 3474 struct omap_clk *c;
3515 u32 cpu_clkflg = 0; 3475 u32 cpu_clkflg = 0;
3516 3476
3517 if (cpu_is_omap3517()) { 3477 if (soc_is_am35xx()) {
3518 cpu_mask = RATE_IN_34XX; 3478 cpu_mask = RATE_IN_34XX;
3519 cpu_clkflg = CK_AM35XX; 3479 cpu_clkflg = CK_AM35XX;
3520 } else if (cpu_is_omap3630()) { 3480 } else if (cpu_is_omap3630()) {
@@ -3523,7 +3483,7 @@ int __init omap3xxx_clk_init(void)
3523 } else if (cpu_is_ti816x()) { 3483 } else if (cpu_is_ti816x()) {
3524 cpu_mask = RATE_IN_TI816X; 3484 cpu_mask = RATE_IN_TI816X;
3525 cpu_clkflg = CK_TI816X; 3485 cpu_clkflg = CK_TI816X;
3526 } else if (cpu_is_am33xx()) { 3486 } else if (soc_is_am33xx()) {
3527 cpu_mask = RATE_IN_AM33XX; 3487 cpu_mask = RATE_IN_AM33XX;
3528 } else if (cpu_is_ti814x()) { 3488 } else if (cpu_is_ti814x()) {
3529 cpu_mask = RATE_IN_TI814X; 3489 cpu_mask = RATE_IN_TI814X;
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f6603848..d7f55e43b761 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -84,6 +84,7 @@ static struct clk slimbus_clk = {
84 84
85static struct clk sys_32k_ck = { 85static struct clk sys_32k_ck = {
86 .name = "sys_32k_ck", 86 .name = "sys_32k_ck",
87 .clkdm_name = "prm_clkdm",
87 .rate = 32768, 88 .rate = 32768,
88 .ops = &clkops_null, 89 .ops = &clkops_null,
89}; 90};
@@ -106,18 +107,6 @@ static struct clk virt_16800000_ck = {
106 .rate = 16800000, 107 .rate = 16800000,
107}; 108};
108 109
109static struct clk virt_19200000_ck = {
110 .name = "virt_19200000_ck",
111 .ops = &clkops_null,
112 .rate = 19200000,
113};
114
115static struct clk virt_26000000_ck = {
116 .name = "virt_26000000_ck",
117 .ops = &clkops_null,
118 .rate = 26000000,
119};
120
121static struct clk virt_27000000_ck = { 110static struct clk virt_27000000_ck = {
122 .name = "virt_27000000_ck", 111 .name = "virt_27000000_ck",
123 .ops = &clkops_null, 112 .ops = &clkops_null,
@@ -130,31 +119,6 @@ static struct clk virt_38400000_ck = {
130 .rate = 38400000, 119 .rate = 38400000,
131}; 120};
132 121
133static const struct clksel_rate div_1_0_rates[] = {
134 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
135 { .div = 0 },
136};
137
138static const struct clksel_rate div_1_1_rates[] = {
139 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
140 { .div = 0 },
141};
142
143static const struct clksel_rate div_1_2_rates[] = {
144 { .div = 1, .val = 2, .flags = RATE_IN_4430 },
145 { .div = 0 },
146};
147
148static const struct clksel_rate div_1_3_rates[] = {
149 { .div = 1, .val = 3, .flags = RATE_IN_4430 },
150 { .div = 0 },
151};
152
153static const struct clksel_rate div_1_4_rates[] = {
154 { .div = 1, .val = 4, .flags = RATE_IN_4430 },
155 { .div = 0 },
156};
157
158static const struct clksel_rate div_1_5_rates[] = { 122static const struct clksel_rate div_1_5_rates[] = {
159 { .div = 1, .val = 5, .flags = RATE_IN_4430 }, 123 { .div = 1, .val = 5, .flags = RATE_IN_4430 },
160 { .div = 0 }, 124 { .div = 0 },
@@ -288,41 +252,6 @@ static struct clk dpll_abe_x2_ck = {
288 .recalc = &omap3_clkoutx2_recalc, 252 .recalc = &omap3_clkoutx2_recalc,
289}; 253};
290 254
291static const struct clksel_rate div31_1to31_rates[] = {
292 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
293 { .div = 2, .val = 2, .flags = RATE_IN_4430 },
294 { .div = 3, .val = 3, .flags = RATE_IN_4430 },
295 { .div = 4, .val = 4, .flags = RATE_IN_4430 },
296 { .div = 5, .val = 5, .flags = RATE_IN_4430 },
297 { .div = 6, .val = 6, .flags = RATE_IN_4430 },
298 { .div = 7, .val = 7, .flags = RATE_IN_4430 },
299 { .div = 8, .val = 8, .flags = RATE_IN_4430 },
300 { .div = 9, .val = 9, .flags = RATE_IN_4430 },
301 { .div = 10, .val = 10, .flags = RATE_IN_4430 },
302 { .div = 11, .val = 11, .flags = RATE_IN_4430 },
303 { .div = 12, .val = 12, .flags = RATE_IN_4430 },
304 { .div = 13, .val = 13, .flags = RATE_IN_4430 },
305 { .div = 14, .val = 14, .flags = RATE_IN_4430 },
306 { .div = 15, .val = 15, .flags = RATE_IN_4430 },
307 { .div = 16, .val = 16, .flags = RATE_IN_4430 },
308 { .div = 17, .val = 17, .flags = RATE_IN_4430 },
309 { .div = 18, .val = 18, .flags = RATE_IN_4430 },
310 { .div = 19, .val = 19, .flags = RATE_IN_4430 },
311 { .div = 20, .val = 20, .flags = RATE_IN_4430 },
312 { .div = 21, .val = 21, .flags = RATE_IN_4430 },
313 { .div = 22, .val = 22, .flags = RATE_IN_4430 },
314 { .div = 23, .val = 23, .flags = RATE_IN_4430 },
315 { .div = 24, .val = 24, .flags = RATE_IN_4430 },
316 { .div = 25, .val = 25, .flags = RATE_IN_4430 },
317 { .div = 26, .val = 26, .flags = RATE_IN_4430 },
318 { .div = 27, .val = 27, .flags = RATE_IN_4430 },
319 { .div = 28, .val = 28, .flags = RATE_IN_4430 },
320 { .div = 29, .val = 29, .flags = RATE_IN_4430 },
321 { .div = 30, .val = 30, .flags = RATE_IN_4430 },
322 { .div = 31, .val = 31, .flags = RATE_IN_4430 },
323 { .div = 0 },
324};
325
326static const struct clksel dpll_abe_m2x2_div[] = { 255static const struct clksel dpll_abe_m2x2_div[] = {
327 { .parent = &dpll_abe_x2_ck, .rates = div31_1to31_rates }, 256 { .parent = &dpll_abe_x2_ck, .rates = div31_1to31_rates },
328 { .parent = NULL }, 257 { .parent = NULL },
@@ -512,6 +441,7 @@ static struct clk ddrphy_ck = {
512 .name = "ddrphy_ck", 441 .name = "ddrphy_ck",
513 .parent = &dpll_core_m2_ck, 442 .parent = &dpll_core_m2_ck,
514 .ops = &clkops_null, 443 .ops = &clkops_null,
444 .clkdm_name = "l3_emif_clkdm",
515 .fixed_div = 2, 445 .fixed_div = 2,
516 .recalc = &omap_fixed_divisor_recalc, 446 .recalc = &omap_fixed_divisor_recalc,
517}; 447};
@@ -769,6 +699,7 @@ static const struct clksel dpll_mpu_m2_div[] = {
769static struct clk dpll_mpu_m2_ck = { 699static struct clk dpll_mpu_m2_ck = {
770 .name = "dpll_mpu_m2_ck", 700 .name = "dpll_mpu_m2_ck",
771 .parent = &dpll_mpu_ck, 701 .parent = &dpll_mpu_ck,
702 .clkdm_name = "cm_clkdm",
772 .clksel = dpll_mpu_m2_div, 703 .clksel = dpll_mpu_m2_div,
773 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU, 704 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
774 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 705 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
@@ -1149,6 +1080,7 @@ static const struct clksel l3_div_div[] = {
1149static struct clk l3_div_ck = { 1080static struct clk l3_div_ck = {
1150 .name = "l3_div_ck", 1081 .name = "l3_div_ck",
1151 .parent = &div_core_ck, 1082 .parent = &div_core_ck,
1083 .clkdm_name = "cm_clkdm",
1152 .clksel = l3_div_div, 1084 .clksel = l3_div_div,
1153 .clksel_reg = OMAP4430_CM_CLKSEL_CORE, 1085 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1154 .clksel_mask = OMAP4430_CLKSEL_L3_MASK, 1086 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
@@ -2824,6 +2756,7 @@ static const struct clksel trace_clk_div_div[] = {
2824static struct clk trace_clk_div_ck = { 2756static struct clk trace_clk_div_ck = {
2825 .name = "trace_clk_div_ck", 2757 .name = "trace_clk_div_ck",
2826 .parent = &pmd_trace_clk_mux_ck, 2758 .parent = &pmd_trace_clk_mux_ck,
2759 .clkdm_name = "emu_sys_clkdm",
2827 .clksel = trace_clk_div_div, 2760 .clksel = trace_clk_div_div,
2828 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, 2761 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2829 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK, 2762 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
@@ -3294,17 +3227,17 @@ static struct omap_clk omap44xx_clks[] = {
3294 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X), 3227 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
3295 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X), 3228 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
3296 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X), 3229 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
3297 CLK(NULL, "gpt1_fck", &timer1_fck, CK_443X), 3230 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
3298 CLK(NULL, "gpt10_fck", &timer10_fck, CK_443X), 3231 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
3299 CLK(NULL, "gpt11_fck", &timer11_fck, CK_443X), 3232 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
3300 CLK(NULL, "gpt2_fck", &timer2_fck, CK_443X), 3233 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
3301 CLK(NULL, "gpt3_fck", &timer3_fck, CK_443X), 3234 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
3302 CLK(NULL, "gpt4_fck", &timer4_fck, CK_443X), 3235 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
3303 CLK(NULL, "gpt5_fck", &timer5_fck, CK_443X), 3236 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
3304 CLK(NULL, "gpt6_fck", &timer6_fck, CK_443X), 3237 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
3305 CLK(NULL, "gpt7_fck", &timer7_fck, CK_443X), 3238 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
3306 CLK(NULL, "gpt8_fck", &timer8_fck, CK_443X), 3239 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
3307 CLK(NULL, "gpt9_fck", &timer9_fck, CK_443X), 3240 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
3308 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X), 3241 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
3309 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X), 3242 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
3310 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X), 3243 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
@@ -3380,28 +3313,18 @@ static struct omap_clk omap44xx_clks[] = {
3380 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X), 3313 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3381 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X), 3314 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3382 CLK("omap_wdt", "ick", &dummy_ck, CK_443X), 3315 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3383 CLK("omap_timer.1", "32k_ck", &sys_32k_ck, CK_443X), 3316 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
3384 CLK("omap_timer.2", "32k_ck", &sys_32k_ck, CK_443X), 3317 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3385 CLK("omap_timer.3", "32k_ck", &sys_32k_ck, CK_443X), 3318 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3386 CLK("omap_timer.4", "32k_ck", &sys_32k_ck, CK_443X), 3319 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3387 CLK("omap_timer.5", "32k_ck", &sys_32k_ck, CK_443X), 3320 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3388 CLK("omap_timer.6", "32k_ck", &sys_32k_ck, CK_443X), 3321 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3389 CLK("omap_timer.7", "32k_ck", &sys_32k_ck, CK_443X), 3322 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3390 CLK("omap_timer.8", "32k_ck", &sys_32k_ck, CK_443X), 3323 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3391 CLK("omap_timer.9", "32k_ck", &sys_32k_ck, CK_443X), 3324 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3392 CLK("omap_timer.10", "32k_ck", &sys_32k_ck, CK_443X), 3325 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3393 CLK("omap_timer.11", "32k_ck", &sys_32k_ck, CK_443X), 3326 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3394 CLK("omap_timer.1", "sys_ck", &sys_clkin_ck, CK_443X), 3327 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3395 CLK("omap_timer.2", "sys_ck", &sys_clkin_ck, CK_443X),
3396 CLK("omap_timer.3", "sys_ck", &sys_clkin_ck, CK_443X),
3397 CLK("omap_timer.4", "sys_ck", &sys_clkin_ck, CK_443X),
3398 CLK("omap_timer.9", "sys_ck", &sys_clkin_ck, CK_443X),
3399 CLK("omap_timer.10", "sys_ck", &sys_clkin_ck, CK_443X),
3400 CLK("omap_timer.11", "sys_ck", &sys_clkin_ck, CK_443X),
3401 CLK("omap_timer.5", "sys_ck", &syc_clk_div_ck, CK_443X),
3402 CLK("omap_timer.6", "sys_ck", &syc_clk_div_ck, CK_443X),
3403 CLK("omap_timer.7", "sys_ck", &syc_clk_div_ck, CK_443X),
3404 CLK("omap_timer.8", "sys_ck", &syc_clk_div_ck, CK_443X),
3405}; 3328};
3406 3329
3407int __init omap4xxx_clk_init(void) 3330int __init omap4xxx_clk_init(void)
@@ -3412,9 +3335,12 @@ int __init omap4xxx_clk_init(void)
3412 if (cpu_is_omap443x()) { 3335 if (cpu_is_omap443x()) {
3413 cpu_mask = RATE_IN_4430; 3336 cpu_mask = RATE_IN_4430;
3414 cpu_clkflg = CK_443X; 3337 cpu_clkflg = CK_443X;
3415 } else if (cpu_is_omap446x()) { 3338 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
3416 cpu_mask = RATE_IN_4460 | RATE_IN_4430; 3339 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
3417 cpu_clkflg = CK_446X | CK_443X; 3340 cpu_clkflg = CK_446X | CK_443X;
3341
3342 if (cpu_is_omap447x())
3343 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
3418 } else { 3344 } else {
3419 return 0; 3345 return 0;
3420 } 3346 }
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
index 6424d46be14a..b9f3ba68148c 100644
--- a/arch/arm/mach-omap2/clock_common_data.c
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -43,3 +43,80 @@ const struct clksel_rate dsp_ick_rates[] = {
43 { .div = 3, .val = 3, .flags = RATE_IN_243X }, 43 { .div = 3, .val = 3, .flags = RATE_IN_243X },
44 { .div = 0 }, 44 { .div = 0 },
45}; 45};
46
47
48/* clksel_rate blocks shared between OMAP44xx and AM33xx */
49
50const struct clksel_rate div_1_0_rates[] = {
51 { .div = 1, .val = 0, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
52 { .div = 0 },
53};
54
55const struct clksel_rate div_1_1_rates[] = {
56 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
57 { .div = 0 },
58};
59
60const struct clksel_rate div_1_2_rates[] = {
61 { .div = 1, .val = 2, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
62 { .div = 0 },
63};
64
65const struct clksel_rate div_1_3_rates[] = {
66 { .div = 1, .val = 3, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
67 { .div = 0 },
68};
69
70const struct clksel_rate div_1_4_rates[] = {
71 { .div = 1, .val = 4, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
72 { .div = 0 },
73};
74
75const struct clksel_rate div31_1to31_rates[] = {
76 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
77 { .div = 2, .val = 2, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
78 { .div = 3, .val = 3, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
79 { .div = 4, .val = 4, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
80 { .div = 5, .val = 5, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
81 { .div = 6, .val = 6, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
82 { .div = 7, .val = 7, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
83 { .div = 8, .val = 8, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
84 { .div = 9, .val = 9, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
85 { .div = 10, .val = 10, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
86 { .div = 11, .val = 11, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
87 { .div = 12, .val = 12, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
88 { .div = 13, .val = 13, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
89 { .div = 14, .val = 14, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
90 { .div = 15, .val = 15, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
91 { .div = 16, .val = 16, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
92 { .div = 17, .val = 17, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
93 { .div = 18, .val = 18, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
94 { .div = 19, .val = 19, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
95 { .div = 20, .val = 20, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
96 { .div = 21, .val = 21, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
97 { .div = 22, .val = 22, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
98 { .div = 23, .val = 23, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
99 { .div = 24, .val = 24, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
100 { .div = 25, .val = 25, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
101 { .div = 26, .val = 26, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
102 { .div = 27, .val = 27, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
103 { .div = 28, .val = 28, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
104 { .div = 29, .val = 29, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
105 { .div = 30, .val = 30, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
106 { .div = 31, .val = 31, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
107 { .div = 0 },
108};
109
110/* Clocks shared between various OMAP SoCs */
111
112struct clk virt_19200000_ck = {
113 .name = "virt_19200000_ck",
114 .ops = &clkops_null,
115 .rate = 19200000,
116};
117
118struct clk virt_26000000_ck = {
119 .name = "virt_26000000_ck",
120 .ops = &clkops_null,
121 .rate = 26000000,
122};
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index f7b58609bad8..5601dc13785e 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -31,12 +31,16 @@
31 * 31 *
32 * CLKDM_NO_AUTODEPS: Prevent "autodeps" from being added/removed from this 32 * CLKDM_NO_AUTODEPS: Prevent "autodeps" from being added/removed from this
33 * clockdomain. (Currently, this applies to OMAP3 clockdomains only.) 33 * clockdomain. (Currently, this applies to OMAP3 clockdomains only.)
34 * CLKDM_ACTIVE_WITH_MPU: The PRCM guarantees that this clockdomain is
35 * active whenever the MPU is active. True for interconnects and
36 * the WKUP clockdomains.
34 */ 37 */
35#define CLKDM_CAN_FORCE_SLEEP (1 << 0) 38#define CLKDM_CAN_FORCE_SLEEP (1 << 0)
36#define CLKDM_CAN_FORCE_WAKEUP (1 << 1) 39#define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
37#define CLKDM_CAN_ENABLE_AUTO (1 << 2) 40#define CLKDM_CAN_ENABLE_AUTO (1 << 2)
38#define CLKDM_CAN_DISABLE_AUTO (1 << 3) 41#define CLKDM_CAN_DISABLE_AUTO (1 << 3)
39#define CLKDM_NO_AUTODEPS (1 << 4) 42#define CLKDM_NO_AUTODEPS (1 << 4)
43#define CLKDM_ACTIVE_WITH_MPU (1 << 5)
40 44
41#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO) 45#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
42#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP) 46#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
@@ -195,6 +199,7 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
195extern void __init omap242x_clockdomains_init(void); 199extern void __init omap242x_clockdomains_init(void);
196extern void __init omap243x_clockdomains_init(void); 200extern void __init omap243x_clockdomains_init(void);
197extern void __init omap3xxx_clockdomains_init(void); 201extern void __init omap3xxx_clockdomains_init(void);
202extern void __init am33xx_clockdomains_init(void);
198extern void __init omap44xx_clockdomains_init(void); 203extern void __init omap44xx_clockdomains_init(void);
199extern void _clkdm_add_autodeps(struct clockdomain *clkdm); 204extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
200extern void _clkdm_del_autodeps(struct clockdomain *clkdm); 205extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
@@ -202,11 +207,10 @@ extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
202extern struct clkdm_ops omap2_clkdm_operations; 207extern struct clkdm_ops omap2_clkdm_operations;
203extern struct clkdm_ops omap3_clkdm_operations; 208extern struct clkdm_ops omap3_clkdm_operations;
204extern struct clkdm_ops omap4_clkdm_operations; 209extern struct clkdm_ops omap4_clkdm_operations;
210extern struct clkdm_ops am33xx_clkdm_operations;
205 211
206extern struct clkdm_dep gfx_24xx_wkdeps[]; 212extern struct clkdm_dep gfx_24xx_wkdeps[];
207extern struct clkdm_dep dsp_24xx_wkdeps[]; 213extern struct clkdm_dep dsp_24xx_wkdeps[];
208extern struct clockdomain wkup_common_clkdm; 214extern struct clockdomain wkup_common_clkdm;
209extern struct clockdomain prm_common_clkdm;
210extern struct clockdomain cm_common_clkdm;
211 215
212#endif 216#endif
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c
new file mode 100644
index 000000000000..aca6388fad76
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomain33xx.c
@@ -0,0 +1,74 @@
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
index 4f04dd11d655..762f2cc542ce 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -70,7 +70,7 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
70 70
71static int omap4_clkdm_sleep(struct clockdomain *clkdm) 71static int omap4_clkdm_sleep(struct clockdomain *clkdm)
72{ 72{
73 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition, 73 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
74 clkdm->cm_inst, clkdm->clkdm_offs); 74 clkdm->cm_inst, clkdm->clkdm_offs);
75 return 0; 75 return 0;
76} 76}
@@ -90,8 +90,12 @@ static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
90 90
91static void omap4_clkdm_deny_idle(struct clockdomain *clkdm) 91static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
92{ 92{
93 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition, 93 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
94 clkdm->cm_inst, clkdm->clkdm_offs); 94 omap4_clkdm_wakeup(clkdm);
95 else
96 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
97 clkdm->cm_inst,
98 clkdm->clkdm_offs);
95} 99}
96 100
97static int omap4_clkdm_clk_enable(struct clockdomain *clkdm) 101static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
diff --git a/arch/arm/mach-omap2/clockdomains2420_data.c b/arch/arm/mach-omap2/clockdomains2420_data.c
index 0ab8e46d5b2b..5c741852fac0 100644
--- a/arch/arm/mach-omap2/clockdomains2420_data.c
+++ b/arch/arm/mach-omap2/clockdomains2420_data.c
@@ -131,8 +131,6 @@ static struct clockdomain dss_2420_clkdm = {
131 131
132static struct clockdomain *clockdomains_omap242x[] __initdata = { 132static struct clockdomain *clockdomains_omap242x[] __initdata = {
133 &wkup_common_clkdm, 133 &wkup_common_clkdm,
134 &cm_common_clkdm,
135 &prm_common_clkdm,
136 &mpu_2420_clkdm, 134 &mpu_2420_clkdm,
137 &iva1_2420_clkdm, 135 &iva1_2420_clkdm,
138 &dsp_2420_clkdm, 136 &dsp_2420_clkdm,
diff --git a/arch/arm/mach-omap2/clockdomains2430_data.c b/arch/arm/mach-omap2/clockdomains2430_data.c
index 3645ed044890..f09617555e15 100644
--- a/arch/arm/mach-omap2/clockdomains2430_data.c
+++ b/arch/arm/mach-omap2/clockdomains2430_data.c
@@ -157,8 +157,6 @@ static struct clockdomain dss_2430_clkdm = {
157 157
158static struct clockdomain *clockdomains_omap243x[] __initdata = { 158static struct clockdomain *clockdomains_omap243x[] __initdata = {
159 &wkup_common_clkdm, 159 &wkup_common_clkdm,
160 &cm_common_clkdm,
161 &prm_common_clkdm,
162 &mpu_2430_clkdm, 160 &mpu_2430_clkdm,
163 &mdm_clkdm, 161 &mdm_clkdm,
164 &dsp_2430_clkdm, 162 &dsp_2430_clkdm,
diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index 839145e1cfbe..4972219653ce 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -88,4 +88,5 @@ struct clockdomain wkup_common_clkdm = {
88 .name = "wkup_clkdm", 88 .name = "wkup_clkdm",
89 .pwrdm = { .name = "wkup_pwrdm" }, 89 .pwrdm = { .name = "wkup_pwrdm" },
90 .dep_bit = OMAP_EN_WKUP_SHIFT, 90 .dep_bit = OMAP_EN_WKUP_SHIFT,
91 .flags = CLKDM_ACTIVE_WITH_MPU,
91}; 92};
diff --git a/arch/arm/mach-omap2/clockdomains33xx_data.c b/arch/arm/mach-omap2/clockdomains33xx_data.c
new file mode 100644
index 000000000000..32c90fd9eba2
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains33xx_data.c
@@ -0,0 +1,196 @@
1/*
2 * AM33XX Clock Domain data.
3 *
4 * Copyright (C) 2011-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/io.h>
19
20#include "clockdomain.h"
21#include "cm.h"
22#include "cm33xx.h"
23#include "cm-regbits-33xx.h"
24
25static struct clockdomain l4ls_am33xx_clkdm = {
26 .name = "l4ls_clkdm",
27 .pwrdm = { .name = "per_pwrdm" },
28 .cm_inst = AM33XX_CM_PER_MOD,
29 .clkdm_offs = AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
30 .flags = CLKDM_CAN_SWSUP,
31};
32
33static struct clockdomain l3s_am33xx_clkdm = {
34 .name = "l3s_clkdm",
35 .pwrdm = { .name = "per_pwrdm" },
36 .cm_inst = AM33XX_CM_PER_MOD,
37 .clkdm_offs = AM33XX_CM_PER_L3S_CLKSTCTRL_OFFSET,
38 .flags = CLKDM_CAN_SWSUP,
39};
40
41static struct clockdomain l4fw_am33xx_clkdm = {
42 .name = "l4fw_clkdm",
43 .pwrdm = { .name = "per_pwrdm" },
44 .cm_inst = AM33XX_CM_PER_MOD,
45 .clkdm_offs = AM33XX_CM_PER_L4FW_CLKSTCTRL_OFFSET,
46 .flags = CLKDM_CAN_SWSUP,
47};
48
49static struct clockdomain l3_am33xx_clkdm = {
50 .name = "l3_clkdm",
51 .pwrdm = { .name = "per_pwrdm" },
52 .cm_inst = AM33XX_CM_PER_MOD,
53 .clkdm_offs = AM33XX_CM_PER_L3_CLKSTCTRL_OFFSET,
54 .flags = CLKDM_CAN_SWSUP,
55};
56
57static struct clockdomain l4hs_am33xx_clkdm = {
58 .name = "l4hs_clkdm",
59 .pwrdm = { .name = "per_pwrdm" },
60 .cm_inst = AM33XX_CM_PER_MOD,
61 .clkdm_offs = AM33XX_CM_PER_L4HS_CLKSTCTRL_OFFSET,
62 .flags = CLKDM_CAN_SWSUP,
63};
64
65static struct clockdomain ocpwp_l3_am33xx_clkdm = {
66 .name = "ocpwp_l3_clkdm",
67 .pwrdm = { .name = "per_pwrdm" },
68 .cm_inst = AM33XX_CM_PER_MOD,
69 .clkdm_offs = AM33XX_CM_PER_OCPWP_L3_CLKSTCTRL_OFFSET,
70 .flags = CLKDM_CAN_SWSUP,
71};
72
73static struct clockdomain pruss_ocp_am33xx_clkdm = {
74 .name = "pruss_ocp_clkdm",
75 .pwrdm = { .name = "per_pwrdm" },
76 .cm_inst = AM33XX_CM_PER_MOD,
77 .clkdm_offs = AM33XX_CM_PER_PRUSS_CLKSTCTRL_OFFSET,
78 .flags = CLKDM_CAN_SWSUP,
79};
80
81static struct clockdomain cpsw_125mhz_am33xx_clkdm = {
82 .name = "cpsw_125mhz_clkdm",
83 .pwrdm = { .name = "per_pwrdm" },
84 .cm_inst = AM33XX_CM_PER_MOD,
85 .clkdm_offs = AM33XX_CM_PER_CPSW_CLKSTCTRL_OFFSET,
86 .flags = CLKDM_CAN_SWSUP,
87};
88
89static struct clockdomain lcdc_am33xx_clkdm = {
90 .name = "lcdc_clkdm",
91 .pwrdm = { .name = "per_pwrdm" },
92 .cm_inst = AM33XX_CM_PER_MOD,
93 .clkdm_offs = AM33XX_CM_PER_LCDC_CLKSTCTRL_OFFSET,
94 .flags = CLKDM_CAN_SWSUP,
95};
96
97static struct clockdomain clk_24mhz_am33xx_clkdm = {
98 .name = "clk_24mhz_clkdm",
99 .pwrdm = { .name = "per_pwrdm" },
100 .cm_inst = AM33XX_CM_PER_MOD,
101 .clkdm_offs = AM33XX_CM_PER_CLK_24MHZ_CLKSTCTRL_OFFSET,
102 .flags = CLKDM_CAN_SWSUP,
103};
104
105static struct clockdomain l4_wkup_am33xx_clkdm = {
106 .name = "l4_wkup_clkdm",
107 .pwrdm = { .name = "wkup_pwrdm" },
108 .cm_inst = AM33XX_CM_WKUP_MOD,
109 .clkdm_offs = AM33XX_CM_WKUP_CLKSTCTRL_OFFSET,
110 .flags = CLKDM_CAN_SWSUP,
111};
112
113static struct clockdomain l3_aon_am33xx_clkdm = {
114 .name = "l3_aon_clkdm",
115 .pwrdm = { .name = "wkup_pwrdm" },
116 .cm_inst = AM33XX_CM_WKUP_MOD,
117 .clkdm_offs = AM33XX_CM_L3_AON_CLKSTCTRL_OFFSET,
118 .flags = CLKDM_CAN_SWSUP,
119};
120
121static struct clockdomain l4_wkup_aon_am33xx_clkdm = {
122 .name = "l4_wkup_aon_clkdm",
123 .pwrdm = { .name = "wkup_pwrdm" },
124 .cm_inst = AM33XX_CM_WKUP_MOD,
125 .clkdm_offs = AM33XX_CM_L4_WKUP_AON_CLKSTCTRL_OFFSET,
126 .flags = CLKDM_CAN_SWSUP,
127};
128
129static struct clockdomain mpu_am33xx_clkdm = {
130 .name = "mpu_clkdm",
131 .pwrdm = { .name = "mpu_pwrdm" },
132 .cm_inst = AM33XX_CM_MPU_MOD,
133 .clkdm_offs = AM33XX_CM_MPU_CLKSTCTRL_OFFSET,
134 .flags = CLKDM_CAN_SWSUP,
135};
136
137static struct clockdomain l4_rtc_am33xx_clkdm = {
138 .name = "l4_rtc_clkdm",
139 .pwrdm = { .name = "rtc_pwrdm" },
140 .cm_inst = AM33XX_CM_RTC_MOD,
141 .clkdm_offs = AM33XX_CM_RTC_CLKSTCTRL_OFFSET,
142 .flags = CLKDM_CAN_SWSUP,
143};
144
145static struct clockdomain gfx_l3_am33xx_clkdm = {
146 .name = "gfx_l3_clkdm",
147 .pwrdm = { .name = "gfx_pwrdm" },
148 .cm_inst = AM33XX_CM_GFX_MOD,
149 .clkdm_offs = AM33XX_CM_GFX_L3_CLKSTCTRL_OFFSET,
150 .flags = CLKDM_CAN_SWSUP,
151};
152
153static struct clockdomain gfx_l4ls_gfx_am33xx_clkdm = {
154 .name = "gfx_l4ls_gfx_clkdm",
155 .pwrdm = { .name = "gfx_pwrdm" },
156 .cm_inst = AM33XX_CM_GFX_MOD,
157 .clkdm_offs = AM33XX_CM_GFX_L4LS_GFX_CLKSTCTRL__1_OFFSET,
158 .flags = CLKDM_CAN_SWSUP,
159};
160
161static struct clockdomain l4_cefuse_am33xx_clkdm = {
162 .name = "l4_cefuse_clkdm",
163 .pwrdm = { .name = "cefuse_pwrdm" },
164 .cm_inst = AM33XX_CM_CEFUSE_MOD,
165 .clkdm_offs = AM33XX_CM_CEFUSE_CLKSTCTRL_OFFSET,
166 .flags = CLKDM_CAN_SWSUP,
167};
168
169static struct clockdomain *clockdomains_am33xx[] __initdata = {
170 &l4ls_am33xx_clkdm,
171 &l3s_am33xx_clkdm,
172 &l4fw_am33xx_clkdm,
173 &l3_am33xx_clkdm,
174 &l4hs_am33xx_clkdm,
175 &ocpwp_l3_am33xx_clkdm,
176 &pruss_ocp_am33xx_clkdm,
177 &cpsw_125mhz_am33xx_clkdm,
178 &lcdc_am33xx_clkdm,
179 &clk_24mhz_am33xx_clkdm,
180 &l4_wkup_am33xx_clkdm,
181 &l3_aon_am33xx_clkdm,
182 &l4_wkup_aon_am33xx_clkdm,
183 &mpu_am33xx_clkdm,
184 &l4_rtc_am33xx_clkdm,
185 &gfx_l3_am33xx_clkdm,
186 &gfx_l4ls_gfx_am33xx_clkdm,
187 &l4_cefuse_am33xx_clkdm,
188 NULL,
189};
190
191void __init am33xx_clockdomains_init(void)
192{
193 clkdm_register_platform_funcs(&am33xx_clkdm_operations);
194 clkdm_register_clkdms(clockdomains_am33xx);
195 clkdm_complete_init();
196}
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
index 6038adb97710..56089c49142a 100644
--- a/arch/arm/mach-omap2/clockdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -59,6 +59,12 @@ static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
59 { NULL }, 59 { NULL },
60}; 60};
61 61
62static struct clkdm_dep gfx_sgx_am35x_wkdeps[] = {
63 { .clkdm_name = "mpu_clkdm" },
64 { .clkdm_name = "wkup_clkdm" },
65 { NULL },
66};
67
62/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */ 68/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
63static struct clkdm_dep per_wkdeps[] = { 69static struct clkdm_dep per_wkdeps[] = {
64 { .clkdm_name = "core_l3_clkdm" }, 70 { .clkdm_name = "core_l3_clkdm" },
@@ -69,6 +75,14 @@ static struct clkdm_dep per_wkdeps[] = {
69 { NULL }, 75 { NULL },
70}; 76};
71 77
78static struct clkdm_dep per_am35x_wkdeps[] = {
79 { .clkdm_name = "core_l3_clkdm" },
80 { .clkdm_name = "core_l4_clkdm" },
81 { .clkdm_name = "mpu_clkdm" },
82 { .clkdm_name = "wkup_clkdm" },
83 { NULL },
84};
85
72/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */ 86/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
73static struct clkdm_dep usbhost_wkdeps[] = { 87static struct clkdm_dep usbhost_wkdeps[] = {
74 { .clkdm_name = "core_l3_clkdm" }, 88 { .clkdm_name = "core_l3_clkdm" },
@@ -79,6 +93,14 @@ static struct clkdm_dep usbhost_wkdeps[] = {
79 { NULL }, 93 { NULL },
80}; 94};
81 95
96static struct clkdm_dep usbhost_am35x_wkdeps[] = {
97 { .clkdm_name = "core_l3_clkdm" },
98 { .clkdm_name = "core_l4_clkdm" },
99 { .clkdm_name = "mpu_clkdm" },
100 { .clkdm_name = "wkup_clkdm" },
101 { NULL },
102};
103
82/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */ 104/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
83static struct clkdm_dep mpu_3xxx_wkdeps[] = { 105static struct clkdm_dep mpu_3xxx_wkdeps[] = {
84 { .clkdm_name = "core_l3_clkdm" }, 106 { .clkdm_name = "core_l3_clkdm" },
@@ -89,6 +111,14 @@ static struct clkdm_dep mpu_3xxx_wkdeps[] = {
89 { NULL }, 111 { NULL },
90}; 112};
91 113
114static struct clkdm_dep mpu_am35x_wkdeps[] = {
115 { .clkdm_name = "core_l3_clkdm" },
116 { .clkdm_name = "core_l4_clkdm" },
117 { .clkdm_name = "dss_clkdm" },
118 { .clkdm_name = "per_clkdm" },
119 { NULL },
120};
121
92/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */ 122/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
93static struct clkdm_dep iva2_wkdeps[] = { 123static struct clkdm_dep iva2_wkdeps[] = {
94 { .clkdm_name = "core_l3_clkdm" }, 124 { .clkdm_name = "core_l3_clkdm" },
@@ -116,6 +146,12 @@ static struct clkdm_dep dss_wkdeps[] = {
116 { NULL }, 146 { NULL },
117}; 147};
118 148
149static struct clkdm_dep dss_am35x_wkdeps[] = {
150 { .clkdm_name = "mpu_clkdm" },
151 { .clkdm_name = "wkup_clkdm" },
152 { NULL },
153};
154
119/* 3430: PM_WKDEP_NEON: MPU */ 155/* 3430: PM_WKDEP_NEON: MPU */
120static struct clkdm_dep neon_wkdeps[] = { 156static struct clkdm_dep neon_wkdeps[] = {
121 { .clkdm_name = "mpu_clkdm" }, 157 { .clkdm_name = "mpu_clkdm" },
@@ -131,6 +167,11 @@ static struct clkdm_dep dss_sleepdeps[] = {
131 { NULL }, 167 { NULL },
132}; 168};
133 169
170static struct clkdm_dep dss_am35x_sleepdeps[] = {
171 { .clkdm_name = "mpu_clkdm" },
172 { NULL },
173};
174
134/* 3430: CM_SLEEPDEP_PER: MPU, IVA */ 175/* 3430: CM_SLEEPDEP_PER: MPU, IVA */
135static struct clkdm_dep per_sleepdeps[] = { 176static struct clkdm_dep per_sleepdeps[] = {
136 { .clkdm_name = "mpu_clkdm" }, 177 { .clkdm_name = "mpu_clkdm" },
@@ -138,6 +179,11 @@ static struct clkdm_dep per_sleepdeps[] = {
138 { NULL }, 179 { NULL },
139}; 180};
140 181
182static struct clkdm_dep per_am35x_sleepdeps[] = {
183 { .clkdm_name = "mpu_clkdm" },
184 { NULL },
185};
186
141/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */ 187/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
142static struct clkdm_dep usbhost_sleepdeps[] = { 188static struct clkdm_dep usbhost_sleepdeps[] = {
143 { .clkdm_name = "mpu_clkdm" }, 189 { .clkdm_name = "mpu_clkdm" },
@@ -145,6 +191,11 @@ static struct clkdm_dep usbhost_sleepdeps[] = {
145 { NULL }, 191 { NULL },
146}; 192};
147 193
194static struct clkdm_dep usbhost_am35x_sleepdeps[] = {
195 { .clkdm_name = "mpu_clkdm" },
196 { NULL },
197};
198
148/* 3430: CM_SLEEPDEP_CAM: MPU */ 199/* 3430: CM_SLEEPDEP_CAM: MPU */
149static struct clkdm_dep cam_sleepdeps[] = { 200static struct clkdm_dep cam_sleepdeps[] = {
150 { .clkdm_name = "mpu_clkdm" }, 201 { .clkdm_name = "mpu_clkdm" },
@@ -175,6 +226,15 @@ static struct clockdomain mpu_3xxx_clkdm = {
175 .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK, 226 .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
176}; 227};
177 228
229static struct clockdomain mpu_am35x_clkdm = {
230 .name = "mpu_clkdm",
231 .pwrdm = { .name = "mpu_pwrdm" },
232 .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
233 .dep_bit = OMAP3430_EN_MPU_SHIFT,
234 .wkdep_srcs = mpu_am35x_wkdeps,
235 .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
236};
237
178static struct clockdomain neon_clkdm = { 238static struct clockdomain neon_clkdm = {
179 .name = "neon_clkdm", 239 .name = "neon_clkdm",
180 .pwrdm = { .name = "neon_pwrdm" }, 240 .pwrdm = { .name = "neon_pwrdm" },
@@ -210,6 +270,15 @@ static struct clockdomain sgx_clkdm = {
210 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK, 270 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
211}; 271};
212 272
273static struct clockdomain sgx_am35x_clkdm = {
274 .name = "sgx_clkdm",
275 .pwrdm = { .name = "sgx_pwrdm" },
276 .flags = CLKDM_CAN_HWSUP_SWSUP,
277 .wkdep_srcs = gfx_sgx_am35x_wkdeps,
278 .sleepdep_srcs = gfx_sgx_sleepdeps,
279 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
280};
281
213/* 282/*
214 * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but 283 * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
215 * then that information was removed from the 34xx ES2+ TRM. It is 284 * then that information was removed from the 34xx ES2+ TRM. It is
@@ -261,6 +330,16 @@ static struct clockdomain dss_3xxx_clkdm = {
261 .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK, 330 .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
262}; 331};
263 332
333static struct clockdomain dss_am35x_clkdm = {
334 .name = "dss_clkdm",
335 .pwrdm = { .name = "dss_pwrdm" },
336 .flags = CLKDM_CAN_HWSUP_SWSUP,
337 .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
338 .wkdep_srcs = dss_am35x_wkdeps,
339 .sleepdep_srcs = dss_am35x_sleepdeps,
340 .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
341};
342
264static struct clockdomain cam_clkdm = { 343static struct clockdomain cam_clkdm = {
265 .name = "cam_clkdm", 344 .name = "cam_clkdm",
266 .pwrdm = { .name = "cam_pwrdm" }, 345 .pwrdm = { .name = "cam_pwrdm" },
@@ -279,6 +358,15 @@ static struct clockdomain usbhost_clkdm = {
279 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK, 358 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
280}; 359};
281 360
361static struct clockdomain usbhost_am35x_clkdm = {
362 .name = "usbhost_clkdm",
363 .pwrdm = { .name = "core_pwrdm" },
364 .flags = CLKDM_CAN_HWSUP_SWSUP,
365 .wkdep_srcs = usbhost_am35x_wkdeps,
366 .sleepdep_srcs = usbhost_am35x_sleepdeps,
367 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
368};
369
282static struct clockdomain per_clkdm = { 370static struct clockdomain per_clkdm = {
283 .name = "per_clkdm", 371 .name = "per_clkdm",
284 .pwrdm = { .name = "per_pwrdm" }, 372 .pwrdm = { .name = "per_pwrdm" },
@@ -289,6 +377,16 @@ static struct clockdomain per_clkdm = {
289 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK, 377 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
290}; 378};
291 379
380static struct clockdomain per_am35x_clkdm = {
381 .name = "per_clkdm",
382 .pwrdm = { .name = "per_pwrdm" },
383 .flags = CLKDM_CAN_HWSUP_SWSUP,
384 .dep_bit = OMAP3430_EN_PER_SHIFT,
385 .wkdep_srcs = per_am35x_wkdeps,
386 .sleepdep_srcs = per_am35x_sleepdeps,
387 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
388};
389
292/* 390/*
293 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is 391 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
294 * switched of even if sdti is in use 392 * switched of even if sdti is in use
@@ -341,31 +439,42 @@ static struct clkdm_autodep clkdm_autodeps[] = {
341 } 439 }
342}; 440};
343 441
442static struct clkdm_autodep clkdm_am35x_autodeps[] = {
443 {
444 .clkdm = { .name = "mpu_clkdm" },
445 },
446 {
447 .clkdm = { .name = NULL },
448 }
449};
450
344/* 451/*
345 * 452 *
346 */ 453 */
347 454
348static struct clockdomain *clockdomains_omap3430_common[] __initdata = { 455static struct clockdomain *clockdomains_common[] __initdata = {
349 &wkup_common_clkdm, 456 &wkup_common_clkdm,
350 &cm_common_clkdm,
351 &prm_common_clkdm,
352 &mpu_3xxx_clkdm,
353 &neon_clkdm, 457 &neon_clkdm,
354 &iva2_clkdm,
355 &d2d_clkdm,
356 &core_l3_3xxx_clkdm, 458 &core_l3_3xxx_clkdm,
357 &core_l4_3xxx_clkdm, 459 &core_l4_3xxx_clkdm,
358 &dss_3xxx_clkdm,
359 &cam_clkdm,
360 &per_clkdm,
361 &emu_clkdm, 460 &emu_clkdm,
362 &dpll1_clkdm, 461 &dpll1_clkdm,
363 &dpll2_clkdm,
364 &dpll3_clkdm, 462 &dpll3_clkdm,
365 &dpll4_clkdm, 463 &dpll4_clkdm,
366 NULL 464 NULL
367}; 465};
368 466
467static struct clockdomain *clockdomains_omap3430[] __initdata = {
468 &mpu_3xxx_clkdm,
469 &iva2_clkdm,
470 &d2d_clkdm,
471 &dss_3xxx_clkdm,
472 &cam_clkdm,
473 &per_clkdm,
474 &dpll2_clkdm,
475 NULL
476};
477
369static struct clockdomain *clockdomains_omap3430es1[] __initdata = { 478static struct clockdomain *clockdomains_omap3430es1[] __initdata = {
370 &gfx_3430es1_clkdm, 479 &gfx_3430es1_clkdm,
371 NULL, 480 NULL,
@@ -378,21 +487,41 @@ static struct clockdomain *clockdomains_omap3430es2plus[] __initdata = {
378 NULL, 487 NULL,
379}; 488};
380 489
490static struct clockdomain *clockdomains_am35x[] __initdata = {
491 &mpu_am35x_clkdm,
492 &sgx_am35x_clkdm,
493 &dss_am35x_clkdm,
494 &per_am35x_clkdm,
495 &usbhost_am35x_clkdm,
496 &dpll5_clkdm,
497 NULL
498};
499
381void __init omap3xxx_clockdomains_init(void) 500void __init omap3xxx_clockdomains_init(void)
382{ 501{
383 struct clockdomain **sc; 502 struct clockdomain **sc;
503 unsigned int rev;
384 504
385 if (!cpu_is_omap34xx()) 505 if (!cpu_is_omap34xx())
386 return; 506 return;
387 507
388 clkdm_register_platform_funcs(&omap3_clkdm_operations); 508 clkdm_register_platform_funcs(&omap3_clkdm_operations);
389 clkdm_register_clkdms(clockdomains_omap3430_common); 509 clkdm_register_clkdms(clockdomains_common);
390 510
391 sc = (omap_rev() == OMAP3430_REV_ES1_0) ? clockdomains_omap3430es1 : 511 rev = omap_rev();
392 clockdomains_omap3430es2plus;
393 512
394 clkdm_register_clkdms(sc); 513 if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
514 clkdm_register_clkdms(clockdomains_am35x);
515 clkdm_register_autodeps(clkdm_am35x_autodeps);
516 } else {
517 clkdm_register_clkdms(clockdomains_omap3430);
518
519 sc = (rev == OMAP3430_REV_ES1_0) ?
520 clockdomains_omap3430es1 : clockdomains_omap3430es2plus;
521
522 clkdm_register_clkdms(sc);
523 clkdm_register_autodeps(clkdm_autodeps);
524 }
395 525
396 clkdm_register_autodeps(clkdm_autodeps);
397 clkdm_complete_init(); 526 clkdm_complete_init();
398} 527}
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index c53425847493..63d60a773d3b 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -381,7 +381,7 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
381 .cm_inst = OMAP4430_PRM_WKUP_CM_INST, 381 .cm_inst = OMAP4430_PRM_WKUP_CM_INST,
382 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS, 382 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
383 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT, 383 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT,
384 .flags = CLKDM_CAN_HWSUP, 384 .flags = CLKDM_CAN_HWSUP | CLKDM_ACTIVE_WITH_MPU,
385}; 385};
386 386
387static struct clockdomain emu_sys_44xx_clkdm = { 387static struct clockdomain emu_sys_44xx_clkdm = {
@@ -430,8 +430,6 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
430 &l4_wkup_44xx_clkdm, 430 &l4_wkup_44xx_clkdm,
431 &emu_sys_44xx_clkdm, 431 &emu_sys_44xx_clkdm,
432 &l3_dma_44xx_clkdm, 432 &l3_dma_44xx_clkdm,
433 &prm_common_clkdm,
434 &cm_common_clkdm,
435 NULL 433 NULL
436}; 434};
437 435
diff --git a/arch/arm/mach-omap2/clockdomains_common_data.c b/arch/arm/mach-omap2/clockdomains_common_data.c
deleted file mode 100644
index 615b1f04967d..000000000000
--- a/arch/arm/mach-omap2/clockdomains_common_data.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * OMAP2+-common clockdomain data
3 *
4 * Copyright (C) 2008-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Paul Walmsley, Jouni Högander
8 */
9
10#include <linux/kernel.h>
11#include <linux/io.h>
12
13#include "clockdomain.h"
14
15/* These are implicit clockdomains - they are never defined as such in TRM */
16struct clockdomain prm_common_clkdm = {
17 .name = "prm_clkdm",
18 .pwrdm = { .name = "wkup_pwrdm" },
19};
20
21struct clockdomain cm_common_clkdm = {
22 .name = "cm_clkdm",
23 .pwrdm = { .name = "core_pwrdm" },
24};
diff --git a/arch/arm/mach-omap2/cm-regbits-33xx.h b/arch/arm/mach-omap2/cm-regbits-33xx.h
new file mode 100644
index 000000000000..532027ee3d8d
--- /dev/null
+++ b/arch/arm/mach-omap2/cm-regbits-33xx.h
@@ -0,0 +1,687 @@
1/*
2 * AM33XX Power Management register bits
3 *
4 * This file is automatically generated from the AM33XX hardware databases.
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.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
20#ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_33XX_H
21#define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_33XX_H
22
23/*
24 * Used by CM_AUTOIDLE_DPLL_CORE, CM_AUTOIDLE_DPLL_DDR, CM_AUTOIDLE_DPLL_DISP,
25 * CM_AUTOIDLE_DPLL_MPU, CM_AUTOIDLE_DPLL_PER
26 */
27#define AM33XX_AUTO_DPLL_MODE_SHIFT 0
28#define AM33XX_AUTO_DPLL_MODE_MASK (0x7 << 0)
29
30/* Used by CM_WKUP_CLKSTCTRL */
31#define AM33XX_CLKACTIVITY_ADC_FCLK_SHIFT 14
32#define AM33XX_CLKACTIVITY_ADC_FCLK_MASK (1 << 16)
33
34/* Used by CM_PER_L4LS_CLKSTCTRL */
35#define AM33XX_CLKACTIVITY_CAN_CLK_SHIFT 11
36#define AM33XX_CLKACTIVITY_CAN_CLK_MASK (1 << 11)
37
38/* Used by CM_PER_CLK_24MHZ_CLKSTCTRL */
39#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_SHIFT 4
40#define AM33XX_CLKACTIVITY_CLK_24MHZ_GCLK_MASK (1 << 4)
41
42/* Used by CM_PER_CPSW_CLKSTCTRL */
43#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_SHIFT 4
44#define AM33XX_CLKACTIVITY_CPSW_125MHZ_GCLK_MASK (1 << 4)
45
46/* Used by CM_PER_L4HS_CLKSTCTRL */
47#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_SHIFT 4
48#define AM33XX_CLKACTIVITY_CPSW_250MHZ_GCLK_MASK (1 << 4)
49
50/* Used by CM_PER_L4HS_CLKSTCTRL */
51#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_SHIFT 5
52#define AM33XX_CLKACTIVITY_CPSW_50MHZ_GCLK_MASK (1 << 5)
53
54/* Used by CM_PER_L4HS_CLKSTCTRL */
55#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_SHIFT 6
56#define AM33XX_CLKACTIVITY_CPSW_5MHZ_GCLK_MASK (1 << 6)
57
58/* Used by CM_PER_L3_CLKSTCTRL */
59#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_SHIFT 6
60#define AM33XX_CLKACTIVITY_CPTS_RFT_GCLK_MASK (1 << 6)
61
62/* Used by CM_CEFUSE_CLKSTCTRL */
63#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT 9
64#define AM33XX_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK (1 << 9)
65
66/* Used by CM_L3_AON_CLKSTCTRL */
67#define AM33XX_CLKACTIVITY_DBGSYSCLK_SHIFT 2
68#define AM33XX_CLKACTIVITY_DBGSYSCLK_MASK (1 << 2)
69
70/* Used by CM_L3_AON_CLKSTCTRL */
71#define AM33XX_CLKACTIVITY_DEBUG_CLKA_SHIFT 4
72#define AM33XX_CLKACTIVITY_DEBUG_CLKA_MASK (1 << 4)
73
74/* Used by CM_PER_L3_CLKSTCTRL */
75#define AM33XX_CLKACTIVITY_EMIF_GCLK_SHIFT 2
76#define AM33XX_CLKACTIVITY_EMIF_GCLK_MASK (1 << 2)
77
78/* Used by CM_GFX_L3_CLKSTCTRL */
79#define AM33XX_CLKACTIVITY_GFX_FCLK_SHIFT 9
80#define AM33XX_CLKACTIVITY_GFX_FCLK_MASK (1 << 9)
81
82/* Used by CM_GFX_L3_CLKSTCTRL */
83#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_SHIFT 8
84#define AM33XX_CLKACTIVITY_GFX_L3_GCLK_MASK (1 << 8)
85
86/* Used by CM_WKUP_CLKSTCTRL */
87#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_SHIFT 8
88#define AM33XX_CLKACTIVITY_GPIO0_GDBCLK_MASK (1 << 8)
89
90/* Used by CM_PER_L4LS_CLKSTCTRL */
91#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_SHIFT 19
92#define AM33XX_CLKACTIVITY_GPIO_1_GDBCLK_MASK (1 << 19)
93
94/* Used by CM_PER_L4LS_CLKSTCTRL */
95#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_SHIFT 20
96#define AM33XX_CLKACTIVITY_GPIO_2_GDBCLK_MASK (1 << 20)
97
98/* Used by CM_PER_L4LS_CLKSTCTRL */
99#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_SHIFT 21
100#define AM33XX_CLKACTIVITY_GPIO_3_GDBCLK_MASK (1 << 21)
101
102/* Used by CM_PER_L4LS_CLKSTCTRL */
103#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_SHIFT 22
104#define AM33XX_CLKACTIVITY_GPIO_4_GDBCLK_MASK (1 << 22)
105
106/* Used by CM_PER_L4LS_CLKSTCTRL */
107#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_SHIFT 26
108#define AM33XX_CLKACTIVITY_GPIO_5_GDBCLK_MASK (1 << 26)
109
110/* Used by CM_PER_L4LS_CLKSTCTRL */
111#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_SHIFT 18
112#define AM33XX_CLKACTIVITY_GPIO_6_GDBCLK_MASK (1 << 18)
113
114/* Used by CM_WKUP_CLKSTCTRL */
115#define AM33XX_CLKACTIVITY_I2C0_GFCLK_SHIFT 11
116#define AM33XX_CLKACTIVITY_I2C0_GFCLK_MASK (1 << 11)
117
118/* Used by CM_PER_L4LS_CLKSTCTRL */
119#define AM33XX_CLKACTIVITY_I2C_FCLK_SHIFT 24
120#define AM33XX_CLKACTIVITY_I2C_FCLK_MASK (1 << 24)
121
122/* Used by CM_PER_PRUSS_CLKSTCTRL */
123#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_SHIFT 5
124#define AM33XX_CLKACTIVITY_PRUSS_IEP_GCLK_MASK (1 << 5)
125
126/* Used by CM_PER_PRUSS_CLKSTCTRL */
127#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_SHIFT 4
128#define AM33XX_CLKACTIVITY_PRUSS_OCP_GCLK_MASK (1 << 4)
129
130/* Used by CM_PER_PRUSS_CLKSTCTRL */
131#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_SHIFT 6
132#define AM33XX_CLKACTIVITY_PRUSS_UART_GCLK_MASK (1 << 6)
133
134/* Used by CM_PER_L3S_CLKSTCTRL */
135#define AM33XX_CLKACTIVITY_L3S_GCLK_SHIFT 3
136#define AM33XX_CLKACTIVITY_L3S_GCLK_MASK (1 << 3)
137
138/* Used by CM_L3_AON_CLKSTCTRL */
139#define AM33XX_CLKACTIVITY_L3_AON_GCLK_SHIFT 3
140#define AM33XX_CLKACTIVITY_L3_AON_GCLK_MASK (1 << 3)
141
142/* Used by CM_PER_L3_CLKSTCTRL */
143#define AM33XX_CLKACTIVITY_L3_GCLK_SHIFT 4
144#define AM33XX_CLKACTIVITY_L3_GCLK_MASK (1 << 4)
145
146/* Used by CM_PER_L4FW_CLKSTCTRL */
147#define AM33XX_CLKACTIVITY_L4FW_GCLK_SHIFT 8
148#define AM33XX_CLKACTIVITY_L4FW_GCLK_MASK (1 << 8)
149
150/* Used by CM_PER_L4HS_CLKSTCTRL */
151#define AM33XX_CLKACTIVITY_L4HS_GCLK_SHIFT 3
152#define AM33XX_CLKACTIVITY_L4HS_GCLK_MASK (1 << 3)
153
154/* Used by CM_PER_L4LS_CLKSTCTRL */
155#define AM33XX_CLKACTIVITY_L4LS_GCLK_SHIFT 8
156#define AM33XX_CLKACTIVITY_L4LS_GCLK_MASK (1 << 8)
157
158/* Used by CM_GFX_L4LS_GFX_CLKSTCTRL__1 */
159#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_SHIFT 8
160#define AM33XX_CLKACTIVITY_L4LS_GFX_GCLK_MASK (1 << 8)
161
162/* Used by CM_CEFUSE_CLKSTCTRL */
163#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT 8
164#define AM33XX_CLKACTIVITY_L4_CEFUSE_GICLK_MASK (1 << 8)
165
166/* Used by CM_RTC_CLKSTCTRL */
167#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_SHIFT 8
168#define AM33XX_CLKACTIVITY_L4_RTC_GCLK_MASK (1 << 8)
169
170/* Used by CM_L4_WKUP_AON_CLKSTCTRL */
171#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_SHIFT 2
172#define AM33XX_CLKACTIVITY_L4_WKUP_AON_GCLK_MASK (1 << 2)
173
174/* Used by CM_WKUP_CLKSTCTRL */
175#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_SHIFT 2
176#define AM33XX_CLKACTIVITY_L4_WKUP_GCLK_MASK (1 << 2)
177
178/* Used by CM_PER_L4LS_CLKSTCTRL */
179#define AM33XX_CLKACTIVITY_LCDC_GCLK_SHIFT 17
180#define AM33XX_CLKACTIVITY_LCDC_GCLK_MASK (1 << 17)
181
182/* Used by CM_PER_LCDC_CLKSTCTRL */
183#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_SHIFT 4
184#define AM33XX_CLKACTIVITY_LCDC_L3_OCP_GCLK_MASK (1 << 4)
185
186/* Used by CM_PER_LCDC_CLKSTCTRL */
187#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_SHIFT 5
188#define AM33XX_CLKACTIVITY_LCDC_L4_OCP_GCLK_MASK (1 << 5)
189
190/* Used by CM_PER_L3_CLKSTCTRL */
191#define AM33XX_CLKACTIVITY_MCASP_GCLK_SHIFT 7
192#define AM33XX_CLKACTIVITY_MCASP_GCLK_MASK (1 << 7)
193
194/* Used by CM_PER_L3_CLKSTCTRL */
195#define AM33XX_CLKACTIVITY_MMC_FCLK_SHIFT 3
196#define AM33XX_CLKACTIVITY_MMC_FCLK_MASK (1 << 3)
197
198/* Used by CM_MPU_CLKSTCTRL */
199#define AM33XX_CLKACTIVITY_MPU_CLK_SHIFT 2
200#define AM33XX_CLKACTIVITY_MPU_CLK_MASK (1 << 2)
201
202/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */
203#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_SHIFT 4
204#define AM33XX_CLKACTIVITY_OCPWP_L3_GCLK_MASK (1 << 4)
205
206/* Used by CM_PER_OCPWP_L3_CLKSTCTRL */
207#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_SHIFT 5
208#define AM33XX_CLKACTIVITY_OCPWP_L4_GCLK_MASK (1 << 5)
209
210/* Used by CM_RTC_CLKSTCTRL */
211#define AM33XX_CLKACTIVITY_RTC_32KCLK_SHIFT 9
212#define AM33XX_CLKACTIVITY_RTC_32KCLK_MASK (1 << 9)
213
214/* Used by CM_PER_L4LS_CLKSTCTRL */
215#define AM33XX_CLKACTIVITY_SPI_GCLK_SHIFT 25
216#define AM33XX_CLKACTIVITY_SPI_GCLK_MASK (1 << 25)
217
218/* Used by CM_WKUP_CLKSTCTRL */
219#define AM33XX_CLKACTIVITY_SR_SYSCLK_SHIFT 3
220#define AM33XX_CLKACTIVITY_SR_SYSCLK_MASK (1 << 3)
221
222/* Used by CM_WKUP_CLKSTCTRL */
223#define AM33XX_CLKACTIVITY_TIMER0_GCLK_SHIFT 10
224#define AM33XX_CLKACTIVITY_TIMER0_GCLK_MASK (1 << 10)
225
226/* Used by CM_WKUP_CLKSTCTRL */
227#define AM33XX_CLKACTIVITY_TIMER1_GCLK_SHIFT 13
228#define AM33XX_CLKACTIVITY_TIMER1_GCLK_MASK (1 << 13)
229
230/* Used by CM_PER_L4LS_CLKSTCTRL */
231#define AM33XX_CLKACTIVITY_TIMER2_GCLK_SHIFT 14
232#define AM33XX_CLKACTIVITY_TIMER2_GCLK_MASK (1 << 14)
233
234/* Used by CM_PER_L4LS_CLKSTCTRL */
235#define AM33XX_CLKACTIVITY_TIMER3_GCLK_SHIFT 15
236#define AM33XX_CLKACTIVITY_TIMER3_GCLK_MASK (1 << 15)
237
238/* Used by CM_PER_L4LS_CLKSTCTRL */
239#define AM33XX_CLKACTIVITY_TIMER4_GCLK_SHIFT 16
240#define AM33XX_CLKACTIVITY_TIMER4_GCLK_MASK (1 << 16)
241
242/* Used by CM_PER_L4LS_CLKSTCTRL */
243#define AM33XX_CLKACTIVITY_TIMER5_GCLK_SHIFT 27
244#define AM33XX_CLKACTIVITY_TIMER5_GCLK_MASK (1 << 27)
245
246/* Used by CM_PER_L4LS_CLKSTCTRL */
247#define AM33XX_CLKACTIVITY_TIMER6_GCLK_SHIFT 28
248#define AM33XX_CLKACTIVITY_TIMER6_GCLK_MASK (1 << 28)
249
250/* Used by CM_PER_L4LS_CLKSTCTRL */
251#define AM33XX_CLKACTIVITY_TIMER7_GCLK_SHIFT 13
252#define AM33XX_CLKACTIVITY_TIMER7_GCLK_MASK (1 << 13)
253
254/* Used by CM_WKUP_CLKSTCTRL */
255#define AM33XX_CLKACTIVITY_UART0_GFCLK_SHIFT 12
256#define AM33XX_CLKACTIVITY_UART0_GFCLK_MASK (1 << 12)
257
258/* Used by CM_PER_L4LS_CLKSTCTRL */
259#define AM33XX_CLKACTIVITY_UART_GFCLK_SHIFT 10
260#define AM33XX_CLKACTIVITY_UART_GFCLK_MASK (1 << 10)
261
262/* Used by CM_WKUP_CLKSTCTRL */
263#define AM33XX_CLKACTIVITY_WDT0_GCLK_SHIFT 9
264#define AM33XX_CLKACTIVITY_WDT0_GCLK_MASK (1 << 9)
265
266/* Used by CM_WKUP_CLKSTCTRL */
267#define AM33XX_CLKACTIVITY_WDT1_GCLK_SHIFT 4
268#define AM33XX_CLKACTIVITY_WDT1_GCLK_MASK (1 << 4)
269
270/* Used by CLKSEL_GFX_FCLK */
271#define AM33XX_CLKDIV_SEL_GFX_FCLK_SHIFT 0
272#define AM33XX_CLKDIV_SEL_GFX_FCLK_MASK (1 << 0)
273
274/* Used by CM_CLKOUT_CTRL */
275#define AM33XX_CLKOUT2DIV_SHIFT 3
276#define AM33XX_CLKOUT2DIV_MASK (0x05 << 3)
277
278/* Used by CM_CLKOUT_CTRL */
279#define AM33XX_CLKOUT2EN_SHIFT 7
280#define AM33XX_CLKOUT2EN_MASK (1 << 7)
281
282/* Used by CM_CLKOUT_CTRL */
283#define AM33XX_CLKOUT2SOURCE_SHIFT 0
284#define AM33XX_CLKOUT2SOURCE_MASK (0x02 << 0)
285
286/*
287 * Used by CLKSEL_GPIO0_DBCLK, CLKSEL_LCDC_PIXEL_CLK, CLKSEL_TIMER2_CLK,
288 * CLKSEL_TIMER3_CLK, CLKSEL_TIMER4_CLK, CLKSEL_TIMER5_CLK, CLKSEL_TIMER6_CLK,
289 * CLKSEL_TIMER7_CLK
290 */
291#define AM33XX_CLKSEL_SHIFT 0
292#define AM33XX_CLKSEL_MASK (0x01 << 0)
293
294/*
295 * Renamed from CLKSEL Used by CLKSEL_PRUSS_OCP_CLK, CLKSEL_WDT1_CLK,
296 * CM_CPTS_RFT_CLKSEL
297 */
298#define AM33XX_CLKSEL_0_0_SHIFT 0
299#define AM33XX_CLKSEL_0_0_MASK (1 << 0)
300
301#define AM33XX_CLKSEL_0_1_SHIFT 0
302#define AM33XX_CLKSEL_0_1_MASK (3 << 0)
303
304/* Renamed from CLKSEL Used by CLKSEL_TIMER1MS_CLK */
305#define AM33XX_CLKSEL_0_2_SHIFT 0
306#define AM33XX_CLKSEL_0_2_MASK (7 << 0)
307
308/* Used by CLKSEL_GFX_FCLK */
309#define AM33XX_CLKSEL_GFX_FCLK_SHIFT 1
310#define AM33XX_CLKSEL_GFX_FCLK_MASK (1 << 1)
311
312/*
313 * Used by CM_MPU_CLKSTCTRL, CM_RTC_CLKSTCTRL, CM_PER_CLK_24MHZ_CLKSTCTRL,
314 * CM_PER_CPSW_CLKSTCTRL, CM_PER_PRUSS_CLKSTCTRL, CM_PER_L3S_CLKSTCTRL,
315 * CM_PER_L3_CLKSTCTRL, CM_PER_L4FW_CLKSTCTRL, CM_PER_L4HS_CLKSTCTRL,
316 * CM_PER_L4LS_CLKSTCTRL, CM_PER_LCDC_CLKSTCTRL, CM_PER_OCPWP_L3_CLKSTCTRL,
317 * CM_L3_AON_CLKSTCTRL, CM_L4_WKUP_AON_CLKSTCTRL, CM_WKUP_CLKSTCTRL,
318 * CM_GFX_L3_CLKSTCTRL, CM_GFX_L4LS_GFX_CLKSTCTRL__1, CM_CEFUSE_CLKSTCTRL
319 */
320#define AM33XX_CLKTRCTRL_SHIFT 0
321#define AM33XX_CLKTRCTRL_MASK (0x3 << 0)
322
323/*
324 * Used by CM_SSC_DELTAMSTEP_DPLL_CORE, CM_SSC_DELTAMSTEP_DPLL_DDR,
325 * CM_SSC_DELTAMSTEP_DPLL_DISP, CM_SSC_DELTAMSTEP_DPLL_MPU,
326 * CM_SSC_DELTAMSTEP_DPLL_PER
327 */
328#define AM33XX_DELTAMSTEP_SHIFT 0
329#define AM33XX_DELTAMSTEP_MASK (0x19 << 0)
330
331/* Used by CM_CLKSEL_DPLL_DDR, CM_CLKSEL_DPLL_DISP, CM_CLKSEL_DPLL_MPU */
332#define AM33XX_DPLL_BYP_CLKSEL_SHIFT 23
333#define AM33XX_DPLL_BYP_CLKSEL_MASK (1 << 23)
334
335/* Used by CM_CLKDCOLDO_DPLL_PER */
336#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT 8
337#define AM33XX_DPLL_CLKDCOLDO_GATE_CTRL_MASK (1 << 8)
338
339/* Used by CM_CLKDCOLDO_DPLL_PER */
340#define AM33XX_DPLL_CLKDCOLDO_PWDN_SHIFT 12
341#define AM33XX_DPLL_CLKDCOLDO_PWDN_MASK (1 << 12)
342
343/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */
344#define AM33XX_DPLL_CLKOUT_DIV_SHIFT 0
345#define AM33XX_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
346
347/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_PER */
348#define AM33XX_DPLL_CLKOUT_DIV_0_6_SHIFT 0
349#define AM33XX_DPLL_CLKOUT_DIV_0_6_MASK (0x06 << 0)
350
351/* Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU */
352#define AM33XX_DPLL_CLKOUT_DIVCHACK_SHIFT 5
353#define AM33XX_DPLL_CLKOUT_DIVCHACK_MASK (1 << 5)
354
355/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_PER */
356#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_SHIFT 7
357#define AM33XX_DPLL_CLKOUT_DIVCHACK_M2_PER_MASK (1 << 7)
358
359/*
360 * Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU,
361 * CM_DIV_M2_DPLL_PER
362 */
363#define AM33XX_DPLL_CLKOUT_GATE_CTRL_SHIFT 8
364#define AM33XX_DPLL_CLKOUT_GATE_CTRL_MASK (1 << 8)
365
366/*
367 * Used by CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_DDR, CM_CLKSEL_DPLL_DISP,
368 * CM_CLKSEL_DPLL_MPU
369 */
370#define AM33XX_DPLL_DIV_SHIFT 0
371#define AM33XX_DPLL_DIV_MASK (0x7f << 0)
372
373#define AM33XX_DPLL_PER_DIV_MASK (0xff << 0)
374
375/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_PERIPH */
376#define AM33XX_DPLL_DIV_0_7_SHIFT 0
377#define AM33XX_DPLL_DIV_0_7_MASK (0x07 << 0)
378
379/*
380 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
381 * CM_CLKMODE_DPLL_MPU
382 */
383#define AM33XX_DPLL_DRIFTGUARD_EN_SHIFT 8
384#define AM33XX_DPLL_DRIFTGUARD_EN_MASK (1 << 8)
385
386/*
387 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
388 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
389 */
390#define AM33XX_DPLL_EN_SHIFT 0
391#define AM33XX_DPLL_EN_MASK (0x7 << 0)
392
393/*
394 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
395 * CM_CLKMODE_DPLL_MPU
396 */
397#define AM33XX_DPLL_LPMODE_EN_SHIFT 10
398#define AM33XX_DPLL_LPMODE_EN_MASK (1 << 10)
399
400/*
401 * Used by CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_DDR, CM_CLKSEL_DPLL_DISP,
402 * CM_CLKSEL_DPLL_MPU
403 */
404#define AM33XX_DPLL_MULT_SHIFT 8
405#define AM33XX_DPLL_MULT_MASK (0x7ff << 8)
406
407/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_PERIPH */
408#define AM33XX_DPLL_MULT_PERIPH_SHIFT 8
409#define AM33XX_DPLL_MULT_PERIPH_MASK (0xfff << 8)
410
411/*
412 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
413 * CM_CLKMODE_DPLL_MPU
414 */
415#define AM33XX_DPLL_REGM4XEN_SHIFT 11
416#define AM33XX_DPLL_REGM4XEN_MASK (1 << 11)
417
418/* Used by CM_CLKSEL_DPLL_PERIPH */
419#define AM33XX_DPLL_SD_DIV_SHIFT 24
420#define AM33XX_DPLL_SD_DIV_MASK (24, 31)
421
422/*
423 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
424 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
425 */
426#define AM33XX_DPLL_SSC_ACK_SHIFT 13
427#define AM33XX_DPLL_SSC_ACK_MASK (1 << 13)
428
429/*
430 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
431 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
432 */
433#define AM33XX_DPLL_SSC_DOWNSPREAD_SHIFT 14
434#define AM33XX_DPLL_SSC_DOWNSPREAD_MASK (1 << 14)
435
436/*
437 * Used by CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_DDR, CM_CLKMODE_DPLL_DISP,
438 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
439 */
440#define AM33XX_DPLL_SSC_EN_SHIFT 12
441#define AM33XX_DPLL_SSC_EN_MASK (1 << 12)
442
443/* Used by CM_DIV_M4_DPLL_CORE */
444#define AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT 0
445#define AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK (0x1f << 0)
446
447/* Used by CM_DIV_M4_DPLL_CORE */
448#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT 5
449#define AM33XX_HSDIVIDER_CLKOUT1_DIVCHACK_MASK (1 << 5)
450
451/* Used by CM_DIV_M4_DPLL_CORE */
452#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT 8
453#define AM33XX_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK (1 << 8)
454
455/* Used by CM_DIV_M4_DPLL_CORE */
456#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_SHIFT 12
457#define AM33XX_HSDIVIDER_CLKOUT1_PWDN_MASK (1 << 12)
458
459/* Used by CM_DIV_M5_DPLL_CORE */
460#define AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT 0
461#define AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK (0x1f << 0)
462
463/* Used by CM_DIV_M5_DPLL_CORE */
464#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT 5
465#define AM33XX_HSDIVIDER_CLKOUT2_DIVCHACK_MASK (1 << 5)
466
467/* Used by CM_DIV_M5_DPLL_CORE */
468#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT 8
469#define AM33XX_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK (1 << 8)
470
471/* Used by CM_DIV_M5_DPLL_CORE */
472#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_SHIFT 12
473#define AM33XX_HSDIVIDER_CLKOUT2_PWDN_MASK (1 << 12)
474
475/* Used by CM_DIV_M6_DPLL_CORE */
476#define AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT 0
477#define AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK (0x04 << 0)
478
479/* Used by CM_DIV_M6_DPLL_CORE */
480#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT 5
481#define AM33XX_HSDIVIDER_CLKOUT3_DIVCHACK_MASK (1 << 5)
482
483/* Used by CM_DIV_M6_DPLL_CORE */
484#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT 8
485#define AM33XX_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK (1 << 8)
486
487/* Used by CM_DIV_M6_DPLL_CORE */
488#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_SHIFT 12
489#define AM33XX_HSDIVIDER_CLKOUT3_PWDN_MASK (1 << 12)
490
491/*
492 * Used by CM_MPU_MPU_CLKCTRL, CM_RTC_RTC_CLKCTRL, CM_PER_AES0_CLKCTRL,
493 * CM_PER_AES1_CLKCTRL, CM_PER_CLKDIV32K_CLKCTRL, CM_PER_CPGMAC0_CLKCTRL,
494 * CM_PER_DCAN0_CLKCTRL, CM_PER_DCAN1_CLKCTRL, CM_PER_DES_CLKCTRL,
495 * CM_PER_ELM_CLKCTRL, CM_PER_EMIF_CLKCTRL, CM_PER_EMIF_FW_CLKCTRL,
496 * CM_PER_EPWMSS0_CLKCTRL, CM_PER_EPWMSS1_CLKCTRL, CM_PER_EPWMSS2_CLKCTRL,
497 * CM_PER_GPIO1_CLKCTRL, CM_PER_GPIO2_CLKCTRL, CM_PER_GPIO3_CLKCTRL,
498 * CM_PER_GPIO4_CLKCTRL, CM_PER_GPIO5_CLKCTRL, CM_PER_GPIO6_CLKCTRL,
499 * CM_PER_GPMC_CLKCTRL, CM_PER_I2C1_CLKCTRL, CM_PER_I2C2_CLKCTRL,
500 * CM_PER_PRUSS_CLKCTRL, CM_PER_IEEE5000_CLKCTRL, CM_PER_L3_CLKCTRL,
501 * CM_PER_L3_INSTR_CLKCTRL, CM_PER_L4FW_CLKCTRL, CM_PER_L4HS_CLKCTRL,
502 * CM_PER_L4LS_CLKCTRL, CM_PER_LCDC_CLKCTRL, CM_PER_MAILBOX0_CLKCTRL,
503 * CM_PER_MAILBOX1_CLKCTRL, CM_PER_MCASP0_CLKCTRL, CM_PER_MCASP1_CLKCTRL,
504 * CM_PER_MCASP2_CLKCTRL, CM_PER_MLB_CLKCTRL, CM_PER_MMC0_CLKCTRL,
505 * CM_PER_MMC1_CLKCTRL, CM_PER_MMC2_CLKCTRL, CM_PER_MSTR_EXPS_CLKCTRL,
506 * CM_PER_OCMCRAM_CLKCTRL, CM_PER_OCPWP_CLKCTRL, CM_PER_PCIE_CLKCTRL,
507 * CM_PER_PKA_CLKCTRL, CM_PER_RNG_CLKCTRL, CM_PER_SHA0_CLKCTRL,
508 * CM_PER_SLV_EXPS_CLKCTRL, CM_PER_SPARE0_CLKCTRL, CM_PER_SPARE1_CLKCTRL,
509 * CM_PER_SPARE_CLKCTRL, CM_PER_SPI0_CLKCTRL, CM_PER_SPI1_CLKCTRL,
510 * CM_PER_SPI2_CLKCTRL, CM_PER_SPI3_CLKCTRL, CM_PER_SPINLOCK_CLKCTRL,
511 * CM_PER_TIMER2_CLKCTRL, CM_PER_TIMER3_CLKCTRL, CM_PER_TIMER4_CLKCTRL,
512 * CM_PER_TIMER5_CLKCTRL, CM_PER_TIMER6_CLKCTRL, CM_PER_TIMER7_CLKCTRL,
513 * CM_PER_TPCC_CLKCTRL, CM_PER_TPTC0_CLKCTRL, CM_PER_TPTC1_CLKCTRL,
514 * CM_PER_TPTC2_CLKCTRL, CM_PER_UART1_CLKCTRL, CM_PER_UART2_CLKCTRL,
515 * CM_PER_UART3_CLKCTRL, CM_PER_UART4_CLKCTRL, CM_PER_UART5_CLKCTRL,
516 * CM_PER_USB0_CLKCTRL, CM_WKUP_ADC_TSC_CLKCTRL, CM_WKUP_CONTROL_CLKCTRL,
517 * CM_WKUP_DEBUGSS_CLKCTRL, CM_WKUP_GPIO0_CLKCTRL, CM_WKUP_I2C0_CLKCTRL,
518 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_SMARTREFLEX0_CLKCTRL,
519 * CM_WKUP_SMARTREFLEX1_CLKCTRL, CM_WKUP_TIMER0_CLKCTRL,
520 * CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_UART0_CLKCTRL, CM_WKUP_WDT0_CLKCTRL,
521 * CM_WKUP_WDT1_CLKCTRL, CM_GFX_BITBLT_CLKCTRL, CM_GFX_GFX_CLKCTRL,
522 * CM_GFX_MMUCFG_CLKCTRL, CM_GFX_MMUDATA_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL
523 */
524#define AM33XX_IDLEST_SHIFT 16
525#define AM33XX_IDLEST_MASK (0x3 << 16)
526#define AM33XX_IDLEST_VAL 0x3
527
528/* Used by CM_MAC_CLKSEL */
529#define AM33XX_MII_CLK_SEL_SHIFT 2
530#define AM33XX_MII_CLK_SEL_MASK (1 << 2)
531
532/*
533 * Used by CM_SSC_MODFREQDIV_DPLL_CORE, CM_SSC_MODFREQDIV_DPLL_DDR,
534 * CM_SSC_MODFREQDIV_DPLL_DISP, CM_SSC_MODFREQDIV_DPLL_MPU,
535 * CM_SSC_MODFREQDIV_DPLL_PER
536 */
537#define AM33XX_MODFREQDIV_EXPONENT_SHIFT 8
538#define AM33XX_MODFREQDIV_EXPONENT_MASK (0x10 << 8)
539
540/*
541 * Used by CM_SSC_MODFREQDIV_DPLL_CORE, CM_SSC_MODFREQDIV_DPLL_DDR,
542 * CM_SSC_MODFREQDIV_DPLL_DISP, CM_SSC_MODFREQDIV_DPLL_MPU,
543 * CM_SSC_MODFREQDIV_DPLL_PER
544 */
545#define AM33XX_MODFREQDIV_MANTISSA_SHIFT 0
546#define AM33XX_MODFREQDIV_MANTISSA_MASK (0x06 << 0)
547
548/*
549 * Used by CM_MPU_MPU_CLKCTRL, CM_RTC_RTC_CLKCTRL, CM_PER_AES0_CLKCTRL,
550 * CM_PER_AES1_CLKCTRL, CM_PER_CLKDIV32K_CLKCTRL, CM_PER_CPGMAC0_CLKCTRL,
551 * CM_PER_DCAN0_CLKCTRL, CM_PER_DCAN1_CLKCTRL, CM_PER_DES_CLKCTRL,
552 * CM_PER_ELM_CLKCTRL, CM_PER_EMIF_CLKCTRL, CM_PER_EMIF_FW_CLKCTRL,
553 * CM_PER_EPWMSS0_CLKCTRL, CM_PER_EPWMSS1_CLKCTRL, CM_PER_EPWMSS2_CLKCTRL,
554 * CM_PER_GPIO1_CLKCTRL, CM_PER_GPIO2_CLKCTRL, CM_PER_GPIO3_CLKCTRL,
555 * CM_PER_GPIO4_CLKCTRL, CM_PER_GPIO5_CLKCTRL, CM_PER_GPIO6_CLKCTRL,
556 * CM_PER_GPMC_CLKCTRL, CM_PER_I2C1_CLKCTRL, CM_PER_I2C2_CLKCTRL,
557 * CM_PER_PRUSS_CLKCTRL, CM_PER_IEEE5000_CLKCTRL, CM_PER_L3_CLKCTRL,
558 * CM_PER_L3_INSTR_CLKCTRL, CM_PER_L4FW_CLKCTRL, CM_PER_L4HS_CLKCTRL,
559 * CM_PER_L4LS_CLKCTRL, CM_PER_LCDC_CLKCTRL, CM_PER_MAILBOX0_CLKCTRL,
560 * CM_PER_MAILBOX1_CLKCTRL, CM_PER_MCASP0_CLKCTRL, CM_PER_MCASP1_CLKCTRL,
561 * CM_PER_MCASP2_CLKCTRL, CM_PER_MLB_CLKCTRL, CM_PER_MMC0_CLKCTRL,
562 * CM_PER_MMC1_CLKCTRL, CM_PER_MMC2_CLKCTRL, CM_PER_MSTR_EXPS_CLKCTRL,
563 * CM_PER_OCMCRAM_CLKCTRL, CM_PER_OCPWP_CLKCTRL, CM_PER_PCIE_CLKCTRL,
564 * CM_PER_PKA_CLKCTRL, CM_PER_RNG_CLKCTRL, CM_PER_SHA0_CLKCTRL,
565 * CM_PER_SLV_EXPS_CLKCTRL, CM_PER_SPARE0_CLKCTRL, CM_PER_SPARE1_CLKCTRL,
566 * CM_PER_SPARE_CLKCTRL, CM_PER_SPI0_CLKCTRL, CM_PER_SPI1_CLKCTRL,
567 * CM_PER_SPI2_CLKCTRL, CM_PER_SPI3_CLKCTRL, CM_PER_SPINLOCK_CLKCTRL,
568 * CM_PER_TIMER2_CLKCTRL, CM_PER_TIMER3_CLKCTRL, CM_PER_TIMER4_CLKCTRL,
569 * CM_PER_TIMER5_CLKCTRL, CM_PER_TIMER6_CLKCTRL, CM_PER_TIMER7_CLKCTRL,
570 * CM_PER_TPCC_CLKCTRL, CM_PER_TPTC0_CLKCTRL, CM_PER_TPTC1_CLKCTRL,
571 * CM_PER_TPTC2_CLKCTRL, CM_PER_UART1_CLKCTRL, CM_PER_UART2_CLKCTRL,
572 * CM_PER_UART3_CLKCTRL, CM_PER_UART4_CLKCTRL, CM_PER_UART5_CLKCTRL,
573 * CM_PER_USB0_CLKCTRL, CM_WKUP_ADC_TSC_CLKCTRL, CM_WKUP_CONTROL_CLKCTRL,
574 * CM_WKUP_DEBUGSS_CLKCTRL, CM_WKUP_GPIO0_CLKCTRL, CM_WKUP_I2C0_CLKCTRL,
575 * CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_SMARTREFLEX0_CLKCTRL,
576 * CM_WKUP_SMARTREFLEX1_CLKCTRL, CM_WKUP_TIMER0_CLKCTRL,
577 * CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_UART0_CLKCTRL, CM_WKUP_WDT0_CLKCTRL,
578 * CM_WKUP_WDT1_CLKCTRL, CM_WKUP_WKUP_M3_CLKCTRL, CM_GFX_BITBLT_CLKCTRL,
579 * CM_GFX_GFX_CLKCTRL, CM_GFX_MMUCFG_CLKCTRL, CM_GFX_MMUDATA_CLKCTRL,
580 * CM_CEFUSE_CEFUSE_CLKCTRL
581 */
582#define AM33XX_MODULEMODE_SHIFT 0
583#define AM33XX_MODULEMODE_MASK (0x3 << 0)
584
585/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
586#define AM33XX_OPTCLK_DEBUG_CLKA_SHIFT 30
587#define AM33XX_OPTCLK_DEBUG_CLKA_MASK (1 << 30)
588
589/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
590#define AM33XX_OPTFCLKEN_DBGSYSCLK_SHIFT 19
591#define AM33XX_OPTFCLKEN_DBGSYSCLK_MASK (1 << 19)
592
593/* Used by CM_WKUP_GPIO0_CLKCTRL */
594#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT 18
595#define AM33XX_OPTFCLKEN_GPIO0_GDBCLK_MASK (1 << 18)
596
597/* Used by CM_PER_GPIO1_CLKCTRL */
598#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT 18
599#define AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_MASK (1 << 18)
600
601/* Used by CM_PER_GPIO2_CLKCTRL */
602#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT 18
603#define AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_MASK (1 << 18)
604
605/* Used by CM_PER_GPIO3_CLKCTRL */
606#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT 18
607#define AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_MASK (1 << 18)
608
609/* Used by CM_PER_GPIO4_CLKCTRL */
610#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_SHIFT 18
611#define AM33XX_OPTFCLKEN_GPIO_4_GDBCLK_MASK (1 << 18)
612
613/* Used by CM_PER_GPIO5_CLKCTRL */
614#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_SHIFT 18
615#define AM33XX_OPTFCLKEN_GPIO_5_GDBCLK_MASK (1 << 18)
616
617/* Used by CM_PER_GPIO6_CLKCTRL */
618#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_SHIFT 18
619#define AM33XX_OPTFCLKEN_GPIO_6_GDBCLK_MASK (1 << 18)
620
621/*
622 * Used by CM_MPU_MPU_CLKCTRL, CM_PER_CPGMAC0_CLKCTRL, CM_PER_PRUSS_CLKCTRL,
623 * CM_PER_IEEE5000_CLKCTRL, CM_PER_LCDC_CLKCTRL, CM_PER_MLB_CLKCTRL,
624 * CM_PER_MSTR_EXPS_CLKCTRL, CM_PER_OCPWP_CLKCTRL, CM_PER_PCIE_CLKCTRL,
625 * CM_PER_SPARE_CLKCTRL, CM_PER_TPTC0_CLKCTRL, CM_PER_TPTC1_CLKCTRL,
626 * CM_PER_TPTC2_CLKCTRL, CM_PER_USB0_CLKCTRL, CM_WKUP_DEBUGSS_CLKCTRL,
627 * CM_WKUP_WKUP_M3_CLKCTRL, CM_GFX_BITBLT_CLKCTRL, CM_GFX_GFX_CLKCTRL
628 */
629#define AM33XX_STBYST_SHIFT 18
630#define AM33XX_STBYST_MASK (1 << 18)
631
632/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
633#define AM33XX_STM_PMD_CLKDIVSEL_SHIFT 27
634#define AM33XX_STM_PMD_CLKDIVSEL_MASK (0x29 << 27)
635
636/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
637#define AM33XX_STM_PMD_CLKSEL_SHIFT 22
638#define AM33XX_STM_PMD_CLKSEL_MASK (0x23 << 22)
639
640/*
641 * Used by CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_DDR, CM_IDLEST_DPLL_DISP,
642 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER
643 */
644#define AM33XX_ST_DPLL_CLK_SHIFT 0
645#define AM33XX_ST_DPLL_CLK_MASK (1 << 0)
646
647/* Used by CM_CLKDCOLDO_DPLL_PER */
648#define AM33XX_ST_DPLL_CLKDCOLDO_SHIFT 8
649#define AM33XX_ST_DPLL_CLKDCOLDO_MASK (1 << 8)
650
651/*
652 * Used by CM_DIV_M2_DPLL_DDR, CM_DIV_M2_DPLL_DISP, CM_DIV_M2_DPLL_MPU,
653 * CM_DIV_M2_DPLL_PER
654 */
655#define AM33XX_ST_DPLL_CLKOUT_SHIFT 9
656#define AM33XX_ST_DPLL_CLKOUT_MASK (1 << 9)
657
658/* Used by CM_DIV_M4_DPLL_CORE */
659#define AM33XX_ST_HSDIVIDER_CLKOUT1_SHIFT 9
660#define AM33XX_ST_HSDIVIDER_CLKOUT1_MASK (1 << 9)
661
662/* Used by CM_DIV_M5_DPLL_CORE */
663#define AM33XX_ST_HSDIVIDER_CLKOUT2_SHIFT 9
664#define AM33XX_ST_HSDIVIDER_CLKOUT2_MASK (1 << 9)
665
666/* Used by CM_DIV_M6_DPLL_CORE */
667#define AM33XX_ST_HSDIVIDER_CLKOUT3_SHIFT 9
668#define AM33XX_ST_HSDIVIDER_CLKOUT3_MASK (1 << 9)
669
670/*
671 * Used by CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_DDR, CM_IDLEST_DPLL_DISP,
672 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER
673 */
674#define AM33XX_ST_MN_BYPASS_SHIFT 8
675#define AM33XX_ST_MN_BYPASS_MASK (1 << 8)
676
677/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
678#define AM33XX_TRC_PMD_CLKDIVSEL_SHIFT 24
679#define AM33XX_TRC_PMD_CLKDIVSEL_MASK (0x26 << 24)
680
681/* Used by CM_WKUP_DEBUGSS_CLKCTRL */
682#define AM33XX_TRC_PMD_CLKSEL_SHIFT 20
683#define AM33XX_TRC_PMD_CLKSEL_MASK (0x21 << 20)
684
685/* Used by CONTROL_SEC_CLK_CTRL */
686#define AM33XX_TIMER0_CLKSEL_MASK (0x3 << 4)
687#endif
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 8083a8cdc55f..766338fe4d34 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -169,8 +169,6 @@
169/* AM35XX specific CM_ICLKEN1_CORE bits */ 169/* AM35XX specific CM_ICLKEN1_CORE bits */
170#define AM35XX_EN_IPSS_MASK (1 << 4) 170#define AM35XX_EN_IPSS_MASK (1 << 4)
171#define AM35XX_EN_IPSS_SHIFT 4 171#define AM35XX_EN_IPSS_SHIFT 4
172#define AM35XX_EN_UART4_MASK (1 << 23)
173#define AM35XX_EN_UART4_SHIFT 23
174 172
175/* CM_ICLKEN2_CORE */ 173/* CM_ICLKEN2_CORE */
176#define OMAP3430_EN_PKA_MASK (1 << 4) 174#define OMAP3430_EN_PKA_MASK (1 << 4)
@@ -207,6 +205,8 @@
207#define OMAP3430_ST_DES2_MASK (1 << 26) 205#define OMAP3430_ST_DES2_MASK (1 << 26)
208#define OMAP3430_ST_MSPRO_SHIFT 23 206#define OMAP3430_ST_MSPRO_SHIFT 23
209#define OMAP3430_ST_MSPRO_MASK (1 << 23) 207#define OMAP3430_ST_MSPRO_MASK (1 << 23)
208#define AM35XX_ST_UART4_SHIFT 23
209#define AM35XX_ST_UART4_MASK (1 << 23)
210#define OMAP3430_ST_HDQ_SHIFT 22 210#define OMAP3430_ST_HDQ_SHIFT 22
211#define OMAP3430_ST_HDQ_MASK (1 << 22) 211#define OMAP3430_ST_HDQ_MASK (1 << 22)
212#define OMAP3430ES1_ST_FAC_SHIFT 8 212#define OMAP3430ES1_ST_FAC_SHIFT 8
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index a7bc096bd407..f24e3f7a2bbc 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -22,4 +22,15 @@
22 */ 22 */
23#define MAX_MODULE_READY_TIME 2000 23#define MAX_MODULE_READY_TIME 2000
24 24
25/*
26 * 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
28 * case of OMAP2 & 3. In the case of OMAP4 this is the max duration
29 * in microseconds for the module to reach the inactive state from
30 * a functional state.
31 * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
32 * kernel init.
33 */
34#define MAX_MODULE_DISABLE_TIME 5000
35
25#endif 36#endif
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
new file mode 100644
index 000000000000..13f56eafef03
--- /dev/null
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -0,0 +1,313 @@
1/*
2 * AM33XX CM functions
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Reference taken from from OMAP4 cminst44xx.c
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#include <linux/types.h>
21#include <linux/errno.h>
22#include <linux/err.h>
23#include <linux/io.h>
24
25#include <plat/common.h>
26
27#include "cm.h"
28#include "cm33xx.h"
29#include "cm-regbits-34xx.h"
30#include "cm-regbits-33xx.h"
31#include "prm33xx.h"
32
33/*
34 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
35 *
36 * 0x0 func: Module is fully functional, including OCP
37 * 0x1 trans: Module is performing transition: wakeup, or sleep, or sleep
38 * abortion
39 * 0x2 idle: Module is in Idle mode (only OCP part). It is functional if
40 * using separate functional clock
41 * 0x3 disabled: Module is disabled and cannot be accessed
42 *
43 */
44#define CLKCTRL_IDLEST_FUNCTIONAL 0x0
45#define CLKCTRL_IDLEST_INTRANSITION 0x1
46#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
47#define CLKCTRL_IDLEST_DISABLED 0x3
48
49/* Private functions */
50
51/* Read a register in a CM instance */
52static inline u32 am33xx_cm_read_reg(s16 inst, u16 idx)
53{
54 return __raw_readl(cm_base + inst + idx);
55}
56
57/* Write into a register in a CM */
58static inline void am33xx_cm_write_reg(u32 val, s16 inst, u16 idx)
59{
60 __raw_writel(val, cm_base + inst + idx);
61}
62
63/* Read-modify-write a register in CM */
64static inline u32 am33xx_cm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
65{
66 u32 v;
67
68 v = am33xx_cm_read_reg(inst, idx);
69 v &= ~mask;
70 v |= bits;
71 am33xx_cm_write_reg(v, inst, idx);
72
73 return v;
74}
75
76static inline u32 am33xx_cm_set_reg_bits(u32 bits, s16 inst, s16 idx)
77{
78 return am33xx_cm_rmw_reg_bits(bits, bits, inst, idx);
79}
80
81static inline u32 am33xx_cm_clear_reg_bits(u32 bits, s16 inst, s16 idx)
82{
83 return am33xx_cm_rmw_reg_bits(bits, 0x0, inst, idx);
84}
85
86static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
87{
88 u32 v;
89
90 v = am33xx_cm_read_reg(inst, idx);
91 v &= mask;
92 v >>= __ffs(mask);
93
94 return v;
95}
96
97/**
98 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
99 * @inst: CM instance register offset (*_INST macro)
100 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
101 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
102 *
103 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
104 * bit 0.
105 */
106static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs)
107{
108 u32 v = am33xx_cm_read_reg(inst, clkctrl_offs);
109 v &= AM33XX_IDLEST_MASK;
110 v >>= AM33XX_IDLEST_SHIFT;
111 return v;
112}
113
114/**
115 * _is_module_ready - can module registers be accessed without causing an abort?
116 * @inst: CM instance register offset (*_INST macro)
117 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
118 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
119 *
120 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
121 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
122 */
123static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
124{
125 u32 v;
126
127 v = _clkctrl_idlest(inst, cdoffs, clkctrl_offs);
128
129 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
130 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
131}
132
133/**
134 * _clktrctrl_write - write @c to a CM_CLKSTCTRL.CLKTRCTRL register bitfield
135 * @c: CLKTRCTRL register bitfield (LSB = bit 0, i.e., unshifted)
136 * @inst: CM instance register offset (*_INST macro)
137 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
138 *
139 * @c must be the unshifted value for CLKTRCTRL - i.e., this function
140 * will handle the shift itself.
141 */
142static void _clktrctrl_write(u8 c, s16 inst, u16 cdoffs)
143{
144 u32 v;
145
146 v = am33xx_cm_read_reg(inst, cdoffs);
147 v &= ~AM33XX_CLKTRCTRL_MASK;
148 v |= c << AM33XX_CLKTRCTRL_SHIFT;
149 am33xx_cm_write_reg(v, inst, cdoffs);
150}
151
152/* Public functions */
153
154/**
155 * am33xx_cm_is_clkdm_in_hwsup - is a clockdomain in hwsup idle mode?
156 * @inst: CM instance register offset (*_INST macro)
157 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
158 *
159 * Returns true if the clockdomain referred to by (@inst, @cdoffs)
160 * is in hardware-supervised idle mode, or 0 otherwise.
161 */
162bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs)
163{
164 u32 v;
165
166 v = am33xx_cm_read_reg(inst, cdoffs);
167 v &= AM33XX_CLKTRCTRL_MASK;
168 v >>= AM33XX_CLKTRCTRL_SHIFT;
169
170 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? true : false;
171}
172
173/**
174 * am33xx_cm_clkdm_enable_hwsup - put a clockdomain in hwsup-idle mode
175 * @inst: CM instance register offset (*_INST macro)
176 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
177 *
178 * Put a clockdomain referred to by (@inst, @cdoffs) into
179 * hardware-supervised idle mode. No return value.
180 */
181void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs)
182{
183 _clktrctrl_write(OMAP34XX_CLKSTCTRL_ENABLE_AUTO, inst, cdoffs);
184}
185
186/**
187 * am33xx_cm_clkdm_disable_hwsup - put a clockdomain in swsup-idle mode
188 * @inst: CM instance register offset (*_INST macro)
189 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
190 *
191 * Put a clockdomain referred to by (@inst, @cdoffs) into
192 * software-supervised idle mode, i.e., controlled manually by the
193 * Linux OMAP clockdomain code. No return value.
194 */
195void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs)
196{
197 _clktrctrl_write(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, inst, cdoffs);
198}
199
200/**
201 * am33xx_cm_clkdm_force_sleep - try to put a clockdomain into idle
202 * @inst: CM instance register offset (*_INST macro)
203 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
204 *
205 * Put a clockdomain referred to by (@inst, @cdoffs) into idle
206 * No return value.
207 */
208void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs)
209{
210 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, inst, cdoffs);
211}
212
213/**
214 * am33xx_cm_clkdm_force_wakeup - try to take a clockdomain out of idle
215 * @inst: CM instance register offset (*_INST macro)
216 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
217 *
218 * Take a clockdomain referred to by (@inst, @cdoffs) out of idle,
219 * waking it up. No return value.
220 */
221void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs)
222{
223 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, inst, cdoffs);
224}
225
226/*
227 *
228 */
229
230/**
231 * am33xx_cm_wait_module_ready - wait for a module to be in 'func' state
232 * @inst: CM instance register offset (*_INST macro)
233 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
234 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
235 *
236 * Wait for the module IDLEST to be functional. If the idle state is in any
237 * the non functional state (trans, idle or disabled), module and thus the
238 * sysconfig cannot be accessed and will probably lead to an "imprecise
239 * external abort"
240 */
241int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
242{
243 int i = 0;
244
245 if (!clkctrl_offs)
246 return 0;
247
248 omap_test_timeout(_is_module_ready(inst, cdoffs, clkctrl_offs),
249 MAX_MODULE_READY_TIME, i);
250
251 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
252}
253
254/**
255 * am33xx_cm_wait_module_idle - wait for a module to be in 'disabled'
256 * state
257 * @inst: CM instance register offset (*_INST macro)
258 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
259 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
260 *
261 * Wait for the module IDLEST to be disabled. Some PRCM transition,
262 * like reset assertion or parent clock de-activation must wait the
263 * module to be fully disabled.
264 */
265int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, u16 clkctrl_offs)
266{
267 int i = 0;
268
269 if (!clkctrl_offs)
270 return 0;
271
272 omap_test_timeout((_clkctrl_idlest(inst, cdoffs, clkctrl_offs) ==
273 CLKCTRL_IDLEST_DISABLED),
274 MAX_MODULE_READY_TIME, i);
275
276 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
277}
278
279/**
280 * am33xx_cm_module_enable - Enable the modulemode inside CLKCTRL
281 * @mode: Module mode (SW or HW)
282 * @inst: CM instance register offset (*_INST macro)
283 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
284 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
285 *
286 * No return value.
287 */
288void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, u16 clkctrl_offs)
289{
290 u32 v;
291
292 v = am33xx_cm_read_reg(inst, clkctrl_offs);
293 v &= ~AM33XX_MODULEMODE_MASK;
294 v |= mode << AM33XX_MODULEMODE_SHIFT;
295 am33xx_cm_write_reg(v, inst, clkctrl_offs);
296}
297
298/**
299 * am33xx_cm_module_disable - Disable the module inside CLKCTRL
300 * @inst: CM instance register offset (*_INST macro)
301 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
302 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
303 *
304 * No return value.
305 */
306void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
307{
308 u32 v;
309
310 v = am33xx_cm_read_reg(inst, clkctrl_offs);
311 v &= ~AM33XX_MODULEMODE_MASK;
312 am33xx_cm_write_reg(v, inst, clkctrl_offs);
313}
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
new file mode 100644
index 000000000000..5fa0b62e1a79
--- /dev/null
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -0,0 +1,420 @@
1/*
2 * AM33XX CM offset macros
3 *
4 * Copyright (C) 2011-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#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H
18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H
19
20#include <linux/delay.h>
21#include <linux/errno.h>
22#include <linux/err.h>
23#include <linux/io.h>
24
25#include "common.h"
26
27#include "cm.h"
28#include "cm-regbits-33xx.h"
29#include "cm33xx.h"
30
31/* CM base address */
32#define AM33XX_CM_BASE 0x44e00000
33
34#define AM33XX_CM_REGADDR(inst, reg) \
35 AM33XX_L4_WK_IO_ADDRESS(AM33XX_CM_BASE + (inst) + (reg))
36
37/* CM instances */
38#define AM33XX_CM_PER_MOD 0x0000
39#define AM33XX_CM_WKUP_MOD 0x0400
40#define AM33XX_CM_DPLL_MOD 0x0500
41#define AM33XX_CM_MPU_MOD 0x0600
42#define AM33XX_CM_DEVICE_MOD 0x0700
43#define AM33XX_CM_RTC_MOD 0x0800
44#define AM33XX_CM_GFX_MOD 0x0900
45#define AM33XX_CM_CEFUSE_MOD 0x0A00
46
47/* CM */
48
49/* CM.PER_CM register offsets */
50#define AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET 0x0000
51#define AM33XX_CM_PER_L4LS_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0000)
52#define AM33XX_CM_PER_L3S_CLKSTCTRL_OFFSET 0x0004
53#define AM33XX_CM_PER_L3S_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0004)
54#define AM33XX_CM_PER_L4FW_CLKSTCTRL_OFFSET 0x0008
55#define AM33XX_CM_PER_L4FW_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0008)
56#define AM33XX_CM_PER_L3_CLKSTCTRL_OFFSET 0x000c
57#define AM33XX_CM_PER_L3_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x000c)
58#define AM33XX_CM_PER_CPGMAC0_CLKCTRL_OFFSET 0x0014
59#define AM33XX_CM_PER_CPGMAC0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0014)
60#define AM33XX_CM_PER_LCDC_CLKCTRL_OFFSET 0x0018
61#define AM33XX_CM_PER_LCDC_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0018)
62#define AM33XX_CM_PER_USB0_CLKCTRL_OFFSET 0x001c
63#define AM33XX_CM_PER_USB0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x001c)
64#define AM33XX_CM_PER_MLB_CLKCTRL_OFFSET 0x0020
65#define AM33XX_CM_PER_MLB_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0020)
66#define AM33XX_CM_PER_TPTC0_CLKCTRL_OFFSET 0x0024
67#define AM33XX_CM_PER_TPTC0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0024)
68#define AM33XX_CM_PER_EMIF_CLKCTRL_OFFSET 0x0028
69#define AM33XX_CM_PER_EMIF_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0028)
70#define AM33XX_CM_PER_OCMCRAM_CLKCTRL_OFFSET 0x002c
71#define AM33XX_CM_PER_OCMCRAM_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x002c)
72#define AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET 0x0030
73#define AM33XX_CM_PER_GPMC_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0030)
74#define AM33XX_CM_PER_MCASP0_CLKCTRL_OFFSET 0x0034
75#define AM33XX_CM_PER_MCASP0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0034)
76#define AM33XX_CM_PER_UART5_CLKCTRL_OFFSET 0x0038
77#define AM33XX_CM_PER_UART5_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0038)
78#define AM33XX_CM_PER_MMC0_CLKCTRL_OFFSET 0x003c
79#define AM33XX_CM_PER_MMC0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x003c)
80#define AM33XX_CM_PER_ELM_CLKCTRL_OFFSET 0x0040
81#define AM33XX_CM_PER_ELM_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0040)
82#define AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET 0x0044
83#define AM33XX_CM_PER_I2C2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0044)
84#define AM33XX_CM_PER_I2C1_CLKCTRL_OFFSET 0x0048
85#define AM33XX_CM_PER_I2C1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0048)
86#define AM33XX_CM_PER_SPI0_CLKCTRL_OFFSET 0x004c
87#define AM33XX_CM_PER_SPI0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x004c)
88#define AM33XX_CM_PER_SPI1_CLKCTRL_OFFSET 0x0050
89#define AM33XX_CM_PER_SPI1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0050)
90#define AM33XX_CM_PER_SPI2_CLKCTRL_OFFSET 0x0054
91#define AM33XX_CM_PER_SPI2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0054)
92#define AM33XX_CM_PER_SPI3_CLKCTRL_OFFSET 0x0058
93#define AM33XX_CM_PER_SPI3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0058)
94#define AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET 0x0060
95#define AM33XX_CM_PER_L4LS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0060)
96#define AM33XX_CM_PER_L4FW_CLKCTRL_OFFSET 0x0064
97#define AM33XX_CM_PER_L4FW_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0064)
98#define AM33XX_CM_PER_MCASP1_CLKCTRL_OFFSET 0x0068
99#define AM33XX_CM_PER_MCASP1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0068)
100#define AM33XX_CM_PER_UART1_CLKCTRL_OFFSET 0x006c
101#define AM33XX_CM_PER_UART1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x006c)
102#define AM33XX_CM_PER_UART2_CLKCTRL_OFFSET 0x0070
103#define AM33XX_CM_PER_UART2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0070)
104#define AM33XX_CM_PER_UART3_CLKCTRL_OFFSET 0x0074
105#define AM33XX_CM_PER_UART3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0074)
106#define AM33XX_CM_PER_UART4_CLKCTRL_OFFSET 0x0078
107#define AM33XX_CM_PER_UART4_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0078)
108#define AM33XX_CM_PER_TIMER7_CLKCTRL_OFFSET 0x007c
109#define AM33XX_CM_PER_TIMER7_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x007c)
110#define AM33XX_CM_PER_TIMER2_CLKCTRL_OFFSET 0x0080
111#define AM33XX_CM_PER_TIMER2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0080)
112#define AM33XX_CM_PER_TIMER3_CLKCTRL_OFFSET 0x0084
113#define AM33XX_CM_PER_TIMER3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0084)
114#define AM33XX_CM_PER_TIMER4_CLKCTRL_OFFSET 0x0088
115#define AM33XX_CM_PER_TIMER4_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0088)
116#define AM33XX_CM_PER_MCASP2_CLKCTRL_OFFSET 0x008c
117#define AM33XX_CM_PER_MCASP2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x008c)
118#define AM33XX_CM_PER_RNG_CLKCTRL_OFFSET 0x0090
119#define AM33XX_CM_PER_RNG_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0090)
120#define AM33XX_CM_PER_AES0_CLKCTRL_OFFSET 0x0094
121#define AM33XX_CM_PER_AES0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0094)
122#define AM33XX_CM_PER_AES1_CLKCTRL_OFFSET 0x0098
123#define AM33XX_CM_PER_AES1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0098)
124#define AM33XX_CM_PER_DES_CLKCTRL_OFFSET 0x009c
125#define AM33XX_CM_PER_DES_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x009c)
126#define AM33XX_CM_PER_SHA0_CLKCTRL_OFFSET 0x00a0
127#define AM33XX_CM_PER_SHA0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00a0)
128#define AM33XX_CM_PER_PKA_CLKCTRL_OFFSET 0x00a4
129#define AM33XX_CM_PER_PKA_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00a4)
130#define AM33XX_CM_PER_GPIO6_CLKCTRL_OFFSET 0x00a8
131#define AM33XX_CM_PER_GPIO6_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00a8)
132#define AM33XX_CM_PER_GPIO1_CLKCTRL_OFFSET 0x00ac
133#define AM33XX_CM_PER_GPIO1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00ac)
134#define AM33XX_CM_PER_GPIO2_CLKCTRL_OFFSET 0x00b0
135#define AM33XX_CM_PER_GPIO2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00b0)
136#define AM33XX_CM_PER_GPIO3_CLKCTRL_OFFSET 0x00b4
137#define AM33XX_CM_PER_GPIO3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00b4)
138#define AM33XX_CM_PER_GPIO4_CLKCTRL_OFFSET 0x00b8
139#define AM33XX_CM_PER_GPIO4_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00b8)
140#define AM33XX_CM_PER_TPCC_CLKCTRL_OFFSET 0x00bc
141#define AM33XX_CM_PER_TPCC_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00bc)
142#define AM33XX_CM_PER_DCAN0_CLKCTRL_OFFSET 0x00c0
143#define AM33XX_CM_PER_DCAN0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00c0)
144#define AM33XX_CM_PER_DCAN1_CLKCTRL_OFFSET 0x00c4
145#define AM33XX_CM_PER_DCAN1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00c4)
146#define AM33XX_CM_PER_EPWMSS1_CLKCTRL_OFFSET 0x00cc
147#define AM33XX_CM_PER_EPWMSS1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00cc)
148#define AM33XX_CM_PER_EMIF_FW_CLKCTRL_OFFSET 0x00d0
149#define AM33XX_CM_PER_EMIF_FW_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00d0)
150#define AM33XX_CM_PER_EPWMSS0_CLKCTRL_OFFSET 0x00d4
151#define AM33XX_CM_PER_EPWMSS0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00d4)
152#define AM33XX_CM_PER_EPWMSS2_CLKCTRL_OFFSET 0x00d8
153#define AM33XX_CM_PER_EPWMSS2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00d8)
154#define AM33XX_CM_PER_L3_INSTR_CLKCTRL_OFFSET 0x00dc
155#define AM33XX_CM_PER_L3_INSTR_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00dc)
156#define AM33XX_CM_PER_L3_CLKCTRL_OFFSET 0x00e0
157#define AM33XX_CM_PER_L3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00e0)
158#define AM33XX_CM_PER_IEEE5000_CLKCTRL_OFFSET 0x00e4
159#define AM33XX_CM_PER_IEEE5000_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00e4)
160#define AM33XX_CM_PER_PRUSS_CLKCTRL_OFFSET 0x00e8
161#define AM33XX_CM_PER_PRUSS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00e8)
162#define AM33XX_CM_PER_TIMER5_CLKCTRL_OFFSET 0x00ec
163#define AM33XX_CM_PER_TIMER5_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00ec)
164#define AM33XX_CM_PER_TIMER6_CLKCTRL_OFFSET 0x00f0
165#define AM33XX_CM_PER_TIMER6_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00f0)
166#define AM33XX_CM_PER_MMC1_CLKCTRL_OFFSET 0x00f4
167#define AM33XX_CM_PER_MMC1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00f4)
168#define AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET 0x00f8
169#define AM33XX_CM_PER_MMC2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00f8)
170#define AM33XX_CM_PER_TPTC1_CLKCTRL_OFFSET 0x00fc
171#define AM33XX_CM_PER_TPTC1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x00fc)
172#define AM33XX_CM_PER_TPTC2_CLKCTRL_OFFSET 0x0100
173#define AM33XX_CM_PER_TPTC2_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0100)
174#define AM33XX_CM_PER_GPIO5_CLKCTRL_OFFSET 0x0104
175#define AM33XX_CM_PER_GPIO5_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0104)
176#define AM33XX_CM_PER_SPINLOCK_CLKCTRL_OFFSET 0x010c
177#define AM33XX_CM_PER_SPINLOCK_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x010c)
178#define AM33XX_CM_PER_MAILBOX0_CLKCTRL_OFFSET 0x0110
179#define AM33XX_CM_PER_MAILBOX0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0110)
180#define AM33XX_CM_PER_L4HS_CLKSTCTRL_OFFSET 0x011c
181#define AM33XX_CM_PER_L4HS_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x011c)
182#define AM33XX_CM_PER_L4HS_CLKCTRL_OFFSET 0x0120
183#define AM33XX_CM_PER_L4HS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0120)
184#define AM33XX_CM_PER_MSTR_EXPS_CLKCTRL_OFFSET 0x0124
185#define AM33XX_CM_PER_MSTR_EXPS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0124)
186#define AM33XX_CM_PER_SLV_EXPS_CLKCTRL_OFFSET 0x0128
187#define AM33XX_CM_PER_SLV_EXPS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0128)
188#define AM33XX_CM_PER_OCPWP_L3_CLKSTCTRL_OFFSET 0x012c
189#define AM33XX_CM_PER_OCPWP_L3_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x012c)
190#define AM33XX_CM_PER_OCPWP_CLKCTRL_OFFSET 0x0130
191#define AM33XX_CM_PER_OCPWP_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0130)
192#define AM33XX_CM_PER_MAILBOX1_CLKCTRL_OFFSET 0x0134
193#define AM33XX_CM_PER_MAILBOX1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0134)
194#define AM33XX_CM_PER_PRUSS_CLKSTCTRL_OFFSET 0x0140
195#define AM33XX_CM_PER_PRUSS_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0140)
196#define AM33XX_CM_PER_CPSW_CLKSTCTRL_OFFSET 0x0144
197#define AM33XX_CM_PER_CPSW_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0144)
198#define AM33XX_CM_PER_LCDC_CLKSTCTRL_OFFSET 0x0148
199#define AM33XX_CM_PER_LCDC_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0148)
200#define AM33XX_CM_PER_CLKDIV32K_CLKCTRL_OFFSET 0x014c
201#define AM33XX_CM_PER_CLKDIV32K_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x014c)
202#define AM33XX_CM_PER_CLK_24MHZ_CLKSTCTRL_OFFSET 0x0150
203#define AM33XX_CM_PER_CLK_24MHZ_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_PER_MOD, 0x0150)
204
205/* CM.WKUP_CM register offsets */
206#define AM33XX_CM_WKUP_CLKSTCTRL_OFFSET 0x0000
207#define AM33XX_CM_WKUP_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0000)
208#define AM33XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET 0x0004
209#define AM33XX_CM_WKUP_CONTROL_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0004)
210#define AM33XX_CM_WKUP_GPIO0_CLKCTRL_OFFSET 0x0008
211#define AM33XX_CM_WKUP_GPIO0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0008)
212#define AM33XX_CM_WKUP_L4WKUP_CLKCTRL_OFFSET 0x000c
213#define AM33XX_CM_WKUP_L4WKUP_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x000c)
214#define AM33XX_CM_WKUP_TIMER0_CLKCTRL_OFFSET 0x0010
215#define AM33XX_CM_WKUP_TIMER0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0010)
216#define AM33XX_CM_WKUP_DEBUGSS_CLKCTRL_OFFSET 0x0014
217#define AM33XX_CM_WKUP_DEBUGSS_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0014)
218#define AM33XX_CM_L3_AON_CLKSTCTRL_OFFSET 0x0018
219#define AM33XX_CM_L3_AON_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0018)
220#define AM33XX_CM_AUTOIDLE_DPLL_MPU_OFFSET 0x001c
221#define AM33XX_CM_AUTOIDLE_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x001c)
222#define AM33XX_CM_IDLEST_DPLL_MPU_OFFSET 0x0020
223#define AM33XX_CM_IDLEST_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0020)
224#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_MPU_OFFSET 0x0024
225#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0024)
226#define AM33XX_CM_SSC_MODFREQDIV_DPLL_MPU_OFFSET 0x0028
227#define AM33XX_CM_SSC_MODFREQDIV_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0028)
228#define AM33XX_CM_CLKSEL_DPLL_MPU_OFFSET 0x002c
229#define AM33XX_CM_CLKSEL_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x002c)
230#define AM33XX_CM_AUTOIDLE_DPLL_DDR_OFFSET 0x0030
231#define AM33XX_CM_AUTOIDLE_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0030)
232#define AM33XX_CM_IDLEST_DPLL_DDR_OFFSET 0x0034
233#define AM33XX_CM_IDLEST_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0034)
234#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_DDR_OFFSET 0x0038
235#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0038)
236#define AM33XX_CM_SSC_MODFREQDIV_DPLL_DDR_OFFSET 0x003c
237#define AM33XX_CM_SSC_MODFREQDIV_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x003c)
238#define AM33XX_CM_CLKSEL_DPLL_DDR_OFFSET 0x0040
239#define AM33XX_CM_CLKSEL_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0040)
240#define AM33XX_CM_AUTOIDLE_DPLL_DISP_OFFSET 0x0044
241#define AM33XX_CM_AUTOIDLE_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0044)
242#define AM33XX_CM_IDLEST_DPLL_DISP_OFFSET 0x0048
243#define AM33XX_CM_IDLEST_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0048)
244#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_DISP_OFFSET 0x004c
245#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x004c)
246#define AM33XX_CM_SSC_MODFREQDIV_DPLL_DISP_OFFSET 0x0050
247#define AM33XX_CM_SSC_MODFREQDIV_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0050)
248#define AM33XX_CM_CLKSEL_DPLL_DISP_OFFSET 0x0054
249#define AM33XX_CM_CLKSEL_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0054)
250#define AM33XX_CM_AUTOIDLE_DPLL_CORE_OFFSET 0x0058
251#define AM33XX_CM_AUTOIDLE_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0058)
252#define AM33XX_CM_IDLEST_DPLL_CORE_OFFSET 0x005c
253#define AM33XX_CM_IDLEST_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x005c)
254#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_CORE_OFFSET 0x0060
255#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0060)
256#define AM33XX_CM_SSC_MODFREQDIV_DPLL_CORE_OFFSET 0x0064
257#define AM33XX_CM_SSC_MODFREQDIV_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0064)
258#define AM33XX_CM_CLKSEL_DPLL_CORE_OFFSET 0x0068
259#define AM33XX_CM_CLKSEL_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0068)
260#define AM33XX_CM_AUTOIDLE_DPLL_PER_OFFSET 0x006c
261#define AM33XX_CM_AUTOIDLE_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x006c)
262#define AM33XX_CM_IDLEST_DPLL_PER_OFFSET 0x0070
263#define AM33XX_CM_IDLEST_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0070)
264#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_PER_OFFSET 0x0074
265#define AM33XX_CM_SSC_DELTAMSTEP_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0074)
266#define AM33XX_CM_SSC_MODFREQDIV_DPLL_PER_OFFSET 0x0078
267#define AM33XX_CM_SSC_MODFREQDIV_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0078)
268#define AM33XX_CM_CLKDCOLDO_DPLL_PER_OFFSET 0x007c
269#define AM33XX_CM_CLKDCOLDO_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x007c)
270#define AM33XX_CM_DIV_M4_DPLL_CORE_OFFSET 0x0080
271#define AM33XX_CM_DIV_M4_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0080)
272#define AM33XX_CM_DIV_M5_DPLL_CORE_OFFSET 0x0084
273#define AM33XX_CM_DIV_M5_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0084)
274#define AM33XX_CM_CLKMODE_DPLL_MPU_OFFSET 0x0088
275#define AM33XX_CM_CLKMODE_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0088)
276#define AM33XX_CM_CLKMODE_DPLL_PER_OFFSET 0x008c
277#define AM33XX_CM_CLKMODE_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x008c)
278#define AM33XX_CM_CLKMODE_DPLL_CORE_OFFSET 0x0090
279#define AM33XX_CM_CLKMODE_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0090)
280#define AM33XX_CM_CLKMODE_DPLL_DDR_OFFSET 0x0094
281#define AM33XX_CM_CLKMODE_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0094)
282#define AM33XX_CM_CLKMODE_DPLL_DISP_OFFSET 0x0098
283#define AM33XX_CM_CLKMODE_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x0098)
284#define AM33XX_CM_CLKSEL_DPLL_PERIPH_OFFSET 0x009c
285#define AM33XX_CM_CLKSEL_DPLL_PERIPH AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x009c)
286#define AM33XX_CM_DIV_M2_DPLL_DDR_OFFSET 0x00a0
287#define AM33XX_CM_DIV_M2_DPLL_DDR AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00a0)
288#define AM33XX_CM_DIV_M2_DPLL_DISP_OFFSET 0x00a4
289#define AM33XX_CM_DIV_M2_DPLL_DISP AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00a4)
290#define AM33XX_CM_DIV_M2_DPLL_MPU_OFFSET 0x00a8
291#define AM33XX_CM_DIV_M2_DPLL_MPU AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00a8)
292#define AM33XX_CM_DIV_M2_DPLL_PER_OFFSET 0x00ac
293#define AM33XX_CM_DIV_M2_DPLL_PER AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00ac)
294#define AM33XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET 0x00b0
295#define AM33XX_CM_WKUP_WKUP_M3_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00b0)
296#define AM33XX_CM_WKUP_UART0_CLKCTRL_OFFSET 0x00b4
297#define AM33XX_CM_WKUP_UART0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00b4)
298#define AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET 0x00b8
299#define AM33XX_CM_WKUP_I2C0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00b8)
300#define AM33XX_CM_WKUP_ADC_TSC_CLKCTRL_OFFSET 0x00bc
301#define AM33XX_CM_WKUP_ADC_TSC_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00bc)
302#define AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL_OFFSET 0x00c0
303#define AM33XX_CM_WKUP_SMARTREFLEX0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00c0)
304#define AM33XX_CM_WKUP_TIMER1_CLKCTRL_OFFSET 0x00c4
305#define AM33XX_CM_WKUP_TIMER1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00c4)
306#define AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL_OFFSET 0x00c8
307#define AM33XX_CM_WKUP_SMARTREFLEX1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00c8)
308#define AM33XX_CM_L4_WKUP_AON_CLKSTCTRL_OFFSET 0x00cc
309#define AM33XX_CM_L4_WKUP_AON_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00cc)
310#define AM33XX_CM_WKUP_WDT0_CLKCTRL_OFFSET 0x00d0
311#define AM33XX_CM_WKUP_WDT0_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00d0)
312#define AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET 0x00d4
313#define AM33XX_CM_WKUP_WDT1_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00d4)
314#define AM33XX_CM_DIV_M6_DPLL_CORE_OFFSET 0x00d8
315#define AM33XX_CM_DIV_M6_DPLL_CORE AM33XX_CM_REGADDR(AM33XX_CM_WKUP_MOD, 0x00d8)
316
317/* CM.DPLL_CM register offsets */
318#define AM33XX_CLKSEL_TIMER7_CLK_OFFSET 0x0004
319#define AM33XX_CLKSEL_TIMER7_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0004)
320#define AM33XX_CLKSEL_TIMER2_CLK_OFFSET 0x0008
321#define AM33XX_CLKSEL_TIMER2_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0008)
322#define AM33XX_CLKSEL_TIMER3_CLK_OFFSET 0x000c
323#define AM33XX_CLKSEL_TIMER3_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x000c)
324#define AM33XX_CLKSEL_TIMER4_CLK_OFFSET 0x0010
325#define AM33XX_CLKSEL_TIMER4_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0010)
326#define AM33XX_CM_MAC_CLKSEL_OFFSET 0x0014
327#define AM33XX_CM_MAC_CLKSEL AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0014)
328#define AM33XX_CLKSEL_TIMER5_CLK_OFFSET 0x0018
329#define AM33XX_CLKSEL_TIMER5_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0018)
330#define AM33XX_CLKSEL_TIMER6_CLK_OFFSET 0x001c
331#define AM33XX_CLKSEL_TIMER6_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x001c)
332#define AM33XX_CM_CPTS_RFT_CLKSEL_OFFSET 0x0020
333#define AM33XX_CM_CPTS_RFT_CLKSEL AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0020)
334#define AM33XX_CLKSEL_TIMER1MS_CLK_OFFSET 0x0028
335#define AM33XX_CLKSEL_TIMER1MS_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0028)
336#define AM33XX_CLKSEL_GFX_FCLK_OFFSET 0x002c
337#define AM33XX_CLKSEL_GFX_FCLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x002c)
338#define AM33XX_CLKSEL_PRUSS_OCP_CLK_OFFSET 0x0030
339#define AM33XX_CLKSEL_PRUSS_OCP_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0030)
340#define AM33XX_CLKSEL_LCDC_PIXEL_CLK_OFFSET 0x0034
341#define AM33XX_CLKSEL_LCDC_PIXEL_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0034)
342#define AM33XX_CLKSEL_WDT1_CLK_OFFSET 0x0038
343#define AM33XX_CLKSEL_WDT1_CLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x0038)
344#define AM33XX_CLKSEL_GPIO0_DBCLK_OFFSET 0x003c
345#define AM33XX_CLKSEL_GPIO0_DBCLK AM33XX_CM_REGADDR(AM33XX_CM_DPLL_MOD, 0x003c)
346
347/* CM.MPU_CM register offsets */
348#define AM33XX_CM_MPU_CLKSTCTRL_OFFSET 0x0000
349#define AM33XX_CM_MPU_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_MPU_MOD, 0x0000)
350#define AM33XX_CM_MPU_MPU_CLKCTRL_OFFSET 0x0004
351#define AM33XX_CM_MPU_MPU_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_MPU_MOD, 0x0004)
352
353/* CM.DEVICE_CM register offsets */
354#define AM33XX_CM_CLKOUT_CTRL_OFFSET 0x0000
355#define AM33XX_CM_CLKOUT_CTRL AM33XX_CM_REGADDR(AM33XX_CM_DEVICE_MOD, 0x0000)
356
357/* CM.RTC_CM register offsets */
358#define AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET 0x0000
359#define AM33XX_CM_RTC_RTC_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_RTC_MOD, 0x0000)
360#define AM33XX_CM_RTC_CLKSTCTRL_OFFSET 0x0004
361#define AM33XX_CM_RTC_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_RTC_MOD, 0x0004)
362
363/* CM.GFX_CM register offsets */
364#define AM33XX_CM_GFX_L3_CLKSTCTRL_OFFSET 0x0000
365#define AM33XX_CM_GFX_L3_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x0000)
366#define AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET 0x0004
367#define AM33XX_CM_GFX_GFX_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x0004)
368#define AM33XX_CM_GFX_BITBLT_CLKCTRL_OFFSET 0x0008
369#define AM33XX_CM_GFX_BITBLT_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x0008)
370#define AM33XX_CM_GFX_L4LS_GFX_CLKSTCTRL__1_OFFSET 0x000c
371#define AM33XX_CM_GFX_L4LS_GFX_CLKSTCTRL__1 AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x000c)
372#define AM33XX_CM_GFX_MMUCFG_CLKCTRL_OFFSET 0x0010
373#define AM33XX_CM_GFX_MMUCFG_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x0010)
374#define AM33XX_CM_GFX_MMUDATA_CLKCTRL_OFFSET 0x0014
375#define AM33XX_CM_GFX_MMUDATA_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_GFX_MOD, 0x0014)
376
377/* CM.CEFUSE_CM register offsets */
378#define AM33XX_CM_CEFUSE_CLKSTCTRL_OFFSET 0x0000
379#define AM33XX_CM_CEFUSE_CLKSTCTRL AM33XX_CM_REGADDR(AM33XX_CM_CEFUSE_MOD, 0x0000)
380#define AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL_OFFSET 0x0020
381#define AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL AM33XX_CM_REGADDR(AM33XX_CM_CEFUSE_MOD, 0x0020)
382
383
384extern bool am33xx_cm_is_clkdm_in_hwsup(s16 inst, u16 cdoffs);
385extern void am33xx_cm_clkdm_enable_hwsup(s16 inst, u16 cdoffs);
386extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs);
387extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs);
388extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs);
389
390#ifdef CONFIG_SOC_AM33XX
391extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
392 u16 clkctrl_offs);
393extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
394 u16 clkctrl_offs);
395extern void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
396 u16 clkctrl_offs);
397extern int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs,
398 u16 clkctrl_offs);
399#else
400static inline int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
401 u16 clkctrl_offs)
402{
403 return 0;
404}
405static inline void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
406 u16 clkctrl_offs)
407{
408}
409static inline void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
410 u16 clkctrl_offs)
411{
412}
413static inline int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs,
414 u16 clkctrl_offs)
415{
416 return 0;
417}
418#endif
419
420#endif
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 8c86d294b1a3..1894015ff04b 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -235,20 +235,6 @@ void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs)
235} 235}
236 236
237/** 237/**
238 * omap4_cminst_clkdm_force_sleep - try to put a clockdomain into idle
239 * @part: PRCM partition ID that the clockdomain registers exist in
240 * @inst: CM instance register offset (*_INST macro)
241 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
242 *
243 * Put a clockdomain referred to by (@part, @inst, @cdoffs) into idle
244 * No return value.
245 */
246void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs)
247{
248 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
249}
250
251/**
252 * omap4_cminst_clkdm_force_sleep - try to take a clockdomain out of idle 238 * omap4_cminst_clkdm_force_sleep - try to take a clockdomain out of idle
253 * @part: PRCM partition ID that the clockdomain registers exist in 239 * @part: PRCM partition ID that the clockdomain registers exist in
254 * @inst: CM instance register offset (*_INST macro) 240 * @inst: CM instance register offset (*_INST macro)
@@ -313,9 +299,9 @@ int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_off
313 299
314 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) == 300 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) ==
315 CLKCTRL_IDLEST_DISABLED), 301 CLKCTRL_IDLEST_DISABLED),
316 MAX_MODULE_READY_TIME, i); 302 MAX_MODULE_DISABLE_TIME, i);
317 303
318 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 304 return (i < MAX_MODULE_DISABLE_TIME) ? 0 : -EBUSY;
319} 305}
320 306
321/** 307/**
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index a018a7327879..d69fdefef985 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -16,38 +16,13 @@ extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs);
16extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs); 16extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs);
17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs); 17extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs); 18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
19
20extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs); 19extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
21
22# ifdef CONFIG_ARCH_OMAP4
23extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, 20extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
24 u16 clkctrl_offs); 21 u16 clkctrl_offs);
25
26extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs, 22extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
27 u16 clkctrl_offs); 23 u16 clkctrl_offs);
28extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs, 24extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
29 u16 clkctrl_offs); 25 u16 clkctrl_offs);
30
31# else
32
33static inline int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
34 u16 clkctrl_offs)
35{
36 return 0;
37}
38
39static inline void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
40 s16 cdoffs, u16 clkctrl_offs)
41{
42}
43
44static inline void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
45 u16 clkctrl_offs)
46{
47}
48
49# endif
50
51/* 26/*
52 * In an ideal world, we would not export these low-level functions, 27 * In an ideal world, we would not export these low-level functions,
53 * but this will probably take some time to fix properly 28 * but this will probably take some time to fix properly
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 1706ebcec08d..14734746457c 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -35,6 +35,16 @@ static struct omap2_mcspi_device_config ads7846_mcspi_config = {
35 .turbo_mode = 0, 35 .turbo_mode = 0,
36}; 36};
37 37
38/*
39 * ADS7846 driver maybe request a gpio according to the value
40 * of pdata->get_pendown_state, but we have done this. So set
41 * get_pendown_state to avoid twice gpio requesting.
42 */
43static int omap3_get_pendown_state(void)
44{
45 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
46}
47
38static struct ads7846_platform_data ads7846_config = { 48static struct ads7846_platform_data ads7846_config = {
39 .x_max = 0x0fff, 49 .x_max = 0x0fff,
40 .y_max = 0x0fff, 50 .y_max = 0x0fff,
@@ -45,6 +55,7 @@ static struct ads7846_platform_data ads7846_config = {
45 .debounce_rep = 1, 55 .debounce_rep = 1,
46 .gpio_pendown = -EINVAL, 56 .gpio_pendown = -EINVAL,
47 .keep_vref_on = 1, 57 .keep_vref_on = 1,
58 .get_pendown_state = &omap3_get_pendown_state,
48}; 59};
49 60
50static struct spi_board_info ads7846_spi_board_info __initdata = { 61static struct spi_board_info ads7846_spi_board_info __initdata = {
@@ -63,28 +74,30 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
63 struct spi_board_info *spi_bi = &ads7846_spi_board_info; 74 struct spi_board_info *spi_bi = &ads7846_spi_board_info;
64 int err; 75 int err;
65 76
66 if (board_pdata && board_pdata->get_pendown_state) { 77 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
67 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); 78 if (err) {
68 if (err) { 79 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
69 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); 80 return;
70 return;
71 }
72 gpio_export(gpio_pendown, 0);
73
74 if (gpio_debounce)
75 gpio_set_debounce(gpio_pendown, gpio_debounce);
76 } 81 }
77 82
83 if (gpio_debounce)
84 gpio_set_debounce(gpio_pendown, gpio_debounce);
85
78 spi_bi->bus_num = bus_num; 86 spi_bi->bus_num = bus_num;
79 spi_bi->irq = gpio_to_irq(gpio_pendown); 87 spi_bi->irq = gpio_to_irq(gpio_pendown);
80 88
81 if (board_pdata) { 89 if (board_pdata) {
82 board_pdata->gpio_pendown = gpio_pendown; 90 board_pdata->gpio_pendown = gpio_pendown;
83 spi_bi->platform_data = board_pdata; 91 spi_bi->platform_data = board_pdata;
92 if (board_pdata->get_pendown_state)
93 gpio_export(gpio_pendown, 0);
84 } else { 94 } else {
85 ads7846_config.gpio_pendown = gpio_pendown; 95 ads7846_config.gpio_pendown = gpio_pendown;
86 } 96 }
87 97
98 if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
99 gpio_free(gpio_pendown);
100
88 spi_register_board_info(&ads7846_spi_board_info, 1); 101 spi_register_board_info(&ads7846_spi_board_info, 1);
89} 102}
90#else 103#else
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index a0b4a42836ab..4c4ef6a6166b 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -4,6 +4,7 @@
4#include "twl-common.h" 4#include "twl-common.h"
5 5
6#define NAND_BLOCK_SIZE SZ_128K 6#define NAND_BLOCK_SIZE SZ_128K
7#define OMAP3_EVM_TS_GPIO 175
7 8
8struct mtd_partition; 9struct mtd_partition;
9struct ads7846_platform_data; 10struct ads7846_platform_data;
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 8a6953a34fe2..069f9725b1c3 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -29,8 +29,6 @@
29 29
30/* Global address base setup code */ 30/* Global address base setup code */
31 31
32#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
33
34static void __init __omap2_set_globals(struct omap_globals *omap2_globals) 32static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
35{ 33{
36 omap2_set_globals_tap(omap2_globals); 34 omap2_set_globals_tap(omap2_globals);
@@ -39,8 +37,6 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
39 omap2_set_globals_prcm(omap2_globals); 37 omap2_set_globals_prcm(omap2_globals);
40} 38}
41 39
42#endif
43
44#if defined(CONFIG_SOC_OMAP2420) 40#if defined(CONFIG_SOC_OMAP2420)
45 41
46static struct omap_globals omap242x_globals = { 42static struct omap_globals omap242x_globals = {
@@ -134,7 +130,9 @@ void __init ti81xx_map_io(void)
134{ 130{
135 omapti81xx_map_common_io(); 131 omapti81xx_map_common_io();
136} 132}
133#endif
137 134
135#if defined(CONFIG_SOC_AM33XX)
138#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \ 136#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
139 TI81XX_CONTROL_DEVICE_ID - 0x204) 137 TI81XX_CONTROL_DEVICE_ID - 0x204)
140 138
@@ -171,9 +169,7 @@ static struct omap_globals omap4_globals = {
171 169
172void __init omap2_set_globals_443x(void) 170void __init omap2_set_globals_443x(void)
173{ 171{
174 omap2_set_globals_tap(&omap4_globals); 172 __omap2_set_globals(&omap4_globals);
175 omap2_set_globals_control(&omap4_globals);
176 omap2_set_globals_prcm(&omap4_globals);
177} 173}
178 174
179void __init omap4_map_io(void) 175void __init omap4_map_io(void)
@@ -182,3 +178,27 @@ void __init omap4_map_io(void)
182} 178}
183#endif 179#endif
184 180
181#if defined(CONFIG_SOC_OMAP5)
182static struct omap_globals omap5_globals = {
183 .class = OMAP54XX_CLASS,
184 .tap = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
185 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
186 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
187 .prm = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
188 .cm = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
189 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
190 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
191};
192
193void __init omap2_set_globals_5xxx(void)
194{
195 omap2_set_globals_tap(&omap5_globals);
196 omap2_set_globals_control(&omap5_globals);
197 omap2_set_globals_prcm(&omap5_globals);
198}
199
200void __init omap5_map_io(void)
201{
202 omap5_map_common_io();
203}
204#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index be9dfd1abe60..1f65b1871c23 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -115,12 +115,22 @@ static inline int omap_mux_late_init(void)
115} 115}
116#endif 116#endif
117 117
118#ifdef CONFIG_SOC_OMAP5
119extern void omap5_map_common_io(void);
120#else
121static inline void omap5_map_common_io(void)
122{
123}
124#endif
125
118extern void omap2_init_common_infrastructure(void); 126extern void omap2_init_common_infrastructure(void);
119 127
120extern struct sys_timer omap2_timer; 128extern struct sys_timer omap2_timer;
121extern struct sys_timer omap3_timer; 129extern struct sys_timer omap3_timer;
122extern struct sys_timer omap3_secure_timer; 130extern struct sys_timer omap3_secure_timer;
131extern struct sys_timer omap3_am33xx_timer;
123extern struct sys_timer omap4_timer; 132extern struct sys_timer omap4_timer;
133extern struct sys_timer omap5_timer;
124 134
125void omap2420_init_early(void); 135void omap2420_init_early(void);
126void omap2430_init_early(void); 136void omap2430_init_early(void);
@@ -128,9 +138,12 @@ void omap3430_init_early(void);
128void omap35xx_init_early(void); 138void omap35xx_init_early(void);
129void omap3630_init_early(void); 139void omap3630_init_early(void);
130void omap3_init_early(void); /* Do not use this one */ 140void omap3_init_early(void); /* Do not use this one */
141void am33xx_init_early(void);
131void am35xx_init_early(void); 142void am35xx_init_early(void);
132void ti81xx_init_early(void); 143void ti81xx_init_early(void);
144void am33xx_init_early(void);
133void omap4430_init_early(void); 145void omap4430_init_early(void);
146void omap5_init_early(void);
134void omap3_init_late(void); /* Do not use this one */ 147void omap3_init_late(void); /* Do not use this one */
135void omap4430_init_late(void); 148void omap4430_init_late(void);
136void omap2420_init_late(void); 149void omap2420_init_late(void);
@@ -166,12 +179,18 @@ void omap2_set_globals_242x(void);
166void omap2_set_globals_243x(void); 179void omap2_set_globals_243x(void);
167void omap2_set_globals_3xxx(void); 180void omap2_set_globals_3xxx(void);
168void omap2_set_globals_443x(void); 181void omap2_set_globals_443x(void);
182void omap2_set_globals_5xxx(void);
169void omap2_set_globals_ti81xx(void); 183void omap2_set_globals_ti81xx(void);
170void omap2_set_globals_am33xx(void); 184void omap2_set_globals_am33xx(void);
171 185
172/* These get called from omap2_set_globals_xxxx(), do not call these */ 186/* These get called from omap2_set_globals_xxxx(), do not call these */
173void omap2_set_globals_tap(struct omap_globals *); 187void omap2_set_globals_tap(struct omap_globals *);
188#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
174void omap2_set_globals_sdrc(struct omap_globals *); 189void omap2_set_globals_sdrc(struct omap_globals *);
190#else
191static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
192{ }
193#endif
175void omap2_set_globals_control(struct omap_globals *); 194void omap2_set_globals_control(struct omap_globals *);
176void omap2_set_globals_prcm(struct omap_globals *); 195void omap2_set_globals_prcm(struct omap_globals *);
177 196
@@ -180,6 +199,7 @@ void omap243x_map_io(void);
180void omap3_map_io(void); 199void omap3_map_io(void);
181void am33xx_map_io(void); 200void am33xx_map_io(void);
182void omap4_map_io(void); 201void omap4_map_io(void);
202void omap5_map_io(void);
183void ti81xx_map_io(void); 203void ti81xx_map_io(void);
184void omap_barriers_init(void); 204void omap_barriers_init(void);
185 205
@@ -219,6 +239,8 @@ void omap3_intc_prepare_idle(void);
219void omap3_intc_resume_idle(void); 239void omap3_intc_resume_idle(void);
220void omap2_intc_handle_irq(struct pt_regs *regs); 240void omap2_intc_handle_irq(struct pt_regs *regs);
221void omap3_intc_handle_irq(struct pt_regs *regs); 241void omap3_intc_handle_irq(struct pt_regs *regs);
242void omap_intc_of_init(void);
243void omap_gic_of_init(void);
222 244
223#ifdef CONFIG_CACHE_L2X0 245#ifdef CONFIG_CACHE_L2X0
224extern void __iomem *omap4_get_l2cache_base(void); 246extern void __iomem *omap4_get_l2cache_base(void);
@@ -226,10 +248,10 @@ extern void __iomem *omap4_get_l2cache_base(void);
226 248
227struct device_node; 249struct device_node;
228#ifdef CONFIG_OF 250#ifdef CONFIG_OF
229int __init omap_intc_of_init(struct device_node *node, 251int __init intc_of_init(struct device_node *node,
230 struct device_node *parent); 252 struct device_node *parent);
231#else 253#else
232int __init omap_intc_of_init(struct device_node *node, 254int __init intc_of_init(struct device_node *node,
233 struct device_node *parent) 255 struct device_node *parent)
234{ 256{
235 return 0; 257 return 0;
@@ -256,6 +278,7 @@ extern void omap_secondary_startup(void);
256extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask); 278extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
257extern void omap_auxcoreboot_addr(u32 cpu_addr); 279extern void omap_auxcoreboot_addr(u32 cpu_addr);
258extern u32 omap_read_auxcoreboot0(void); 280extern u32 omap_read_auxcoreboot0(void);
281extern void omap5_secondary_startup(void);
259#endif 282#endif
260 283
261#if defined(CONFIG_SMP) && defined(CONFIG_PM) 284#if defined(CONFIG_SMP) && defined(CONFIG_PM)
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 08e674bb0417..3223b81e7532 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -241,6 +241,49 @@ void omap3_ctrl_write_boot_mode(u8 bootmode)
241 241
242#endif 242#endif
243 243
244/**
245 * omap_ctrl_write_dsp_boot_addr - set boot address for a remote processor
246 * @bootaddr: physical address of the boot loader
247 *
248 * Set boot address for the boot loader of a supported processor
249 * when a power ON sequence occurs.
250 */
251void omap_ctrl_write_dsp_boot_addr(u32 bootaddr)
252{
253 u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTADDR :
254 cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTADDR :
255 cpu_is_omap44xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR :
256 0;
257
258 if (!offset) {
259 pr_err("%s: unsupported omap type\n", __func__);
260 return;
261 }
262
263 omap_ctrl_writel(bootaddr, offset);
264}
265
266/**
267 * omap_ctrl_write_dsp_boot_mode - set boot mode for a remote processor
268 * @bootmode: 8-bit value to pass to some boot code
269 *
270 * Sets boot mode for the boot loader of a supported processor
271 * when a power ON sequence occurs.
272 */
273void omap_ctrl_write_dsp_boot_mode(u8 bootmode)
274{
275 u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTMOD :
276 cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTMOD :
277 0;
278
279 if (!offset) {
280 pr_err("%s: unsupported omap type\n", __func__);
281 return;
282 }
283
284 omap_ctrl_writel(bootmode, offset);
285}
286
244#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) 287#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
245/* 288/*
246 * Clears the scratchpad contents in case of cold boot- 289 * Clears the scratchpad contents in case of cold boot-
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a406fd045ce1..b8cdc8531b60 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -21,6 +21,8 @@
21#include <mach/ctrl_module_pad_core_44xx.h> 21#include <mach/ctrl_module_pad_core_44xx.h>
22#include <mach/ctrl_module_pad_wkup_44xx.h> 22#include <mach/ctrl_module_pad_wkup_44xx.h>
23 23
24#include <plat/am33xx.h>
25
24#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
25#define OMAP242X_CTRL_REGADDR(reg) \ 27#define OMAP242X_CTRL_REGADDR(reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg)) 28 OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
@@ -28,6 +30,8 @@
28 OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg)) 30 OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
29#define OMAP343X_CTRL_REGADDR(reg) \ 31#define OMAP343X_CTRL_REGADDR(reg) \
30 OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) 32 OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
33#define AM33XX_CTRL_REGADDR(reg) \
34 AM33XX_L4_WK_IO_ADDRESS(AM33XX_SCM_BASE + (reg))
31#else 35#else
32#define OMAP242X_CTRL_REGADDR(reg) \ 36#define OMAP242X_CTRL_REGADDR(reg) \
33 OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg)) 37 OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
@@ -35,6 +39,8 @@
35 OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg)) 39 OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
36#define OMAP343X_CTRL_REGADDR(reg) \ 40#define OMAP343X_CTRL_REGADDR(reg) \
37 OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) 41 OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
42#define AM33XX_CTRL_REGADDR(reg) \
43 AM33XX_L4_WK_IO_ADDRESS(AM33XX_SCM_BASE + (reg))
38#endif /* __ASSEMBLY__ */ 44#endif /* __ASSEMBLY__ */
39 45
40/* 46/*
@@ -182,6 +188,7 @@
182#define OMAP3630_CONTROL_FUSE_OPP120_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120) 188#define OMAP3630_CONTROL_FUSE_OPP120_VDD1 (OMAP2_CONTROL_GENERAL + 0x0120)
183#define OMAP3630_CONTROL_FUSE_OPP50_VDD2 (OMAP2_CONTROL_GENERAL + 0x0128) 189#define OMAP3630_CONTROL_FUSE_OPP50_VDD2 (OMAP2_CONTROL_GENERAL + 0x0128)
184#define OMAP3630_CONTROL_FUSE_OPP100_VDD2 (OMAP2_CONTROL_GENERAL + 0x012C) 190#define OMAP3630_CONTROL_FUSE_OPP100_VDD2 (OMAP2_CONTROL_GENERAL + 0x012C)
191#define OMAP3630_CONTROL_CAMERA_PHY_CTRL (OMAP2_CONTROL_GENERAL + 0x02f0)
185 192
186/* OMAP44xx control efuse offsets */ 193/* OMAP44xx control efuse offsets */
187#define OMAP44XX_CONTROL_FUSE_IVA_OPP50 0x22C 194#define OMAP44XX_CONTROL_FUSE_IVA_OPP50 0x22C
@@ -246,6 +253,10 @@
246/* TI81XX CONTROL_DEVCONF register offsets */ 253/* TI81XX CONTROL_DEVCONF register offsets */
247#define TI81XX_CONTROL_DEVICE_ID (TI81XX_CONTROL_DEVCONF + 0x000) 254#define TI81XX_CONTROL_DEVICE_ID (TI81XX_CONTROL_DEVCONF + 0x000)
248 255
256/* OMAP54XX CONTROL STATUS register */
257#define OMAP5XXX_CONTROL_STATUS 0x134
258#define OMAP5_DEVICETYPE_MASK (0x7 << 6)
259
249/* 260/*
250 * REVISIT: This list of registers is not comprehensive - there are more 261 * REVISIT: This list of registers is not comprehensive - there are more
251 * that should be added. 262 * that should be added.
@@ -312,15 +323,15 @@
312 OMAP343X_SCRATCHPAD + reg) 323 OMAP343X_SCRATCHPAD + reg)
313 324
314/* AM35XX_CONTROL_IPSS_CLK_CTRL bits */ 325/* AM35XX_CONTROL_IPSS_CLK_CTRL bits */
315#define AM35XX_USBOTG_VBUSP_CLK_SHIFT 0 326#define AM35XX_USBOTG_VBUSP_CLK_SHIFT 0
316#define AM35XX_CPGMAC_VBUSP_CLK_SHIFT 1 327#define AM35XX_CPGMAC_VBUSP_CLK_SHIFT 1
317#define AM35XX_VPFE_VBUSP_CLK_SHIFT 2 328#define AM35XX_VPFE_VBUSP_CLK_SHIFT 2
318#define AM35XX_HECC_VBUSP_CLK_SHIFT 3 329#define AM35XX_HECC_VBUSP_CLK_SHIFT 3
319#define AM35XX_USBOTG_FCLK_SHIFT 8 330#define AM35XX_USBOTG_FCLK_SHIFT 8
320#define AM35XX_CPGMAC_FCLK_SHIFT 9 331#define AM35XX_CPGMAC_FCLK_SHIFT 9
321#define AM35XX_VPFE_FCLK_SHIFT 10 332#define AM35XX_VPFE_FCLK_SHIFT 10
322 333
323/*AM35XX CONTROL_LVL_INTR_CLEAR bits*/ 334/* AM35XX CONTROL_LVL_INTR_CLEAR bits */
324#define AM35XX_CPGMAC_C0_MISC_PULSE_CLR BIT(0) 335#define AM35XX_CPGMAC_C0_MISC_PULSE_CLR BIT(0)
325#define AM35XX_CPGMAC_C0_RX_PULSE_CLR BIT(1) 336#define AM35XX_CPGMAC_C0_RX_PULSE_CLR BIT(1)
326#define AM35XX_CPGMAC_C0_RX_THRESH_CLR BIT(2) 337#define AM35XX_CPGMAC_C0_RX_THRESH_CLR BIT(2)
@@ -330,21 +341,22 @@
330#define AM35XX_VPFE_CCDC_VD1_INT_CLR BIT(6) 341#define AM35XX_VPFE_CCDC_VD1_INT_CLR BIT(6)
331#define AM35XX_VPFE_CCDC_VD2_INT_CLR BIT(7) 342#define AM35XX_VPFE_CCDC_VD2_INT_CLR BIT(7)
332 343
333/*AM35XX CONTROL_IP_SW_RESET bits*/ 344/* AM35XX CONTROL_IP_SW_RESET bits */
334#define AM35XX_USBOTGSS_SW_RST BIT(0) 345#define AM35XX_USBOTGSS_SW_RST BIT(0)
335#define AM35XX_CPGMACSS_SW_RST BIT(1) 346#define AM35XX_CPGMACSS_SW_RST BIT(1)
336#define AM35XX_VPFE_VBUSP_SW_RST BIT(2) 347#define AM35XX_VPFE_VBUSP_SW_RST BIT(2)
337#define AM35XX_HECC_SW_RST BIT(3) 348#define AM35XX_HECC_SW_RST BIT(3)
338#define AM35XX_VPFE_PCLK_SW_RST BIT(4) 349#define AM35XX_VPFE_PCLK_SW_RST BIT(4)
339 350
340/* 351/* AM33XX CONTROL_STATUS register */
341 * CONTROL AM33XX STATUS register
342 */
343#define AM33XX_CONTROL_STATUS 0x040 352#define AM33XX_CONTROL_STATUS 0x040
353#define AM33XX_CONTROL_SEC_CLK_CTRL 0x1bc
344 354
345/* 355/* AM33XX CONTROL_STATUS bitfields (partial) */
346 * CONTROL OMAP STATUS register to identify OMAP3 features 356#define AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT 22
347 */ 357#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22)
358
359/* CONTROL OMAP STATUS register to identify OMAP3 features */
348#define OMAP3_CONTROL_OMAP_STATUS 0x044c 360#define OMAP3_CONTROL_OMAP_STATUS 0x044c
349 361
350#define OMAP3_SGX_SHIFT 13 362#define OMAP3_SGX_SHIFT 13
@@ -397,6 +409,8 @@ extern u32 omap3_arm_context[128];
397extern void omap3_control_save_context(void); 409extern void omap3_control_save_context(void);
398extern void omap3_control_restore_context(void); 410extern void omap3_control_restore_context(void);
399extern void omap3_ctrl_write_boot_mode(u8 bootmode); 411extern void omap3_ctrl_write_boot_mode(u8 bootmode);
412extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
413extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
400extern void omap3630_ctrl_disable_rta(void); 414extern void omap3630_ctrl_disable_rta(void);
401extern int omap3_ctrl_save_padconf(void); 415extern int omap3_ctrl_save_padconf(void);
402#else 416#else
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 207bc1c7759f..f2a49a48ef59 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -36,8 +36,6 @@
36#include "control.h" 36#include "control.h"
37#include "common.h" 37#include "common.h"
38 38
39#ifdef CONFIG_CPU_IDLE
40
41/* Mach specific information to be recorded in the C-state driver_data */ 39/* Mach specific information to be recorded in the C-state driver_data */
42struct omap3_idle_statedata { 40struct omap3_idle_statedata {
43 u32 mpu_state; 41 u32 mpu_state;
@@ -77,20 +75,6 @@ static struct omap3_idle_statedata omap3_idle_data[] = {
77 75
78static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; 76static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
79 77
80static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
81 struct clockdomain *clkdm)
82{
83 clkdm_allow_idle(clkdm);
84 return 0;
85}
86
87static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
88 struct clockdomain *clkdm)
89{
90 clkdm_deny_idle(clkdm);
91 return 0;
92}
93
94static int __omap3_enter_idle(struct cpuidle_device *dev, 78static int __omap3_enter_idle(struct cpuidle_device *dev,
95 struct cpuidle_driver *drv, 79 struct cpuidle_driver *drv,
96 int index) 80 int index)
@@ -108,8 +92,8 @@ static int __omap3_enter_idle(struct cpuidle_device *dev,
108 92
109 /* Deny idle for C1 */ 93 /* Deny idle for C1 */
110 if (index == 0) { 94 if (index == 0) {
111 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle); 95 clkdm_deny_idle(mpu_pd->pwrdm_clkdms[0]);
112 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle); 96 clkdm_deny_idle(core_pd->pwrdm_clkdms[0]);
113 } 97 }
114 98
115 /* 99 /*
@@ -131,8 +115,8 @@ static int __omap3_enter_idle(struct cpuidle_device *dev,
131 115
132 /* Re-allow idle for C1 */ 116 /* Re-allow idle for C1 */
133 if (index == 0) { 117 if (index == 0) {
134 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle); 118 clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
135 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle); 119 clkdm_allow_idle(core_pd->pwrdm_clkdms[0]);
136 } 120 }
137 121
138return_sleep_time: 122return_sleep_time:
@@ -178,7 +162,7 @@ static int next_valid_state(struct cpuidle_device *dev,
178 u32 mpu_deepest_state = PWRDM_POWER_RET; 162 u32 mpu_deepest_state = PWRDM_POWER_RET;
179 u32 core_deepest_state = PWRDM_POWER_RET; 163 u32 core_deepest_state = PWRDM_POWER_RET;
180 int idx; 164 int idx;
181 int next_index = -1; 165 int next_index = 0; /* C1 is the default value */
182 166
183 if (enable_off_mode) { 167 if (enable_off_mode) {
184 mpu_deepest_state = PWRDM_POWER_OFF; 168 mpu_deepest_state = PWRDM_POWER_OFF;
@@ -209,12 +193,6 @@ static int next_valid_state(struct cpuidle_device *dev,
209 } 193 }
210 } 194 }
211 195
212 /*
213 * C1 is always valid.
214 * So, no need to check for 'next_index == -1' outside
215 * this loop.
216 */
217
218 return next_index; 196 return next_index;
219} 197}
220 198
@@ -228,23 +206,22 @@ static int next_valid_state(struct cpuidle_device *dev,
228 * the device to the specified or a safer state. 206 * the device to the specified or a safer state.
229 */ 207 */
230static int omap3_enter_idle_bm(struct cpuidle_device *dev, 208static int omap3_enter_idle_bm(struct cpuidle_device *dev,
231 struct cpuidle_driver *drv, 209 struct cpuidle_driver *drv,
232 int index) 210 int index)
233{ 211{
234 int new_state_idx; 212 int new_state_idx;
235 u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state; 213 u32 core_next_state, per_next_state = 0, per_saved_state = 0;
236 struct omap3_idle_statedata *cx; 214 struct omap3_idle_statedata *cx;
237 int ret; 215 int ret;
238 216
239 /* 217 /*
240 * Prevent idle completely if CAM is active. 218 * Use only C1 if CAM is active.
241 * CAM does not have wakeup capability in OMAP3. 219 * CAM does not have wakeup capability in OMAP3.
242 */ 220 */
243 cam_state = pwrdm_read_pwrst(cam_pd); 221 if (pwrdm_read_pwrst(cam_pd) == PWRDM_POWER_ON)
244 if (cam_state == PWRDM_POWER_ON) {
245 new_state_idx = drv->safe_state_index; 222 new_state_idx = drv->safe_state_index;
246 goto select_state; 223 else
247 } 224 new_state_idx = next_valid_state(dev, drv, index);
248 225
249 /* 226 /*
250 * FIXME: we currently manage device-specific idle states 227 * FIXME: we currently manage device-specific idle states
@@ -254,24 +231,28 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
254 * its own code. 231 * its own code.
255 */ 232 */
256 233
257 /* 234 /* Program PER state */
258 * Prevent PER off if CORE is not in retention or off as this 235 cx = &omap3_idle_data[new_state_idx];
259 * would disable PER wakeups completely.
260 */
261 cx = &omap3_idle_data[index];
262 core_next_state = cx->core_state; 236 core_next_state = cx->core_state;
263 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 237 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
264 if ((per_next_state == PWRDM_POWER_OFF) && 238 if (new_state_idx == 0) {
265 (core_next_state > PWRDM_POWER_RET)) 239 /* In C1 do not allow PER state lower than CORE state */
266 per_next_state = PWRDM_POWER_RET; 240 if (per_next_state < core_next_state)
241 per_next_state = core_next_state;
242 } else {
243 /*
244 * Prevent PER OFF if CORE is not in RETention or OFF as this
245 * would disable PER wakeups completely.
246 */
247 if ((per_next_state == PWRDM_POWER_OFF) &&
248 (core_next_state > PWRDM_POWER_RET))
249 per_next_state = PWRDM_POWER_RET;
250 }
267 251
268 /* Are we changing PER target state? */ 252 /* Are we changing PER target state? */
269 if (per_next_state != per_saved_state) 253 if (per_next_state != per_saved_state)
270 pwrdm_set_next_pwrst(per_pd, per_next_state); 254 pwrdm_set_next_pwrst(per_pd, per_next_state);
271 255
272 new_state_idx = next_valid_state(dev, drv, index);
273
274select_state:
275 ret = omap3_enter_idle(dev, drv, new_state_idx); 256 ret = omap3_enter_idle(dev, drv, new_state_idx);
276 257
277 /* Restore original PER state if it was modified */ 258 /* Restore original PER state if it was modified */
@@ -288,7 +269,7 @@ struct cpuidle_driver omap3_idle_driver = {
288 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
289 .states = { 270 .states = {
290 { 271 {
291 .enter = omap3_enter_idle, 272 .enter = omap3_enter_idle_bm,
292 .exit_latency = 2 + 2, 273 .exit_latency = 2 + 2,
293 .target_residency = 5, 274 .target_residency = 5,
294 .flags = CPUIDLE_FLAG_TIME_VALID, 275 .flags = CPUIDLE_FLAG_TIME_VALID,
@@ -379,9 +360,3 @@ int __init omap3_idle_init(void)
379 360
380 return 0; 361 return 0;
381} 362}
382#else
383int __init omap3_idle_init(void)
384{
385 return 0;
386}
387#endif /* CONFIG_CPU_IDLE */
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index be1617ca84bd..02d15bbd4e35 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -22,8 +22,6 @@
22#include "pm.h" 22#include "pm.h"
23#include "prm.h" 23#include "prm.h"
24 24
25#ifdef CONFIG_CPU_IDLE
26
27/* Machine specific information */ 25/* Machine specific information */
28struct omap4_idle_statedata { 26struct omap4_idle_statedata {
29 u32 cpu_state; 27 u32 cpu_state;
@@ -199,9 +197,3 @@ int __init omap4_idle_init(void)
199 197
200 return 0; 198 return 0;
201} 199}
202#else
203int __init omap4_idle_init(void)
204{
205 return 0;
206}
207#endif /* CONFIG_CPU_IDLE */
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 7b4b9327e543..c00c68961bb8 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -27,7 +27,6 @@
27 27
28#include "iomap.h" 28#include "iomap.h"
29#include <plat/board.h> 29#include <plat/board.h>
30#include <plat/mmc.h>
31#include <plat/dma.h> 30#include <plat/dma.h>
32#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
33#include <plat/omap_device.h> 32#include <plat/omap_device.h>
@@ -84,7 +83,7 @@ static int __init omap4_l3_init(void)
84 * To avoid code running on other OMAPs in 83 * To avoid code running on other OMAPs in
85 * multi-omap builds 84 * multi-omap builds
86 */ 85 */
87 if (!(cpu_is_omap44xx())) 86 if (!cpu_is_omap44xx() && !soc_is_omap54xx())
88 return -ENODEV; 87 return -ENODEV;
89 88
90 for (i = 0; i < L3_MODULES; i++) { 89 for (i = 0; i < L3_MODULES; i++) {
@@ -603,112 +602,6 @@ static inline void omap_init_aes(void) { }
603 602
604/*-------------------------------------------------------------------------*/ 603/*-------------------------------------------------------------------------*/
605 604
606#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
607
608static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
609 *mmc_controller)
610{
611 if ((mmc_controller->slots[0].switch_pin > 0) && \
612 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
613 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
614 OMAP_PIN_INPUT_PULLUP);
615 if ((mmc_controller->slots[0].gpio_wp > 0) && \
616 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
617 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
618 OMAP_PIN_INPUT_PULLUP);
619
620 omap_mux_init_signal("sdmmc_cmd", 0);
621 omap_mux_init_signal("sdmmc_clki", 0);
622 omap_mux_init_signal("sdmmc_clko", 0);
623 omap_mux_init_signal("sdmmc_dat0", 0);
624 omap_mux_init_signal("sdmmc_dat_dir0", 0);
625 omap_mux_init_signal("sdmmc_cmd_dir", 0);
626 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
627 omap_mux_init_signal("sdmmc_dat1", 0);
628 omap_mux_init_signal("sdmmc_dat2", 0);
629 omap_mux_init_signal("sdmmc_dat3", 0);
630 omap_mux_init_signal("sdmmc_dat_dir1", 0);
631 omap_mux_init_signal("sdmmc_dat_dir2", 0);
632 omap_mux_init_signal("sdmmc_dat_dir3", 0);
633 }
634
635 /*
636 * Use internal loop-back in MMC/SDIO Module Input Clock
637 * selection
638 */
639 if (mmc_controller->slots[0].internal_clock) {
640 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
641 v |= (1 << 24);
642 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
643 }
644}
645
646void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
647{
648 struct platform_device *pdev;
649 struct omap_hwmod *oh;
650 int id = 0;
651 char *oh_name = "msdi1";
652 char *dev_name = "mmci-omap";
653
654 if (!mmc_data[0]) {
655 pr_err("%s fails: Incomplete platform data\n", __func__);
656 return;
657 }
658
659 omap242x_mmc_mux(mmc_data[0]);
660
661 oh = omap_hwmod_lookup(oh_name);
662 if (!oh) {
663 pr_err("Could not look up %s\n", oh_name);
664 return;
665 }
666 pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
667 sizeof(struct omap_mmc_platform_data), NULL, 0, 0);
668 if (IS_ERR(pdev))
669 WARN(1, "Can'd build omap_device for %s:%s.\n",
670 dev_name, oh->name);
671}
672
673#endif
674
675/*-------------------------------------------------------------------------*/
676
677#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
678#define OMAP_HDQ_BASE 0x480B2000
679static struct resource omap_hdq_resources[] = {
680 {
681 .start = OMAP_HDQ_BASE,
682 .end = OMAP_HDQ_BASE + 0x1C,
683 .flags = IORESOURCE_MEM,
684 },
685 {
686 .start = INT_24XX_HDQ_IRQ,
687 .flags = IORESOURCE_IRQ,
688 },
689};
690static struct platform_device omap_hdq_dev = {
691 .name = "omap_hdq",
692 .id = 0,
693 .dev = {
694 .platform_data = NULL,
695 },
696 .num_resources = ARRAY_SIZE(omap_hdq_resources),
697 .resource = omap_hdq_resources,
698};
699static inline void omap_hdq_init(void)
700{
701 if (cpu_is_omap2420())
702 return;
703
704 platform_device_register(&omap_hdq_dev);
705}
706#else
707static inline void omap_hdq_init(void) {}
708#endif
709
710/*---------------------------------------------------------------------------*/
711
712#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \ 605#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
713 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE) 606 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
714#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) 607#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
@@ -753,7 +646,6 @@ static int __init omap2_init_devices(void)
753 omap_init_mcspi(); 646 omap_init_mcspi();
754 } 647 }
755 omap_init_pmu(); 648 omap_init_pmu();
756 omap_hdq_init();
757 omap_init_sti(); 649 omap_init_sti();
758 omap_init_sham(); 650 omap_init_sham();
759 omap_init_aes(); 651 omap_init_aes();
@@ -772,7 +664,7 @@ static int __init omap_init_wdt(void)
772 char *oh_name = "wd_timer2"; 664 char *oh_name = "wd_timer2";
773 char *dev_name = "omap_wdt"; 665 char *dev_name = "omap_wdt";
774 666
775 if (!cpu_class_is_omap2()) 667 if (!cpu_class_is_omap2() || of_have_populated_dt())
776 return 0; 668 return 0;
777 669
778 oh = omap_hwmod_lookup(oh_name); 670 oh = omap_hwmod_lookup(oh_name);
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index f0f10beeffe8..b9c8d2f6a81f 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -135,11 +135,20 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
135 */ 135 */
136static int _omap3_noncore_dpll_lock(struct clk *clk) 136static int _omap3_noncore_dpll_lock(struct clk *clk)
137{ 137{
138 const struct dpll_data *dd;
138 u8 ai; 139 u8 ai;
139 int r; 140 u8 state = 1;
141 int r = 0;
140 142
141 pr_debug("clock: locking DPLL %s\n", clk->name); 143 pr_debug("clock: locking DPLL %s\n", clk->name);
142 144
145 dd = clk->dpll_data;
146 state <<= __ffs(dd->idlest_mask);
147
148 /* Check if already locked */
149 if ((__raw_readl(dd->idlest_reg) & dd->idlest_mask) == state)
150 goto done;
151
143 ai = omap3_dpll_autoidle_read(clk); 152 ai = omap3_dpll_autoidle_read(clk);
144 153
145 if (ai) 154 if (ai)
@@ -152,6 +161,7 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
152 if (ai) 161 if (ai)
153 omap3_dpll_allow_idle(clk); 162 omap3_dpll_allow_idle(clk);
154 163
164done:
155 return r; 165 return r;
156} 166}
157 167
@@ -628,3 +638,17 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
628 rate = clk->parent->rate * 2; 638 rate = clk->parent->rate * 2;
629 return rate; 639 return rate;
630} 640}
641
642/* OMAP3/4 non-CORE DPLL clkops */
643
644const struct clkops clkops_omap3_noncore_dpll_ops = {
645 .enable = omap3_noncore_dpll_enable,
646 .disable = omap3_noncore_dpll_disable,
647 .allow_idle = omap3_dpll_allow_idle,
648 .deny_idle = omap3_dpll_deny_idle,
649};
650
651const struct clkops clkops_omap3_core_dpll_ops = {
652 .allow_idle = omap3_dpll_allow_idle,
653 .deny_idle = omap3_dpll_deny_idle,
654};
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
new file mode 100644
index 000000000000..72e0f01b715c
--- /dev/null
+++ b/arch/arm/mach-omap2/drm.c
@@ -0,0 +1,61 @@
1/*
2 * DRM/KMS device registration for TI OMAP platforms
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/dma-mapping.h>
26
27#include <plat/omap_device.h>
28#include <plat/omap_hwmod.h>
29
30#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
31
32static struct platform_device omap_drm_device = {
33 .dev = {
34 .coherent_dma_mask = DMA_BIT_MASK(32),
35 },
36 .name = "omapdrm",
37 .id = 0,
38};
39
40static int __init omap_init_drm(void)
41{
42 struct omap_hwmod *oh = NULL;
43 struct platform_device *pdev;
44
45 /* lookup and populate the DMM information, if present - OMAP4+ */
46 oh = omap_hwmod_lookup("dmm");
47
48 if (oh) {
49 pdev = omap_device_build(oh->name, -1, oh, NULL, 0, NULL, 0,
50 false);
51 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n",
52 oh->name);
53 }
54
55 return platform_device_register(&omap_drm_device);
56
57}
58
59arch_initcall(omap_init_drm);
60
61#endif
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 845309f146fe..a636ebc16b39 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -20,6 +20,10 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23
24#include <asm/memblock.h>
25
26#include "control.h"
23#include "cm2xxx_3xxx.h" 27#include "cm2xxx_3xxx.h"
24#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
25#ifdef CONFIG_BRIDGE_DVFS 29#ifdef CONFIG_BRIDGE_DVFS
@@ -43,6 +47,9 @@ static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
43 .dsp_cm_read = omap2_cm_read_mod_reg, 47 .dsp_cm_read = omap2_cm_read_mod_reg,
44 .dsp_cm_write = omap2_cm_write_mod_reg, 48 .dsp_cm_write = omap2_cm_write_mod_reg,
45 .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits, 49 .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
50
51 .set_bootaddr = omap_ctrl_write_dsp_boot_addr,
52 .set_bootmode = omap_ctrl_write_dsp_boot_mode,
46}; 53};
47 54
48static phys_addr_t omap_dsp_phys_mempool_base; 55static phys_addr_t omap_dsp_phys_mempool_base;
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 2286410671e7..b2b5759ab0fe 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -727,7 +727,8 @@ static int __init gpmc_init(void)
727 ck = "gpmc_fck"; 727 ck = "gpmc_fck";
728 l = OMAP34XX_GPMC_BASE; 728 l = OMAP34XX_GPMC_BASE;
729 gpmc_irq = INT_34XX_GPMC_IRQ; 729 gpmc_irq = INT_34XX_GPMC_IRQ;
730 } else if (cpu_is_omap44xx()) { 730 } else if (cpu_is_omap44xx() || soc_is_omap54xx()) {
731 /* Base address and irq number are same for OMAP4/5 */
731 ck = "gpmc_ck"; 732 ck = "gpmc_ck";
732 l = OMAP44XX_GPMC_BASE; 733 l = OMAP44XX_GPMC_BASE;
733 gpmc_irq = OMAP44XX_IRQ_GPMC; 734 gpmc_irq = OMAP44XX_IRQ_GPMC;
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index 297ebe03f09c..cdd6dda03828 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -22,7 +22,13 @@
22 * 02110-1301 USA 22 * 02110-1301 USA
23 */ 23 */
24 24
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/err.h>
28#include <linux/platform_device.h>
29
25#include <plat/omap_hwmod.h> 30#include <plat/omap_hwmod.h>
31#include <plat/omap_device.h>
26#include <plat/hdq1w.h> 32#include <plat/hdq1w.h>
27 33
28#include "common.h" 34#include "common.h"
@@ -70,3 +76,23 @@ int omap_hdq1w_reset(struct omap_hwmod *oh)
70 76
71 return 0; 77 return 0;
72} 78}
79
80static int __init omap_init_hdq(void)
81{
82 int id = -1;
83 struct platform_device *pdev;
84 struct omap_hwmod *oh;
85 char *oh_name = "hdq1w";
86 char *devname = "omap_hdq";
87
88 oh = omap_hwmod_lookup(oh_name);
89 if (!oh)
90 return 0;
91
92 pdev = omap_device_build(devname, id, oh, NULL, 0, NULL, 0, 0);
93 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
94 devname, oh->name);
95
96 return 0;
97}
98arch_initcall(omap_init_hdq);
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 0389b3264abe..40373db649aa 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -44,12 +44,17 @@ int omap_type(void)
44 44
45 if (cpu_is_omap24xx()) { 45 if (cpu_is_omap24xx()) {
46 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); 46 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
47 } else if (cpu_is_am33xx()) { 47 } else if (soc_is_am33xx()) {
48 val = omap_ctrl_readl(AM33XX_CONTROL_STATUS); 48 val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
49 } else if (cpu_is_omap34xx()) { 49 } else if (cpu_is_omap34xx()) {
50 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); 50 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
51 } else if (cpu_is_omap44xx()) { 51 } else if (cpu_is_omap44xx()) {
52 val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS); 52 val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
53 } else if (soc_is_omap54xx()) {
54 val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
55 val &= OMAP5_DEVICETYPE_MASK;
56 val >>= 6;
57 goto out;
53 } else { 58 } else {
54 pr_err("Cannot detect omap type!\n"); 59 pr_err("Cannot detect omap type!\n");
55 goto out; 60 goto out;
@@ -100,7 +105,7 @@ static u16 tap_prod_id;
100 105
101void omap_get_die_id(struct omap_die_id *odi) 106void omap_get_die_id(struct omap_die_id *odi)
102{ 107{
103 if (cpu_is_omap44xx()) { 108 if (cpu_is_omap44xx() || soc_is_omap54xx()) {
104 odi->id_0 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_0); 109 odi->id_0 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_0);
105 odi->id_1 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_1); 110 odi->id_1 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_1);
106 odi->id_2 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_2); 111 odi->id_2 = read_tap_reg(OMAP_TAP_DIE_ID_44XX_2);
@@ -189,7 +194,7 @@ static void __init omap3_cpuinfo(void)
189 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505"; 194 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
190 } else if (cpu_is_ti816x()) { 195 } else if (cpu_is_ti816x()) {
191 cpu_name = "TI816X"; 196 cpu_name = "TI816X";
192 } else if (cpu_is_am335x()) { 197 } else if (soc_is_am335x()) {
193 cpu_name = "AM335X"; 198 cpu_name = "AM335X";
194 } else if (cpu_is_ti814x()) { 199 } else if (cpu_is_ti814x()) {
195 cpu_name = "TI814X"; 200 cpu_name = "TI814X";
@@ -247,6 +252,17 @@ void __init omap3xxx_check_features(void)
247 omap_features |= OMAP3_HAS_SDRC; 252 omap_features |= OMAP3_HAS_SDRC;
248 253
249 /* 254 /*
255 * am35x fixups:
256 * - The am35x Chip ID register has bits 12, 7:5, and 3:2 marked as
257 * reserved and therefore return 0 when read. Unfortunately,
258 * OMAP3_CHECK_FEATURE() will interpret some of those zeroes to
259 * mean that a feature is present even though it isn't so clear
260 * the incorrectly set feature bits.
261 */
262 if (soc_is_am35xx())
263 omap_features &= ~(OMAP3_HAS_IVA | OMAP3_HAS_ISP);
264
265 /*
250 * TODO: Get additional info (where applicable) 266 * TODO: Get additional info (where applicable)
251 * e.g. Size of L2 cache. 267 * e.g. Size of L2 cache.
252 */ 268 */
@@ -502,6 +518,41 @@ void __init omap4xxx_check_revision(void)
502 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf)); 518 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf));
503} 519}
504 520
521void __init omap5xxx_check_revision(void)
522{
523 u32 idcode;
524 u16 hawkeye;
525 u8 rev;
526
527 idcode = read_tap_reg(OMAP_TAP_IDCODE);
528 hawkeye = (idcode >> 12) & 0xffff;
529 rev = (idcode >> 28) & 0xff;
530 switch (hawkeye) {
531 case 0xb942:
532 switch (rev) {
533 case 0:
534 default:
535 omap_revision = OMAP5430_REV_ES1_0;
536 }
537 break;
538
539 case 0xb998:
540 switch (rev) {
541 case 0:
542 default:
543 omap_revision = OMAP5432_REV_ES1_0;
544 }
545 break;
546
547 default:
548 /* Unknown default to latest silicon rev as default*/
549 omap_revision = OMAP5430_REV_ES1_0;
550 }
551
552 pr_info("OMAP%04x ES%d.0\n",
553 omap_rev() >> 16, ((omap_rev() >> 12) & 0xf));
554}
555
505/* 556/*
506 * Set up things for map_io and processor detection later on. Gets called 557 * Set up things for map_io and processor detection later on. Gets called
507 * pretty much first thing from board init. For multi-omap, this gets 558 * pretty much first thing from board init. For multi-omap, this gets
diff --git a/arch/arm/mach-omap2/include/mach/am35xx.h b/arch/arm/mach-omap2/include/mach/am35xx.h
index f1e13d1ca5e7..95594495fcf6 100644
--- a/arch/arm/mach-omap2/include/mach/am35xx.h
+++ b/arch/arm/mach-omap2/include/mach/am35xx.h
@@ -36,6 +36,8 @@
36#define AM35XX_EMAC_CNTRL_MOD_OFFSET (0x0) 36#define AM35XX_EMAC_CNTRL_MOD_OFFSET (0x0)
37#define AM35XX_EMAC_CNTRL_RAM_OFFSET (0x20000) 37#define AM35XX_EMAC_CNTRL_RAM_OFFSET (0x20000)
38#define AM35XX_EMAC_MDIO_OFFSET (0x30000) 38#define AM35XX_EMAC_MDIO_OFFSET (0x30000)
39#define AM35XX_IPSS_MDIO_BASE (AM35XX_IPSS_EMAC_BASE + \
40 AM35XX_EMAC_MDIO_OFFSET)
39#define AM35XX_EMAC_CNTRL_RAM_SIZE (0x2000) 41#define AM35XX_EMAC_CNTRL_RAM_SIZE (0x2000)
40#define AM35XX_EMAC_RAM_ADDR (AM3517_EMAC_BASE + \ 42#define AM35XX_EMAC_RAM_ADDR (AM3517_EMAC_BASE + \
41 AM3517_EMAC_CNTRL_RAM_OFFSET) 43 AM3517_EMAC_CNTRL_RAM_OFFSET)
diff --git a/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h b/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
index 2f7ac70a20d8..01970824e0e5 100644
--- a/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
+++ b/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
@@ -42,6 +42,7 @@
42#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_1 0x0268 42#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_1 0x0268
43#define OMAP4_CTRL_MODULE_CORE_STATUS 0x02c4 43#define OMAP4_CTRL_MODULE_CORE_STATUS 0x02c4
44#define OMAP4_CTRL_MODULE_CORE_DEV_CONF 0x0300 44#define OMAP4_CTRL_MODULE_CORE_DEV_CONF 0x0300
45#define OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR 0x0304
45#define OMAP4_CTRL_MODULE_CORE_LDOVBB_IVA_VOLTAGE_CTRL 0x0314 46#define OMAP4_CTRL_MODULE_CORE_LDOVBB_IVA_VOLTAGE_CTRL 0x0314
46#define OMAP4_CTRL_MODULE_CORE_LDOVBB_MPU_VOLTAGE_CTRL 0x0318 47#define OMAP4_CTRL_MODULE_CORE_LDOVBB_MPU_VOLTAGE_CTRL 0x0318
47#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_IVA_VOLTAGE_CTRL 0x0320 48#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_IVA_VOLTAGE_CTRL 0x0320
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index cdfc2a1f0e75..93d10de7129f 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -60,18 +60,20 @@ omap_uart_lsr: .word 0
60 beq 23f @ configure OMAP2UART3 60 beq 23f @ configure OMAP2UART3
61 cmp \rp, #OMAP3UART3 @ only on 34xx 61 cmp \rp, #OMAP3UART3 @ only on 34xx
62 beq 33f @ configure OMAP3UART3 62 beq 33f @ configure OMAP3UART3
63 cmp \rp, #OMAP4UART3 @ only on 44xx 63 cmp \rp, #OMAP4UART3 @ only on 44xx/54xx
64 beq 43f @ configure OMAP4UART3 64 beq 43f @ configure OMAP4/5UART3
65 cmp \rp, #OMAP3UART4 @ only on 36xx 65 cmp \rp, #OMAP3UART4 @ only on 36xx
66 beq 34f @ configure OMAP3UART4 66 beq 34f @ configure OMAP3UART4
67 cmp \rp, #OMAP4UART4 @ only on 44xx 67 cmp \rp, #OMAP4UART4 @ only on 44xx/54xx
68 beq 44f @ configure OMAP4UART4 68 beq 44f @ configure OMAP4/5UART4
69 cmp \rp, #TI81XXUART1 @ ti81Xx UART offsets different 69 cmp \rp, #TI81XXUART1 @ ti81Xx UART offsets different
70 beq 81f @ configure UART1 70 beq 81f @ configure UART1
71 cmp \rp, #TI81XXUART2 @ ti81Xx UART offsets different 71 cmp \rp, #TI81XXUART2 @ ti81Xx UART offsets different
72 beq 82f @ configure UART2 72 beq 82f @ configure UART2
73 cmp \rp, #TI81XXUART3 @ ti81Xx UART offsets different 73 cmp \rp, #TI81XXUART3 @ ti81Xx UART offsets different
74 beq 83f @ configure UART3 74 beq 83f @ configure UART3
75 cmp \rp, #AM33XXUART1 @ AM33XX UART offsets different
76 beq 84f @ configure UART1
75 cmp \rp, #ZOOM_UART @ only on zoom2/3 77 cmp \rp, #ZOOM_UART @ only on zoom2/3
76 beq 95f @ configure ZOOM_UART 78 beq 95f @ configure ZOOM_UART
77 79
@@ -100,7 +102,9 @@ omap_uart_lsr: .word 0
100 b 98f 102 b 98f
10183: mov \rp, #UART_OFFSET(TI81XX_UART3_BASE) 10383: mov \rp, #UART_OFFSET(TI81XX_UART3_BASE)
102 b 98f 104 b 98f
103 10584: ldr \rp, =AM33XX_UART1_BASE
106 and \rp, \rp, #0x00ffffff
107 b 97f
10495: ldr \rp, =ZOOM_UART_BASE 10895: ldr \rp, =ZOOM_UART_BASE
105 str \rp, [\tmp, #0] @ omap_uart_phys 109 str \rp, [\tmp, #0] @ omap_uart_phys
106 ldr \rp, =ZOOM_UART_VIRT 110 ldr \rp, =ZOOM_UART_VIRT
@@ -109,6 +113,17 @@ omap_uart_lsr: .word 0
109 str \rp, [\tmp, #8] @ omap_uart_lsr 113 str \rp, [\tmp, #8] @ omap_uart_lsr
110 b 10b 114 b 10b
111 115
116 /* AM33XX: Store both phys and virt address for the uart */
11797: add \rp, \rp, #0x44000000 @ phys base
118 str \rp, [\tmp, #0] @ omap_uart_phys
119 sub \rp, \rp, #0x44000000 @ phys base
120 add \rp, \rp, #0xf9000000 @ virt base
121 str \rp, [\tmp, #4] @ omap_uart_virt
122 mov \rp, #(UART_LSR << OMAP_PORT_SHIFT)
123 str \rp, [\tmp, #8] @ omap_uart_lsr
124
125 b 10b
126
112 /* Store both phys and virt address for the uart */ 127 /* Store both phys and virt address for the uart */
11398: add \rp, \rp, #0x48000000 @ phys base 12898: add \rp, \rp, #0x48000000 @ phys base
114 str \rp, [\tmp, #0] @ omap_uart_phys 129 str \rp, [\tmp, #0] @ omap_uart_phys
diff --git a/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h b/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
index 548de90b58c2..b0fd16f5c391 100644
--- a/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
+++ b/arch/arm/mach-omap2/include/mach/omap-wakeupgen.h
@@ -11,15 +11,20 @@
11#ifndef OMAP_ARCH_WAKEUPGEN_H 11#ifndef OMAP_ARCH_WAKEUPGEN_H
12#define OMAP_ARCH_WAKEUPGEN_H 12#define OMAP_ARCH_WAKEUPGEN_H
13 13
14/* OMAP4 and OMAP5 has same base address */
15#define OMAP_WKUPGEN_BASE 0x48281000
16
14#define OMAP_WKG_CONTROL_0 0x00 17#define OMAP_WKG_CONTROL_0 0x00
15#define OMAP_WKG_ENB_A_0 0x10 18#define OMAP_WKG_ENB_A_0 0x10
16#define OMAP_WKG_ENB_B_0 0x14 19#define OMAP_WKG_ENB_B_0 0x14
17#define OMAP_WKG_ENB_C_0 0x18 20#define OMAP_WKG_ENB_C_0 0x18
18#define OMAP_WKG_ENB_D_0 0x1c 21#define OMAP_WKG_ENB_D_0 0x1c
22#define OMAP_WKG_ENB_E_0 0x20
19#define OMAP_WKG_ENB_A_1 0x410 23#define OMAP_WKG_ENB_A_1 0x410
20#define OMAP_WKG_ENB_B_1 0x414 24#define OMAP_WKG_ENB_B_1 0x414
21#define OMAP_WKG_ENB_C_1 0x418 25#define OMAP_WKG_ENB_C_1 0x418
22#define OMAP_WKG_ENB_D_1 0x41c 26#define OMAP_WKG_ENB_D_1 0x41c
27#define OMAP_WKG_ENB_E_1 0x420
23#define OMAP_AUX_CORE_BOOT_0 0x800 28#define OMAP_AUX_CORE_BOOT_0 0x800
24#define OMAP_AUX_CORE_BOOT_1 0x804 29#define OMAP_AUX_CORE_BOOT_1 0x804
25#define OMAP_PTMSYNCREQ_MASK 0xc00 30#define OMAP_PTMSYNCREQ_MASK 0xc00
@@ -28,4 +33,6 @@
28#define OMAP_TIMESTAMPCYCLEHI 0xc0c 33#define OMAP_TIMESTAMPCYCLEHI 0xc0c
29 34
30extern int __init omap_wakeupgen_init(void); 35extern int __init omap_wakeupgen_init(void);
36extern void __iomem *omap_get_wakeupgen_base(void);
37extern int omap_secure_apis_support(void);
31#endif 38#endif
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 8d014ba04abc..4d2d981ff5c5 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -38,6 +38,7 @@
38#include "powerdomain.h" 38#include "powerdomain.h"
39#include "clockdomain.h" 39#include "clockdomain.h"
40#include "common.h" 40#include "common.h"
41#include "clock.h"
41#include "clock2xxx.h" 42#include "clock2xxx.h"
42#include "clock3xxx.h" 43#include "clock3xxx.h"
43#include "clock44xx.h" 44#include "clock44xx.h"
@@ -233,6 +234,35 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
233}; 234};
234#endif 235#endif
235 236
237#ifdef CONFIG_SOC_OMAP5
238static struct map_desc omap54xx_io_desc[] __initdata = {
239 {
240 .virtual = L3_54XX_VIRT,
241 .pfn = __phys_to_pfn(L3_54XX_PHYS),
242 .length = L3_54XX_SIZE,
243 .type = MT_DEVICE,
244 },
245 {
246 .virtual = L4_54XX_VIRT,
247 .pfn = __phys_to_pfn(L4_54XX_PHYS),
248 .length = L4_54XX_SIZE,
249 .type = MT_DEVICE,
250 },
251 {
252 .virtual = L4_WK_54XX_VIRT,
253 .pfn = __phys_to_pfn(L4_WK_54XX_PHYS),
254 .length = L4_WK_54XX_SIZE,
255 .type = MT_DEVICE,
256 },
257 {
258 .virtual = L4_PER_54XX_VIRT,
259 .pfn = __phys_to_pfn(L4_PER_54XX_PHYS),
260 .length = L4_PER_54XX_SIZE,
261 .type = MT_DEVICE,
262 },
263};
264#endif
265
236#ifdef CONFIG_SOC_OMAP2420 266#ifdef CONFIG_SOC_OMAP2420
237void __init omap242x_map_common_io(void) 267void __init omap242x_map_common_io(void)
238{ 268{
@@ -278,6 +308,12 @@ void __init omap44xx_map_common_io(void)
278} 308}
279#endif 309#endif
280 310
311#ifdef CONFIG_SOC_OMAP5
312void __init omap5_map_common_io(void)
313{
314 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
315}
316#endif
281/* 317/*
282 * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters 318 * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
283 * 319 *
@@ -477,6 +513,20 @@ void __init ti81xx_init_late(void)
477} 513}
478#endif 514#endif
479 515
516#ifdef CONFIG_SOC_AM33XX
517void __init am33xx_init_early(void)
518{
519 omap2_set_globals_am33xx();
520 omap3xxx_check_revision();
521 ti81xx_check_features();
522 omap_common_init_early();
523 am33xx_voltagedomains_init();
524 am33xx_powerdomains_init();
525 am33xx_clockdomains_init();
526 am33xx_clk_init();
527}
528#endif
529
480#ifdef CONFIG_ARCH_OMAP4 530#ifdef CONFIG_ARCH_OMAP4
481void __init omap4430_init_early(void) 531void __init omap4430_init_early(void)
482{ 532{
@@ -500,6 +550,15 @@ void __init omap4430_init_late(void)
500} 550}
501#endif 551#endif
502 552
553#ifdef CONFIG_SOC_OMAP5
554void __init omap5_init_early(void)
555{
556 omap2_set_globals_5xxx();
557 omap5xxx_check_revision();
558 omap_common_init_early();
559}
560#endif
561
503void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 562void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
504 struct omap_sdrc_params *sdrc_cs1) 563 struct omap_sdrc_params *sdrc_cs1)
505{ 564{
diff --git a/arch/arm/mach-omap2/iomap.h b/arch/arm/mach-omap2/iomap.h
index 80b88921faba..cce2b65039f1 100644
--- a/arch/arm/mach-omap2/iomap.h
+++ b/arch/arm/mach-omap2/iomap.h
@@ -1,6 +1,14 @@
1/* 1/*
2 * IO mappings for OMAP2+ 2 * IO mappings for OMAP2+
3 * 3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * Copyright (C) 2009-2012 Texas Instruments
10 * Added OMAP4/5 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
11 *
4 * This program is free software; you can redistribute it and/or modify it 12 * 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 13 * 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 14 * Free Software Foundation; either version 2 of the License, or (at your
@@ -166,4 +174,23 @@
166 /* 0x49000000 --> 0xfb000000 */ 174 /* 0x49000000 --> 0xfb000000 */
167#define L4_ABE_44XX_VIRT (L4_ABE_44XX_PHYS + OMAP2_L4_IO_OFFSET) 175#define L4_ABE_44XX_VIRT (L4_ABE_44XX_PHYS + OMAP2_L4_IO_OFFSET)
168#define L4_ABE_44XX_SIZE SZ_1M 176#define L4_ABE_44XX_SIZE SZ_1M
177/*
178 * ----------------------------------------------------------------------------
179 * Omap5 specific IO mapping
180 * ----------------------------------------------------------------------------
181 */
182#define L3_54XX_PHYS L3_54XX_BASE /* 0x44000000 --> 0xf8000000 */
183#define L3_54XX_VIRT (L3_54XX_PHYS + OMAP4_L3_IO_OFFSET)
184#define L3_54XX_SIZE SZ_1M
185
186#define L4_54XX_PHYS L4_54XX_BASE /* 0x4a000000 --> 0xfc000000 */
187#define L4_54XX_VIRT (L4_54XX_PHYS + OMAP2_L4_IO_OFFSET)
188#define L4_54XX_SIZE SZ_4M
189
190#define L4_WK_54XX_PHYS L4_WK_54XX_BASE /* 0x4ae00000 --> 0xfce00000 */
191#define L4_WK_54XX_VIRT (L4_WK_54XX_PHYS + OMAP2_L4_IO_OFFSET)
192#define L4_WK_54XX_SIZE SZ_2M
169 193
194#define L4_PER_54XX_PHYS L4_PER_54XX_BASE /* 0x48000000 --> 0xfa000000 */
195#define L4_PER_54XX_VIRT (L4_PER_54XX_PHYS + OMAP2_L4_IO_OFFSET)
196#define L4_PER_54XX_SIZE SZ_4M
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index fdc4303be563..bcd83db41bbc 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -21,6 +21,7 @@
21#include <linux/irqdomain.h> 21#include <linux/irqdomain.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_address.h> 23#include <linux/of_address.h>
24#include <linux/of_irq.h>
24 25
25#include <mach/hardware.h> 26#include <mach/hardware.h>
26 27
@@ -149,6 +150,7 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
149 ct->chip.irq_ack = omap_mask_ack_irq; 150 ct->chip.irq_ack = omap_mask_ack_irq;
150 ct->chip.irq_mask = irq_gc_mask_disable_reg; 151 ct->chip.irq_mask = irq_gc_mask_disable_reg;
151 ct->chip.irq_unmask = irq_gc_unmask_enable_reg; 152 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
153 ct->chip.flags |= IRQCHIP_SKIP_SET_WAKE;
152 154
153 ct->regs.enable = INTC_MIR_CLEAR0; 155 ct->regs.enable = INTC_MIR_CLEAR0;
154 ct->regs.disable = INTC_MIR_SET0; 156 ct->regs.disable = INTC_MIR_SET0;
@@ -257,11 +259,11 @@ asmlinkage void __exception_irq_entry omap2_intc_handle_irq(struct pt_regs *regs
257 omap_intc_handle_irq(base_addr, regs); 259 omap_intc_handle_irq(base_addr, regs);
258} 260}
259 261
260int __init omap_intc_of_init(struct device_node *node, 262int __init intc_of_init(struct device_node *node,
261 struct device_node *parent) 263 struct device_node *parent)
262{ 264{
263 struct resource res; 265 struct resource res;
264 u32 nr_irqs = 96; 266 u32 nr_irq = 96;
265 267
266 if (WARN_ON(!node)) 268 if (WARN_ON(!node))
267 return -ENODEV; 269 return -ENODEV;
@@ -271,15 +273,25 @@ int __init omap_intc_of_init(struct device_node *node,
271 return -EINVAL; 273 return -EINVAL;
272 } 274 }
273 275
274 if (of_property_read_u32(node, "ti,intc-size", &nr_irqs)) 276 if (of_property_read_u32(node, "ti,intc-size", &nr_irq))
275 pr_warn("unable to get intc-size, default to %d\n", nr_irqs); 277 pr_warn("unable to get intc-size, default to %d\n", nr_irq);
276 278
277 omap_init_irq(res.start, nr_irqs, of_node_get(node)); 279 omap_init_irq(res.start, nr_irq, of_node_get(node));
278 280
279 return 0; 281 return 0;
280} 282}
281 283
282#ifdef CONFIG_ARCH_OMAP3 284static struct of_device_id irq_match[] __initdata = {
285 { .compatible = "ti,omap2-intc", .data = intc_of_init, },
286 { }
287};
288
289void __init omap_intc_of_init(void)
290{
291 of_irq_init(irq_match);
292}
293
294#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
283static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)]; 295static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
284 296
285void omap_intc_save_context(void) 297void omap_intc_save_context(void)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 19b8b6774862..6875be837d9f 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -83,8 +83,6 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
83 l = mbox_read_reg(MAILBOX_REVISION); 83 l = mbox_read_reg(MAILBOX_REVISION);
84 pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f)); 84 pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f));
85 85
86 omap2_mbox_enable_irq(mbox, IRQ_RX);
87
88 return 0; 86 return 0;
89} 87}
90 88
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index ef2a6924731a..fb5bc6cf3773 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -22,11 +22,15 @@
22 */ 22 */
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/err.h>
25 26
26#include <plat/omap_hwmod.h> 27#include <plat/omap_hwmod.h>
28#include <plat/omap_device.h>
27#include <plat/mmc.h> 29#include <plat/mmc.h>
28 30
29#include "common.h" 31#include "common.h"
32#include "control.h"
33#include "mux.h"
30 34
31/* 35/*
32 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register 36 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
@@ -86,3 +90,72 @@ int omap_msdi_reset(struct omap_hwmod *oh)
86 90
87 return 0; 91 return 0;
88} 92}
93
94#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
95
96static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
97 *mmc_controller)
98{
99 if ((mmc_controller->slots[0].switch_pin > 0) && \
100 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
101 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
102 OMAP_PIN_INPUT_PULLUP);
103 if ((mmc_controller->slots[0].gpio_wp > 0) && \
104 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
105 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
106 OMAP_PIN_INPUT_PULLUP);
107
108 omap_mux_init_signal("sdmmc_cmd", 0);
109 omap_mux_init_signal("sdmmc_clki", 0);
110 omap_mux_init_signal("sdmmc_clko", 0);
111 omap_mux_init_signal("sdmmc_dat0", 0);
112 omap_mux_init_signal("sdmmc_dat_dir0", 0);
113 omap_mux_init_signal("sdmmc_cmd_dir", 0);
114 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
115 omap_mux_init_signal("sdmmc_dat1", 0);
116 omap_mux_init_signal("sdmmc_dat2", 0);
117 omap_mux_init_signal("sdmmc_dat3", 0);
118 omap_mux_init_signal("sdmmc_dat_dir1", 0);
119 omap_mux_init_signal("sdmmc_dat_dir2", 0);
120 omap_mux_init_signal("sdmmc_dat_dir3", 0);
121 }
122
123 /*
124 * Use internal loop-back in MMC/SDIO Module Input Clock
125 * selection
126 */
127 if (mmc_controller->slots[0].internal_clock) {
128 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
129 v |= (1 << 24);
130 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
131 }
132}
133
134void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
135{
136 struct platform_device *pdev;
137 struct omap_hwmod *oh;
138 int id = 0;
139 char *oh_name = "msdi1";
140 char *dev_name = "mmci-omap";
141
142 if (!mmc_data[0]) {
143 pr_err("%s fails: Incomplete platform data\n", __func__);
144 return;
145 }
146
147 omap242x_mmc_mux(mmc_data[0]);
148
149 oh = omap_hwmod_lookup(oh_name);
150 if (!oh) {
151 pr_err("Could not look up %s\n", oh_name);
152 return;
153 }
154 pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
155 sizeof(struct omap_mmc_platform_data), NULL, 0, 0);
156 if (IS_ERR(pdev))
157 WARN(1, "Can'd build omap_device for %s:%s.\n",
158 dev_name, oh->name);
159}
160
161#endif
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 80e55c5c9998..9fe6829f4c16 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -41,6 +41,7 @@
41#include "control.h" 41#include "control.h"
42#include "mux.h" 42#include "mux.h"
43#include "prm.h" 43#include "prm.h"
44#include "common.h"
44 45
45#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */ 46#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */
46#define OMAP_MUX_BASE_SZ 0x5ca 47#define OMAP_MUX_BASE_SZ 0x5ca
@@ -217,8 +218,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
217 return -ENODEV; 218 return -ENODEV;
218} 219}
219 220
220static int __init 221int __init omap_mux_get_by_name(const char *muxname,
221omap_mux_get_by_name(const char *muxname,
222 struct omap_mux_partition **found_partition, 222 struct omap_mux_partition **found_partition,
223 struct omap_mux **found_mux) 223 struct omap_mux **found_mux)
224{ 224{
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 69fe060a0b75..471e62a74a16 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -59,6 +59,7 @@
59#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN 59#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN
60 60
61#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) 61#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4)
62#define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0)
62 63
63/* Flags for omapX_mux_init */ 64/* Flags for omapX_mux_init */
64#define OMAP_PACKAGE_MASK 0xffff 65#define OMAP_PACKAGE_MASK 0xffff
@@ -225,8 +226,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads);
225 */ 226 */
226void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); 227void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state);
227 228
229int omap_mux_get_by_name(const char *muxname,
230 struct omap_mux_partition **found_partition,
231 struct omap_mux **found_mux);
228#else 232#else
229 233
234static inline int omap_mux_get_by_name(const char *muxname,
235 struct omap_mux_partition **found_partition,
236 struct omap_mux **found_mux)
237{
238 return 0;
239}
240
230static inline int omap_mux_init_gpio(int gpio, int val) 241static inline int omap_mux_init_gpio(int gpio, int val)
231{ 242{
232 return 0; 243 return 0;
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 503ac777a2ba..502e3135aad3 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -19,6 +19,27 @@
19#include <linux/init.h> 19#include <linux/init.h>
20 20
21 __CPUINIT 21 __CPUINIT
22
23/* Physical address needed since MMU not enabled yet on secondary core */
24#define AUX_CORE_BOOT0_PA 0x48281800
25
26/*
27 * OMAP5 specific entry point for secondary CPU to jump from ROM
28 * code. This routine also provides a holding flag into which
29 * secondary core is held until we're ready for it to initialise.
30 * The primary core will update this flag using a hardware
31+ * register AuxCoreBoot0.
32 */
33ENTRY(omap5_secondary_startup)
34wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
35 ldr r0, [r2]
36 mov r0, r0, lsr #5
37 mrc p15, 0, r4, c0, c0, 5
38 and r4, r4, #0x0f
39 cmp r0, r4
40 bne wait
41 b secondary_startup
42END(omap5_secondary_startup)
22/* 43/*
23 * OMAP4 specific entry point for secondary CPU to jump from ROM 44 * OMAP4 specific entry point for secondary CPU to jump from ROM
24 * code. This routine also provides a holding flag into which 45 * code. This routine also provides a holding flag into which
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index 56c345b8b931..414083b427df 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -17,8 +17,10 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/io.h>
20 21
21#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <mach/omap-wakeupgen.h>
22 24
23#include "common.h" 25#include "common.h"
24 26
@@ -35,7 +37,8 @@ int platform_cpu_kill(unsigned int cpu)
35 */ 37 */
36void __ref platform_cpu_die(unsigned int cpu) 38void __ref platform_cpu_die(unsigned int cpu)
37{ 39{
38 unsigned int this_cpu; 40 unsigned int boot_cpu = 0;
41 void __iomem *base = omap_get_wakeupgen_base();
39 42
40 flush_cache_all(); 43 flush_cache_all();
41 dsb(); 44 dsb();
@@ -43,16 +46,27 @@ void __ref platform_cpu_die(unsigned int cpu)
43 /* 46 /*
44 * we're ready for shutdown now, so do it 47 * we're ready for shutdown now, so do it
45 */ 48 */
46 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) 49 if (omap_secure_apis_support()) {
47 pr_err("Secure clear status failed\n"); 50 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
51 pr_err("Secure clear status failed\n");
52 } else {
53 __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0);
54 }
55
48 56
49 for (;;) { 57 for (;;) {
50 /* 58 /*
51 * Enter into low power state 59 * Enter into low power state
52 */ 60 */
53 omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF); 61 omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
54 this_cpu = smp_processor_id(); 62
55 if (omap_read_auxcoreboot0() == this_cpu) { 63 if (omap_secure_apis_support())
64 boot_cpu = omap_read_auxcoreboot0();
65 else
66 boot_cpu =
67 __raw_readl(base + OMAP_AUX_CORE_BOOT_0) >> 5;
68
69 if (boot_cpu == smp_processor_id()) {
56 /* 70 /*
57 * OK, proper wakeup, we're done 71 * OK, proper wakeup, we're done
58 */ 72 */
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index ac49384d0285..1be8bcb52e93 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -73,19 +73,17 @@ static struct iommu_device omap4_devices[] = {
73 .da_end = 0xFFFFF000, 73 .da_end = 0xFFFFF000,
74 }, 74 },
75 }, 75 },
76#if defined(CONFIG_MPU_TESLA_IOMMU)
77 { 76 {
78 .base = OMAP4_MMU2_BASE, 77 .base = OMAP4_MMU2_BASE,
79 .irq = INT_44XX_DSP_MMU, 78 .irq = OMAP44XX_IRQ_TESLA_MMU,
80 .pdata = { 79 .pdata = {
81 .name = "tesla", 80 .name = "tesla",
82 .nr_tlb_entries = 32, 81 .nr_tlb_entries = 32,
83 .clk_name = "tesla_ick", 82 .clk_name = "dsp_fck",
84 .da_start = 0x0, 83 .da_start = 0x0,
85 .da_end = 0xFFFFF000, 84 .da_end = 0xFFFFF000,
86 }, 85 },
87 }, 86 },
88#endif
89}; 87};
90#define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices) 88#define NR_OMAP4_IOMMU_DEVICES ARRAY_SIZE(omap4_devices)
91static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES]; 89static struct platform_device *omap4_iommu_pdev[NR_OMAP4_IOMMU_DEVICES];
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 13670aa84e58..637a1bdf2ac4 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -255,7 +255,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
255 return -ENXIO; 255 return -ENXIO;
256 } 256 }
257 257
258 pwrdm_pre_transition(); 258 pwrdm_pre_transition(NULL);
259 259
260 /* 260 /*
261 * Check MPUSS next state and save interrupt controller if needed. 261 * Check MPUSS next state and save interrupt controller if needed.
@@ -287,7 +287,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
287 wakeup_cpu = smp_processor_id(); 287 wakeup_cpu = smp_processor_id();
288 set_cpu_next_pwrst(wakeup_cpu, PWRDM_POWER_ON); 288 set_cpu_next_pwrst(wakeup_cpu, PWRDM_POWER_ON);
289 289
290 pwrdm_post_transition(); 290 pwrdm_post_transition(NULL);
291 291
292 return 0; 292 return 0;
293} 293}
@@ -313,7 +313,7 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
313 scu_pwrst_prepare(cpu, power_state); 313 scu_pwrst_prepare(cpu, power_state);
314 314
315 /* 315 /*
316 * CPU never retuns back if targetted power state is OFF mode. 316 * CPU never retuns back if targeted power state is OFF mode.
317 * CPU ONLINE follows normal CPU ONLINE ptah via 317 * CPU ONLINE follows normal CPU ONLINE ptah via
318 * omap_secondary_startup(). 318 * omap_secondary_startup().
319 */ 319 */
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index deffbf1c9627..7d118b9bdd5f 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -26,11 +26,19 @@
26 26
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/omap-secure.h> 28#include <mach/omap-secure.h>
29#include <mach/omap-wakeupgen.h>
30#include <asm/cputype.h>
29 31
30#include "iomap.h" 32#include "iomap.h"
31#include "common.h" 33#include "common.h"
32#include "clockdomain.h" 34#include "clockdomain.h"
33 35
36#define CPU_MASK 0xff0ffff0
37#define CPU_CORTEX_A9 0x410FC090
38#define CPU_CORTEX_A15 0x410FC0F0
39
40#define OMAP5_CORE_COUNT 0x2
41
34/* SCU base address */ 42/* SCU base address */
35static void __iomem *scu_base; 43static void __iomem *scu_base;
36 44
@@ -73,6 +81,8 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
73{ 81{
74 static struct clockdomain *cpu1_clkdm; 82 static struct clockdomain *cpu1_clkdm;
75 static bool booted; 83 static bool booted;
84 void __iomem *base = omap_get_wakeupgen_base();
85
76 /* 86 /*
77 * Set synchronisation state between this boot processor 87 * Set synchronisation state between this boot processor
78 * and the secondary one 88 * and the secondary one
@@ -85,7 +95,11 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
85 * the AuxCoreBoot1 register is updated with cpu state 95 * the AuxCoreBoot1 register is updated with cpu state
86 * A barrier is added to ensure that write buffer is drained 96 * A barrier is added to ensure that write buffer is drained
87 */ 97 */
88 omap_modify_auxcoreboot0(0x200, 0xfffffdff); 98 if (omap_secure_apis_support())
99 omap_modify_auxcoreboot0(0x200, 0xfffffdff);
100 else
101 __raw_writel(0x20, base + OMAP_AUX_CORE_BOOT_0);
102
89 flush_cache_all(); 103 flush_cache_all();
90 smp_wmb(); 104 smp_wmb();
91 105
@@ -124,13 +138,19 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
124 138
125static void __init wakeup_secondary(void) 139static void __init wakeup_secondary(void)
126{ 140{
141 void __iomem *base = omap_get_wakeupgen_base();
127 /* 142 /*
128 * Write the address of secondary startup routine into the 143 * Write the address of secondary startup routine into the
129 * AuxCoreBoot1 where ROM code will jump and start executing 144 * AuxCoreBoot1 where ROM code will jump and start executing
130 * on secondary core once out of WFE 145 * on secondary core once out of WFE
131 * A barrier is added to ensure that write buffer is drained 146 * A barrier is added to ensure that write buffer is drained
132 */ 147 */
133 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup)); 148 if (omap_secure_apis_support())
149 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup));
150 else
151 __raw_writel(virt_to_phys(omap5_secondary_startup),
152 base + OMAP_AUX_CORE_BOOT_1);
153
134 smp_wmb(); 154 smp_wmb();
135 155
136 /* 156 /*
@@ -147,16 +167,21 @@ static void __init wakeup_secondary(void)
147 */ 167 */
148void __init smp_init_cpus(void) 168void __init smp_init_cpus(void)
149{ 169{
150 unsigned int i, ncores; 170 unsigned int i = 0, ncores = 1, cpu_id;
151 171
152 /* 172 /* Use ARM cpuid check here, as SoC detection will not work so early */
153 * Currently we can't call ioremap here because 173 cpu_id = read_cpuid(CPUID_ID) & CPU_MASK;
154 * SoC detection won't work until after init_early. 174 if (cpu_id == CPU_CORTEX_A9) {
155 */ 175 /*
156 scu_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE); 176 * Currently we can't call ioremap here because
157 BUG_ON(!scu_base); 177 * SoC detection won't work until after init_early.
158 178 */
159 ncores = scu_get_core_count(scu_base); 179 scu_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
180 BUG_ON(!scu_base);
181 ncores = scu_get_core_count(scu_base);
182 } else if (cpu_id == CPU_CORTEX_A15) {
183 ncores = OMAP5_CORE_COUNT;
184 }
160 185
161 /* sanity check */ 186 /* sanity check */
162 if (ncores > nr_cpu_ids) { 187 if (ncores > nr_cpu_ids) {
@@ -178,6 +203,7 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
178 * Initialise the SCU and wake up the secondary core using 203 * Initialise the SCU and wake up the secondary core using
179 * wakeup_secondary(). 204 * wakeup_secondary().
180 */ 205 */
181 scu_enable(scu_base); 206 if (scu_base)
207 scu_enable(scu_base);
182 wakeup_secondary(); 208 wakeup_secondary();
183} 209}
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index d811c7790350..05fdebfaa195 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -33,18 +33,23 @@
33#include "omap4-sar-layout.h" 33#include "omap4-sar-layout.h"
34#include "common.h" 34#include "common.h"
35 35
36#define NR_REG_BANKS 4 36#define MAX_NR_REG_BANKS 5
37#define MAX_IRQS 128 37#define MAX_IRQS 160
38#define WKG_MASK_ALL 0x00000000 38#define WKG_MASK_ALL 0x00000000
39#define WKG_UNMASK_ALL 0xffffffff 39#define WKG_UNMASK_ALL 0xffffffff
40#define CPU_ENA_OFFSET 0x400 40#define CPU_ENA_OFFSET 0x400
41#define CPU0_ID 0x0 41#define CPU0_ID 0x0
42#define CPU1_ID 0x1 42#define CPU1_ID 0x1
43#define OMAP4_NR_BANKS 4
44#define OMAP4_NR_IRQS 128
43 45
44static void __iomem *wakeupgen_base; 46static void __iomem *wakeupgen_base;
45static void __iomem *sar_base; 47static void __iomem *sar_base;
46static DEFINE_SPINLOCK(wakeupgen_lock); 48static DEFINE_SPINLOCK(wakeupgen_lock);
47static unsigned int irq_target_cpu[NR_IRQS]; 49static unsigned int irq_target_cpu[NR_IRQS];
50static unsigned int irq_banks = MAX_NR_REG_BANKS;
51static unsigned int max_irqs = MAX_IRQS;
52static unsigned int omap_secure_apis;
48 53
49/* 54/*
50 * Static helper functions. 55 * Static helper functions.
@@ -146,13 +151,13 @@ static void wakeupgen_unmask(struct irq_data *d)
146} 151}
147 152
148#ifdef CONFIG_HOTPLUG_CPU 153#ifdef CONFIG_HOTPLUG_CPU
149static DEFINE_PER_CPU(u32 [NR_REG_BANKS], irqmasks); 154static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks);
150 155
151static void _wakeupgen_save_masks(unsigned int cpu) 156static void _wakeupgen_save_masks(unsigned int cpu)
152{ 157{
153 u8 i; 158 u8 i;
154 159
155 for (i = 0; i < NR_REG_BANKS; i++) 160 for (i = 0; i < irq_banks; i++)
156 per_cpu(irqmasks, cpu)[i] = wakeupgen_readl(i, cpu); 161 per_cpu(irqmasks, cpu)[i] = wakeupgen_readl(i, cpu);
157} 162}
158 163
@@ -160,7 +165,7 @@ static void _wakeupgen_restore_masks(unsigned int cpu)
160{ 165{
161 u8 i; 166 u8 i;
162 167
163 for (i = 0; i < NR_REG_BANKS; i++) 168 for (i = 0; i < irq_banks; i++)
164 wakeupgen_writel(per_cpu(irqmasks, cpu)[i], i, cpu); 169 wakeupgen_writel(per_cpu(irqmasks, cpu)[i], i, cpu);
165} 170}
166 171
@@ -168,7 +173,7 @@ static void _wakeupgen_set_all(unsigned int cpu, unsigned int reg)
168{ 173{
169 u8 i; 174 u8 i;
170 175
171 for (i = 0; i < NR_REG_BANKS; i++) 176 for (i = 0; i < irq_banks; i++)
172 wakeupgen_writel(reg, i, cpu); 177 wakeupgen_writel(reg, i, cpu);
173} 178}
174 179
@@ -196,25 +201,14 @@ static void wakeupgen_irqmask_all(unsigned int cpu, unsigned int set)
196#endif 201#endif
197 202
198#ifdef CONFIG_CPU_PM 203#ifdef CONFIG_CPU_PM
199/* 204static inline void omap4_irq_save_context(void)
200 * Save WakeupGen interrupt context in SAR BANK3. Restore is done by
201 * ROM code. WakeupGen IP is integrated along with GIC to manage the
202 * interrupt wakeups from CPU low power states. It manages
203 * masking/unmasking of Shared peripheral interrupts(SPI). So the
204 * interrupt enable/disable control should be in sync and consistent
205 * at WakeupGen and GIC so that interrupts are not lost.
206 */
207static void irq_save_context(void)
208{ 205{
209 u32 i, val; 206 u32 i, val;
210 207
211 if (omap_rev() == OMAP4430_REV_ES1_0) 208 if (omap_rev() == OMAP4430_REV_ES1_0)
212 return; 209 return;
213 210
214 if (!sar_base) 211 for (i = 0; i < irq_banks; i++) {
215 sar_base = omap4_get_sar_ram_base();
216
217 for (i = 0; i < NR_REG_BANKS; i++) {
218 /* Save the CPUx interrupt mask for IRQ 0 to 127 */ 212 /* Save the CPUx interrupt mask for IRQ 0 to 127 */
219 val = wakeupgen_readl(i, 0); 213 val = wakeupgen_readl(i, 0);
220 sar_writel(val, WAKEUPGENENB_OFFSET_CPU0, i); 214 sar_writel(val, WAKEUPGENENB_OFFSET_CPU0, i);
@@ -254,6 +248,53 @@ static void irq_save_context(void)
254 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET); 248 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET);
255 val |= SAR_BACKUP_STATUS_WAKEUPGEN; 249 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
256 __raw_writel(val, sar_base + SAR_BACKUP_STATUS_OFFSET); 250 __raw_writel(val, sar_base + SAR_BACKUP_STATUS_OFFSET);
251
252}
253
254static inline void omap5_irq_save_context(void)
255{
256 u32 i, val;
257
258 for (i = 0; i < irq_banks; i++) {
259 /* Save the CPUx interrupt mask for IRQ 0 to 159 */
260 val = wakeupgen_readl(i, 0);
261 sar_writel(val, OMAP5_WAKEUPGENENB_OFFSET_CPU0, i);
262 val = wakeupgen_readl(i, 1);
263 sar_writel(val, OMAP5_WAKEUPGENENB_OFFSET_CPU1, i);
264 sar_writel(0x0, OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU0, i);
265 sar_writel(0x0, OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU1, i);
266 }
267
268 /* Save AuxBoot* registers */
269 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
270 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET);
271 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
272 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET);
273
274 /* Set the Backup Bit Mask status */
275 val = __raw_readl(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
276 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
277 __raw_writel(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
278
279}
280
281/*
282 * Save WakeupGen interrupt context in SAR BANK3. Restore is done by
283 * ROM code. WakeupGen IP is integrated along with GIC to manage the
284 * interrupt wakeups from CPU low power states. It manages
285 * masking/unmasking of Shared peripheral interrupts(SPI). So the
286 * interrupt enable/disable control should be in sync and consistent
287 * at WakeupGen and GIC so that interrupts are not lost.
288 */
289static void irq_save_context(void)
290{
291 if (!sar_base)
292 sar_base = omap4_get_sar_ram_base();
293
294 if (soc_is_omap54xx())
295 omap5_irq_save_context();
296 else
297 omap4_irq_save_context();
257} 298}
258 299
259/* 300/*
@@ -262,9 +303,14 @@ static void irq_save_context(void)
262static void irq_sar_clear(void) 303static void irq_sar_clear(void)
263{ 304{
264 u32 val; 305 u32 val;
265 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET); 306 u32 offset = SAR_BACKUP_STATUS_OFFSET;
307
308 if (soc_is_omap54xx())
309 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET;
310
311 val = __raw_readl(sar_base + offset);
266 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN; 312 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN;
267 __raw_writel(val, sar_base + SAR_BACKUP_STATUS_OFFSET); 313 __raw_writel(val, sar_base + offset);
268} 314}
269 315
270/* 316/*
@@ -336,13 +382,25 @@ static struct notifier_block irq_notifier_block = {
336 382
337static void __init irq_pm_init(void) 383static void __init irq_pm_init(void)
338{ 384{
339 cpu_pm_register_notifier(&irq_notifier_block); 385 /* FIXME: Remove this when MPU OSWR support is added */
386 if (!soc_is_omap54xx())
387 cpu_pm_register_notifier(&irq_notifier_block);
340} 388}
341#else 389#else
342static void __init irq_pm_init(void) 390static void __init irq_pm_init(void)
343{} 391{}
344#endif 392#endif
345 393
394void __iomem *omap_get_wakeupgen_base(void)
395{
396 return wakeupgen_base;
397}
398
399int omap_secure_apis_support(void)
400{
401 return omap_secure_apis;
402}
403
346/* 404/*
347 * Initialise the wakeupgen module. 405 * Initialise the wakeupgen module.
348 */ 406 */
@@ -358,12 +416,18 @@ int __init omap_wakeupgen_init(void)
358 } 416 }
359 417
360 /* Static mapping, never released */ 418 /* Static mapping, never released */
361 wakeupgen_base = ioremap(OMAP44XX_WKUPGEN_BASE, SZ_4K); 419 wakeupgen_base = ioremap(OMAP_WKUPGEN_BASE, SZ_4K);
362 if (WARN_ON(!wakeupgen_base)) 420 if (WARN_ON(!wakeupgen_base))
363 return -ENOMEM; 421 return -ENOMEM;
364 422
423 if (cpu_is_omap44xx()) {
424 irq_banks = OMAP4_NR_BANKS;
425 max_irqs = OMAP4_NR_IRQS;
426 omap_secure_apis = 1;
427 }
428
365 /* Clear all IRQ bitmasks at wakeupGen level */ 429 /* Clear all IRQ bitmasks at wakeupGen level */
366 for (i = 0; i < NR_REG_BANKS; i++) { 430 for (i = 0; i < irq_banks; i++) {
367 wakeupgen_writel(0, i, CPU0_ID); 431 wakeupgen_writel(0, i, CPU0_ID);
368 wakeupgen_writel(0, i, CPU1_ID); 432 wakeupgen_writel(0, i, CPU1_ID);
369 } 433 }
@@ -382,7 +446,7 @@ int __init omap_wakeupgen_init(void)
382 */ 446 */
383 447
384 /* Associate all the IRQs to boot CPU like GIC init does. */ 448 /* Associate all the IRQs to boot CPU like GIC init does. */
385 for (i = 0; i < NR_IRQS; i++) 449 for (i = 0; i < max_irqs; i++)
386 irq_target_cpu[i] = boot_cpu; 450 irq_target_cpu[i] = boot_cpu;
387 451
388 irq_hotplug_init(); 452 irq_hotplug_init();
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index a8161e5f3204..c29dee998a79 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -21,6 +21,8 @@
21#include <asm/hardware/cache-l2x0.h> 21#include <asm/hardware/cache-l2x0.h>
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include <asm/memblock.h> 23#include <asm/memblock.h>
24#include <linux/of_irq.h>
25#include <linux/of_platform.h>
24 26
25#include <plat/irqs.h> 27#include <plat/irqs.h>
26#include <plat/sram.h> 28#include <plat/sram.h>
@@ -210,6 +212,18 @@ static int __init omap4_sar_ram_init(void)
210} 212}
211early_initcall(omap4_sar_ram_init); 213early_initcall(omap4_sar_ram_init);
212 214
215static struct of_device_id irq_match[] __initdata = {
216 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
217 { .compatible = "arm,cortex-a15-gic", .data = gic_of_init, },
218 { }
219};
220
221void __init omap_gic_of_init(void)
222{
223 omap_wakeupgen_init();
224 of_irq_init(irq_match);
225}
226
213#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 227#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
214static int omap4_twl6030_hsmmc_late_init(struct device *dev) 228static int omap4_twl6030_hsmmc_late_init(struct device *dev)
215{ 229{
diff --git a/arch/arm/mach-omap2/omap4-sar-layout.h b/arch/arm/mach-omap2/omap4-sar-layout.h
index fe5b545ad443..e170fe803b04 100644
--- a/arch/arm/mach-omap2/omap4-sar-layout.h
+++ b/arch/arm/mach-omap2/omap4-sar-layout.h
@@ -12,7 +12,7 @@
12#define OMAP_ARCH_OMAP4_SAR_LAYOUT_H 12#define OMAP_ARCH_OMAP4_SAR_LAYOUT_H
13 13
14/* 14/*
15 * SAR BANK offsets from base address OMAP44XX_SAR_RAM_BASE 15 * SAR BANK offsets from base address OMAP44XX/54XX_SAR_RAM_BASE
16 */ 16 */
17#define SAR_BANK1_OFFSET 0x0000 17#define SAR_BANK1_OFFSET 0x0000
18#define SAR_BANK2_OFFSET 0x1000 18#define SAR_BANK2_OFFSET 0x1000
@@ -47,4 +47,14 @@
47#define PTMSYNCREQ_EN_OFFSET (SAR_BANK3_OFFSET + 0x6d0) 47#define PTMSYNCREQ_EN_OFFSET (SAR_BANK3_OFFSET + 0x6d0)
48#define SAR_BACKUP_STATUS_WAKEUPGEN 0x10 48#define SAR_BACKUP_STATUS_WAKEUPGEN 0x10
49 49
50/* WakeUpGen save restore offset from OMAP54XX_SAR_RAM_BASE */
51#define OMAP5_WAKEUPGENENB_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x8d4)
52#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x8e8)
53#define OMAP5_WAKEUPGENENB_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0x8fc)
54#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0x910)
55#define OMAP5_AUXCOREBOOT0_OFFSET (SAR_BANK3_OFFSET + 0x924)
56#define OMAP5_AUXCOREBOOT1_OFFSET (SAR_BANK3_OFFSET + 0x928)
57#define OMAP5_AMBA_IF_MODE_OFFSET (SAR_BANK3_OFFSET + 0x92c)
58#define OMAP5_SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x800)
59
50#endif 60#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index bf86f7e8f91f..6ca8e519968d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -153,6 +153,7 @@
153#include "prm44xx.h" 153#include "prm44xx.h"
154#include "prminst44xx.h" 154#include "prminst44xx.h"
155#include "mux.h" 155#include "mux.h"
156#include "pm.h"
156 157
157/* Maximum microseconds to wait for OMAP module to softreset */ 158/* Maximum microseconds to wait for OMAP module to softreset */
158#define MAX_MODULE_SOFTRESET_WAIT 10000 159#define MAX_MODULE_SOFTRESET_WAIT 10000
@@ -166,12 +167,40 @@
166 */ 167 */
167#define LINKS_PER_OCP_IF 2 168#define LINKS_PER_OCP_IF 2
168 169
170/**
171 * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
172 * @enable_module: function to enable a module (via MODULEMODE)
173 * @disable_module: function to disable a module (via MODULEMODE)
174 *
175 * XXX Eventually this functionality will be hidden inside the PRM/CM
176 * device drivers. Until then, this should avoid huge blocks of cpu_is_*()
177 * conditionals in this code.
178 */
179struct omap_hwmod_soc_ops {
180 void (*enable_module)(struct omap_hwmod *oh);
181 int (*disable_module)(struct omap_hwmod *oh);
182 int (*wait_target_ready)(struct omap_hwmod *oh);
183 int (*assert_hardreset)(struct omap_hwmod *oh,
184 struct omap_hwmod_rst_info *ohri);
185 int (*deassert_hardreset)(struct omap_hwmod *oh,
186 struct omap_hwmod_rst_info *ohri);
187 int (*is_hardreset_asserted)(struct omap_hwmod *oh,
188 struct omap_hwmod_rst_info *ohri);
189 int (*init_clkdm)(struct omap_hwmod *oh);
190};
191
192/* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
193static struct omap_hwmod_soc_ops soc_ops;
194
169/* omap_hwmod_list contains all registered struct omap_hwmods */ 195/* omap_hwmod_list contains all registered struct omap_hwmods */
170static LIST_HEAD(omap_hwmod_list); 196static LIST_HEAD(omap_hwmod_list);
171 197
172/* mpu_oh: used to add/remove MPU initiator from sleepdep list */ 198/* mpu_oh: used to add/remove MPU initiator from sleepdep list */
173static struct omap_hwmod *mpu_oh; 199static struct omap_hwmod *mpu_oh;
174 200
201/* io_chain_lock: used to serialize reconfigurations of the I/O chain */
202static DEFINE_SPINLOCK(io_chain_lock);
203
175/* 204/*
176 * linkspace: ptr to a buffer that struct omap_hwmod_link records are 205 * linkspace: ptr to a buffer that struct omap_hwmod_link records are
177 * allocated from - used to reduce the number of small memory 206 * allocated from - used to reduce the number of small memory
@@ -186,6 +215,9 @@ static struct omap_hwmod_link *linkspace;
186 */ 215 */
187static unsigned short free_ls, max_ls, ls_supp; 216static unsigned short free_ls, max_ls, ls_supp;
188 217
218/* inited: set to true once the hwmod code is initialized */
219static bool inited;
220
189/* Private functions */ 221/* Private functions */
190 222
191/** 223/**
@@ -388,6 +420,49 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
388} 420}
389 421
390/** 422/**
423 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v
424 * @oh: struct omap_hwmod *
425 *
426 * The DMADISABLE bit is a semi-automatic bit present in sysconfig register
427 * of some modules. When the DMA must perform read/write accesses, the
428 * DMADISABLE bit is cleared by the hardware. But when the DMA must stop
429 * for power management, software must set the DMADISABLE bit back to 1.
430 *
431 * Set the DMADISABLE bit in @v for hwmod @oh. Returns -EINVAL upon
432 * error or 0 upon success.
433 */
434static int _set_dmadisable(struct omap_hwmod *oh)
435{
436 u32 v;
437 u32 dmadisable_mask;
438
439 if (!oh->class->sysc ||
440 !(oh->class->sysc->sysc_flags & SYSC_HAS_DMADISABLE))
441 return -EINVAL;
442
443 if (!oh->class->sysc->sysc_fields) {
444 WARN(1, "omap_hwmod: %s: offset struct for sysconfig not provided in class\n", oh->name);
445 return -EINVAL;
446 }
447
448 /* clocks must be on for this operation */
449 if (oh->_state != _HWMOD_STATE_ENABLED) {
450 pr_warn("omap_hwmod: %s: dma can be disabled only from enabled state\n", oh->name);
451 return -EINVAL;
452 }
453
454 pr_debug("omap_hwmod: %s: setting DMADISABLE\n", oh->name);
455
456 v = oh->_sysc_cache;
457 dmadisable_mask =
458 (0x1 << oh->class->sysc->sysc_fields->dmadisable_shift);
459 v |= dmadisable_mask;
460 _write_sysconfig(v, oh);
461
462 return 0;
463}
464
465/**
391 * _set_module_autoidle: set the OCP_SYSCONFIG AUTOIDLE field in @v 466 * _set_module_autoidle: set the OCP_SYSCONFIG AUTOIDLE field in @v
392 * @oh: struct omap_hwmod * 467 * @oh: struct omap_hwmod *
393 * @autoidle: desired AUTOIDLE bitfield value (0 or 1) 468 * @autoidle: desired AUTOIDLE bitfield value (0 or 1)
@@ -530,7 +605,7 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
530 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) 605 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP)
531 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v); 606 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v);
532 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP) 607 if (oh->class->sysc->idlemodes & MSTANDBY_SMART_WKUP)
533 _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART_WKUP, v); 608 _set_master_standbymode(oh, HWMOD_IDLEMODE_SMART, v);
534 609
535 /* XXX test pwrdm_get_wken for this hwmod's subsystem */ 610 /* XXX test pwrdm_get_wken for this hwmod's subsystem */
536 611
@@ -771,23 +846,19 @@ static void _disable_optional_clocks(struct omap_hwmod *oh)
771} 846}
772 847
773/** 848/**
774 * _enable_module - enable CLKCTRL modulemode on OMAP4 849 * _omap4_enable_module - enable CLKCTRL modulemode on OMAP4
775 * @oh: struct omap_hwmod * 850 * @oh: struct omap_hwmod *
776 * 851 *
777 * Enables the PRCM module mode related to the hwmod @oh. 852 * Enables the PRCM module mode related to the hwmod @oh.
778 * No return value. 853 * No return value.
779 */ 854 */
780static void _enable_module(struct omap_hwmod *oh) 855static void _omap4_enable_module(struct omap_hwmod *oh)
781{ 856{
782 /* The module mode does not exist prior OMAP4 */
783 if (cpu_is_omap24xx() || cpu_is_omap34xx())
784 return;
785
786 if (!oh->clkdm || !oh->prcm.omap4.modulemode) 857 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
787 return; 858 return;
788 859
789 pr_debug("omap_hwmod: %s: _enable_module: %d\n", 860 pr_debug("omap_hwmod: %s: %s: %d\n",
790 oh->name, oh->prcm.omap4.modulemode); 861 oh->name, __func__, oh->prcm.omap4.modulemode);
791 862
792 omap4_cminst_module_enable(oh->prcm.omap4.modulemode, 863 omap4_cminst_module_enable(oh->prcm.omap4.modulemode,
793 oh->clkdm->prcm_partition, 864 oh->clkdm->prcm_partition,
@@ -807,10 +878,7 @@ static void _enable_module(struct omap_hwmod *oh)
807 */ 878 */
808static int _omap4_wait_target_disable(struct omap_hwmod *oh) 879static int _omap4_wait_target_disable(struct omap_hwmod *oh)
809{ 880{
810 if (!cpu_is_omap44xx()) 881 if (!oh || !oh->clkdm)
811 return 0;
812
813 if (!oh)
814 return -EINVAL; 882 return -EINVAL;
815 883
816 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 884 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
@@ -1124,15 +1192,18 @@ static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap
1124 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG 1192 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG
1125 * @oh: struct omap_hwmod * 1193 * @oh: struct omap_hwmod *
1126 * 1194 *
1127 * If module is marked as SWSUP_SIDLE, force the module out of slave 1195 * Ensure that the OCP_SYSCONFIG register for the IP block represented
1128 * idle; otherwise, configure it for smart-idle. If module is marked 1196 * by @oh is set to indicate to the PRCM that the IP block is active.
1129 * as SWSUP_MSUSPEND, force the module out of master standby; 1197 * Usually this means placing the module into smart-idle mode and
1130 * otherwise, configure it for smart-standby. No return value. 1198 * smart-standby, but if there is a bug in the automatic idle handling
1199 * for the IP block, it may need to be placed into the force-idle or
1200 * no-idle variants of these modes. No return value.
1131 */ 1201 */
1132static void _enable_sysc(struct omap_hwmod *oh) 1202static void _enable_sysc(struct omap_hwmod *oh)
1133{ 1203{
1134 u8 idlemode, sf; 1204 u8 idlemode, sf;
1135 u32 v; 1205 u32 v;
1206 bool clkdm_act;
1136 1207
1137 if (!oh->class->sysc) 1208 if (!oh->class->sysc)
1138 return; 1209 return;
@@ -1141,8 +1212,16 @@ static void _enable_sysc(struct omap_hwmod *oh)
1141 sf = oh->class->sysc->sysc_flags; 1212 sf = oh->class->sysc->sysc_flags;
1142 1213
1143 if (sf & SYSC_HAS_SIDLEMODE) { 1214 if (sf & SYSC_HAS_SIDLEMODE) {
1144 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ? 1215 clkdm_act = ((oh->clkdm &&
1145 HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART; 1216 oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
1217 (oh->_clk && oh->_clk->clkdm &&
1218 oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
1219 if (clkdm_act && !(oh->class->sysc->idlemodes &
1220 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1221 idlemode = HWMOD_IDLEMODE_FORCE;
1222 else
1223 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ?
1224 HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART;
1146 _set_slave_idlemode(oh, idlemode, &v); 1225 _set_slave_idlemode(oh, idlemode, &v);
1147 } 1226 }
1148 1227
@@ -1208,8 +1287,13 @@ static void _idle_sysc(struct omap_hwmod *oh)
1208 sf = oh->class->sysc->sysc_flags; 1287 sf = oh->class->sysc->sysc_flags;
1209 1288
1210 if (sf & SYSC_HAS_SIDLEMODE) { 1289 if (sf & SYSC_HAS_SIDLEMODE) {
1211 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ? 1290 /* XXX What about HWMOD_IDLEMODE_SMART_WKUP? */
1212 HWMOD_IDLEMODE_FORCE : HWMOD_IDLEMODE_SMART; 1291 if (oh->flags & HWMOD_SWSUP_SIDLE ||
1292 !(oh->class->sysc->idlemodes &
1293 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1294 idlemode = HWMOD_IDLEMODE_FORCE;
1295 else
1296 idlemode = HWMOD_IDLEMODE_SMART;
1213 _set_slave_idlemode(oh, idlemode, &v); 1297 _set_slave_idlemode(oh, idlemode, &v);
1214 } 1298 }
1215 1299
@@ -1285,24 +1369,20 @@ static struct omap_hwmod *_lookup(const char *name)
1285 1369
1286 return oh; 1370 return oh;
1287} 1371}
1372
1288/** 1373/**
1289 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod 1374 * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod
1290 * @oh: struct omap_hwmod * 1375 * @oh: struct omap_hwmod *
1291 * 1376 *
1292 * Convert a clockdomain name stored in a struct omap_hwmod into a 1377 * Convert a clockdomain name stored in a struct omap_hwmod into a
1293 * clockdomain pointer, and save it into the struct omap_hwmod. 1378 * clockdomain pointer, and save it into the struct omap_hwmod.
1294 * return -EINVAL if clkdm_name does not exist or if the lookup failed. 1379 * Return -EINVAL if the clkdm_name lookup failed.
1295 */ 1380 */
1296static int _init_clkdm(struct omap_hwmod *oh) 1381static int _init_clkdm(struct omap_hwmod *oh)
1297{ 1382{
1298 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1383 if (!oh->clkdm_name)
1299 return 0; 1384 return 0;
1300 1385
1301 if (!oh->clkdm_name) {
1302 pr_warning("omap_hwmod: %s: no clkdm_name\n", oh->name);
1303 return -EINVAL;
1304 }
1305
1306 oh->clkdm = clkdm_lookup(oh->clkdm_name); 1386 oh->clkdm = clkdm_lookup(oh->clkdm_name);
1307 if (!oh->clkdm) { 1387 if (!oh->clkdm) {
1308 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n", 1388 pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n",
@@ -1338,7 +1418,8 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1338 ret |= _init_main_clk(oh); 1418 ret |= _init_main_clk(oh);
1339 ret |= _init_interface_clks(oh); 1419 ret |= _init_interface_clks(oh);
1340 ret |= _init_opt_clks(oh); 1420 ret |= _init_opt_clks(oh);
1341 ret |= _init_clkdm(oh); 1421 if (soc_ops.init_clkdm)
1422 ret |= soc_ops.init_clkdm(oh);
1342 1423
1343 if (!ret) 1424 if (!ret)
1344 oh->_state = _HWMOD_STATE_CLKS_INITED; 1425 oh->_state = _HWMOD_STATE_CLKS_INITED;
@@ -1349,53 +1430,6 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1349} 1430}
1350 1431
1351/** 1432/**
1352 * _wait_target_ready - wait for a module to leave slave idle
1353 * @oh: struct omap_hwmod *
1354 *
1355 * Wait for a module @oh to leave slave idle. Returns 0 if the module
1356 * does not have an IDLEST bit or if the module successfully leaves
1357 * slave idle; otherwise, pass along the return value of the
1358 * appropriate *_cm*_wait_module_ready() function.
1359 */
1360static int _wait_target_ready(struct omap_hwmod *oh)
1361{
1362 struct omap_hwmod_ocp_if *os;
1363 int ret;
1364
1365 if (!oh)
1366 return -EINVAL;
1367
1368 if (oh->flags & HWMOD_NO_IDLEST)
1369 return 0;
1370
1371 os = _find_mpu_rt_port(oh);
1372 if (!os)
1373 return 0;
1374
1375 /* XXX check module SIDLEMODE */
1376
1377 /* XXX check clock enable states */
1378
1379 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1380 ret = omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs,
1381 oh->prcm.omap2.idlest_reg_id,
1382 oh->prcm.omap2.idlest_idle_bit);
1383 } else if (cpu_is_omap44xx()) {
1384 if (!oh->clkdm)
1385 return -EINVAL;
1386
1387 ret = omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
1388 oh->clkdm->cm_inst,
1389 oh->clkdm->clkdm_offs,
1390 oh->prcm.omap4.clkctrl_offs);
1391 } else {
1392 BUG();
1393 };
1394
1395 return ret;
1396}
1397
1398/**
1399 * _lookup_hardreset - fill register bit info for this hwmod/reset line 1433 * _lookup_hardreset - fill register bit info for this hwmod/reset line
1400 * @oh: struct omap_hwmod * 1434 * @oh: struct omap_hwmod *
1401 * @name: name of the reset line in the context of this hwmod 1435 * @name: name of the reset line in the context of this hwmod
@@ -1431,32 +1465,31 @@ static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name,
1431 * @oh: struct omap_hwmod * 1465 * @oh: struct omap_hwmod *
1432 * @name: name of the reset line to lookup and assert 1466 * @name: name of the reset line to lookup and assert
1433 * 1467 *
1434 * Some IP like dsp, ipu or iva contain processor that require 1468 * Some IP like dsp, ipu or iva contain processor that require an HW
1435 * an HW reset line to be assert / deassert in order to enable fully 1469 * reset line to be assert / deassert in order to enable fully the IP.
1436 * the IP. 1470 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1471 * asserting the hardreset line on the currently-booted SoC, or passes
1472 * along the return value from _lookup_hardreset() or the SoC's
1473 * assert_hardreset code.
1437 */ 1474 */
1438static int _assert_hardreset(struct omap_hwmod *oh, const char *name) 1475static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1439{ 1476{
1440 struct omap_hwmod_rst_info ohri; 1477 struct omap_hwmod_rst_info ohri;
1441 u8 ret; 1478 u8 ret = -EINVAL;
1442 1479
1443 if (!oh) 1480 if (!oh)
1444 return -EINVAL; 1481 return -EINVAL;
1445 1482
1483 if (!soc_ops.assert_hardreset)
1484 return -ENOSYS;
1485
1446 ret = _lookup_hardreset(oh, name, &ohri); 1486 ret = _lookup_hardreset(oh, name, &ohri);
1447 if (IS_ERR_VALUE(ret)) 1487 if (IS_ERR_VALUE(ret))
1448 return ret; 1488 return ret;
1449 1489
1450 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1490 ret = soc_ops.assert_hardreset(oh, &ohri);
1451 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, 1491
1452 ohri.rst_shift); 1492 return ret;
1453 else if (cpu_is_omap44xx())
1454 return omap4_prminst_assert_hardreset(ohri.rst_shift,
1455 oh->clkdm->pwrdm.ptr->prcm_partition,
1456 oh->clkdm->pwrdm.ptr->prcm_offs,
1457 oh->prcm.omap4.rstctrl_offs);
1458 else
1459 return -EINVAL;
1460} 1493}
1461 1494
1462/** 1495/**
@@ -1465,38 +1498,29 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1465 * @oh: struct omap_hwmod * 1498 * @oh: struct omap_hwmod *
1466 * @name: name of the reset line to look up and deassert 1499 * @name: name of the reset line to look up and deassert
1467 * 1500 *
1468 * Some IP like dsp, ipu or iva contain processor that require 1501 * Some IP like dsp, ipu or iva contain processor that require an HW
1469 * an HW reset line to be assert / deassert in order to enable fully 1502 * reset line to be assert / deassert in order to enable fully the IP.
1470 * the IP. 1503 * Returns -EINVAL if @oh is null, -ENOSYS if we have no way of
1504 * deasserting the hardreset line on the currently-booted SoC, or passes
1505 * along the return value from _lookup_hardreset() or the SoC's
1506 * deassert_hardreset code.
1471 */ 1507 */
1472static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) 1508static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1473{ 1509{
1474 struct omap_hwmod_rst_info ohri; 1510 struct omap_hwmod_rst_info ohri;
1475 int ret; 1511 int ret = -EINVAL;
1476 1512
1477 if (!oh) 1513 if (!oh)
1478 return -EINVAL; 1514 return -EINVAL;
1479 1515
1516 if (!soc_ops.deassert_hardreset)
1517 return -ENOSYS;
1518
1480 ret = _lookup_hardreset(oh, name, &ohri); 1519 ret = _lookup_hardreset(oh, name, &ohri);
1481 if (IS_ERR_VALUE(ret)) 1520 if (IS_ERR_VALUE(ret))
1482 return ret; 1521 return ret;
1483 1522
1484 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 1523 ret = soc_ops.deassert_hardreset(oh, &ohri);
1485 ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
1486 ohri.rst_shift,
1487 ohri.st_shift);
1488 } else if (cpu_is_omap44xx()) {
1489 if (ohri.st_shift)
1490 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
1491 oh->name, name);
1492 ret = omap4_prminst_deassert_hardreset(ohri.rst_shift,
1493 oh->clkdm->pwrdm.ptr->prcm_partition,
1494 oh->clkdm->pwrdm.ptr->prcm_offs,
1495 oh->prcm.omap4.rstctrl_offs);
1496 } else {
1497 return -EINVAL;
1498 }
1499
1500 if (ret == -EBUSY) 1524 if (ret == -EBUSY)
1501 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); 1525 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name);
1502 1526
@@ -1509,31 +1533,28 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1509 * @oh: struct omap_hwmod * 1533 * @oh: struct omap_hwmod *
1510 * @name: name of the reset line to look up and read 1534 * @name: name of the reset line to look up and read
1511 * 1535 *
1512 * Return the state of the reset line. 1536 * Return the state of the reset line. Returns -EINVAL if @oh is
1537 * null, -ENOSYS if we have no way of reading the hardreset line
1538 * status on the currently-booted SoC, or passes along the return
1539 * value from _lookup_hardreset() or the SoC's is_hardreset_asserted
1540 * code.
1513 */ 1541 */
1514static int _read_hardreset(struct omap_hwmod *oh, const char *name) 1542static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1515{ 1543{
1516 struct omap_hwmod_rst_info ohri; 1544 struct omap_hwmod_rst_info ohri;
1517 u8 ret; 1545 u8 ret = -EINVAL;
1518 1546
1519 if (!oh) 1547 if (!oh)
1520 return -EINVAL; 1548 return -EINVAL;
1521 1549
1550 if (!soc_ops.is_hardreset_asserted)
1551 return -ENOSYS;
1552
1522 ret = _lookup_hardreset(oh, name, &ohri); 1553 ret = _lookup_hardreset(oh, name, &ohri);
1523 if (IS_ERR_VALUE(ret)) 1554 if (IS_ERR_VALUE(ret))
1524 return ret; 1555 return ret;
1525 1556
1526 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 1557 return soc_ops.is_hardreset_asserted(oh, &ohri);
1527 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
1528 ohri.st_shift);
1529 } else if (cpu_is_omap44xx()) {
1530 return omap4_prminst_is_hardreset_asserted(ohri.rst_shift,
1531 oh->clkdm->pwrdm.ptr->prcm_partition,
1532 oh->clkdm->pwrdm.ptr->prcm_offs,
1533 oh->prcm.omap4.rstctrl_offs);
1534 } else {
1535 return -EINVAL;
1536 }
1537} 1558}
1538 1559
1539/** 1560/**
@@ -1571,10 +1592,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh)
1571{ 1592{
1572 int v; 1593 int v;
1573 1594
1574 /* The module mode does not exist prior OMAP4 */
1575 if (!cpu_is_omap44xx())
1576 return -EINVAL;
1577
1578 if (!oh->clkdm || !oh->prcm.omap4.modulemode) 1595 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
1579 return -EINVAL; 1596 return -EINVAL;
1580 1597
@@ -1698,11 +1715,17 @@ dis_opt_clks:
1698 * therefore have no OCP header registers to access. Others (like the 1715 * therefore have no OCP header registers to access. Others (like the
1699 * IVA) have idiosyncratic reset sequences. So for these relatively 1716 * IVA) have idiosyncratic reset sequences. So for these relatively
1700 * rare cases, custom reset code can be supplied in the struct 1717 * rare cases, custom reset code can be supplied in the struct
1701 * omap_hwmod_class .reset function pointer. Passes along the return 1718 * omap_hwmod_class .reset function pointer.
1702 * value from either _ocp_softreset() or the custom reset function - 1719 *
1703 * these must return -EINVAL if the hwmod cannot be reset this way or 1720 * _set_dmadisable() is called to set the DMADISABLE bit so that it
1704 * if the hwmod is in the wrong state, -ETIMEDOUT if the module did 1721 * does not prevent idling of the system. This is necessary for cases
1705 * not reset in time, or 0 upon success. 1722 * where ROMCODE/BOOTLOADER uses dma and transfers control to the
1723 * kernel without disabling dma.
1724 *
1725 * Passes along the return value from either _ocp_softreset() or the
1726 * custom reset function - these must return -EINVAL if the hwmod
1727 * cannot be reset this way or if the hwmod is in the wrong state,
1728 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1706 */ 1729 */
1707static int _reset(struct omap_hwmod *oh) 1730static int _reset(struct omap_hwmod *oh)
1708{ 1731{
@@ -1724,6 +1747,8 @@ static int _reset(struct omap_hwmod *oh)
1724 } 1747 }
1725 } 1748 }
1726 1749
1750 _set_dmadisable(oh);
1751
1727 /* 1752 /*
1728 * OCP_SYSCONFIG bits need to be reprogrammed after a 1753 * OCP_SYSCONFIG bits need to be reprogrammed after a
1729 * softreset. The _enable() function should be split to avoid 1754 * softreset. The _enable() function should be split to avoid
@@ -1738,6 +1763,32 @@ static int _reset(struct omap_hwmod *oh)
1738} 1763}
1739 1764
1740/** 1765/**
1766 * _reconfigure_io_chain - clear any I/O chain wakeups and reconfigure chain
1767 *
1768 * Call the appropriate PRM function to clear any logged I/O chain
1769 * wakeups and to reconfigure the chain. This apparently needs to be
1770 * done upon every mux change. Since hwmods can be concurrently
1771 * enabled and idled, hold a spinlock around the I/O chain
1772 * reconfiguration sequence. No return value.
1773 *
1774 * XXX When the PRM code is moved to drivers, this function can be removed,
1775 * as the PRM infrastructure should abstract this.
1776 */
1777static void _reconfigure_io_chain(void)
1778{
1779 unsigned long flags;
1780
1781 spin_lock_irqsave(&io_chain_lock, flags);
1782
1783 if (cpu_is_omap34xx() && omap3_has_io_chain_ctrl())
1784 omap3xxx_prm_reconfigure_io_chain();
1785 else if (cpu_is_omap44xx())
1786 omap44xx_prm_reconfigure_io_chain();
1787
1788 spin_unlock_irqrestore(&io_chain_lock, flags);
1789}
1790
1791/**
1741 * _enable - enable an omap_hwmod 1792 * _enable - enable an omap_hwmod
1742 * @oh: struct omap_hwmod * 1793 * @oh: struct omap_hwmod *
1743 * 1794 *
@@ -1793,8 +1844,10 @@ static int _enable(struct omap_hwmod *oh)
1793 /* Mux pins for device runtime if populated */ 1844 /* Mux pins for device runtime if populated */
1794 if (oh->mux && (!oh->mux->enabled || 1845 if (oh->mux && (!oh->mux->enabled ||
1795 ((oh->_state == _HWMOD_STATE_IDLE) && 1846 ((oh->_state == _HWMOD_STATE_IDLE) &&
1796 oh->mux->pads_dynamic))) 1847 oh->mux->pads_dynamic))) {
1797 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED); 1848 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
1849 _reconfigure_io_chain();
1850 }
1798 1851
1799 _add_initiator_dep(oh, mpu_oh); 1852 _add_initiator_dep(oh, mpu_oh);
1800 1853
@@ -1814,9 +1867,11 @@ static int _enable(struct omap_hwmod *oh)
1814 } 1867 }
1815 1868
1816 _enable_clocks(oh); 1869 _enable_clocks(oh);
1817 _enable_module(oh); 1870 if (soc_ops.enable_module)
1871 soc_ops.enable_module(oh);
1818 1872
1819 r = _wait_target_ready(oh); 1873 r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) :
1874 -EINVAL;
1820 if (!r) { 1875 if (!r) {
1821 /* 1876 /*
1822 * Set the clockdomain to HW_AUTO only if the target is ready, 1877 * Set the clockdomain to HW_AUTO only if the target is ready,
@@ -1870,7 +1925,8 @@ static int _idle(struct omap_hwmod *oh)
1870 _idle_sysc(oh); 1925 _idle_sysc(oh);
1871 _del_initiator_dep(oh, mpu_oh); 1926 _del_initiator_dep(oh, mpu_oh);
1872 1927
1873 _omap4_disable_module(oh); 1928 if (soc_ops.disable_module)
1929 soc_ops.disable_module(oh);
1874 1930
1875 /* 1931 /*
1876 * The module must be in idle mode before disabling any parents 1932 * The module must be in idle mode before disabling any parents
@@ -1883,8 +1939,10 @@ static int _idle(struct omap_hwmod *oh)
1883 clkdm_hwmod_disable(oh->clkdm, oh); 1939 clkdm_hwmod_disable(oh->clkdm, oh);
1884 1940
1885 /* Mux pins for device idle if populated */ 1941 /* Mux pins for device idle if populated */
1886 if (oh->mux && oh->mux->pads_dynamic) 1942 if (oh->mux && oh->mux->pads_dynamic) {
1887 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE); 1943 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
1944 _reconfigure_io_chain();
1945 }
1888 1946
1889 oh->_state = _HWMOD_STATE_IDLE; 1947 oh->_state = _HWMOD_STATE_IDLE;
1890 1948
@@ -1975,7 +2033,8 @@ static int _shutdown(struct omap_hwmod *oh)
1975 if (oh->_state == _HWMOD_STATE_ENABLED) { 2033 if (oh->_state == _HWMOD_STATE_ENABLED) {
1976 _del_initiator_dep(oh, mpu_oh); 2034 _del_initiator_dep(oh, mpu_oh);
1977 /* XXX what about the other system initiators here? dma, dsp */ 2035 /* XXX what about the other system initiators here? dma, dsp */
1978 _omap4_disable_module(oh); 2036 if (soc_ops.disable_module)
2037 soc_ops.disable_module(oh);
1979 _disable_clocks(oh); 2038 _disable_clocks(oh);
1980 if (oh->clkdm) 2039 if (oh->clkdm)
1981 clkdm_hwmod_disable(oh->clkdm, oh); 2040 clkdm_hwmod_disable(oh->clkdm, oh);
@@ -2431,6 +2490,194 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2431 return 0; 2490 return 0;
2432} 2491}
2433 2492
2493/* Static functions intended only for use in soc_ops field function pointers */
2494
2495/**
2496 * _omap2_wait_target_ready - wait for a module to leave slave idle
2497 * @oh: struct omap_hwmod *
2498 *
2499 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2500 * does not have an IDLEST bit or if the module successfully leaves
2501 * slave idle; otherwise, pass along the return value of the
2502 * appropriate *_cm*_wait_module_ready() function.
2503 */
2504static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2505{
2506 if (!oh)
2507 return -EINVAL;
2508
2509 if (oh->flags & HWMOD_NO_IDLEST)
2510 return 0;
2511
2512 if (!_find_mpu_rt_port(oh))
2513 return 0;
2514
2515 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2516
2517 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2518 oh->prcm.omap2.idlest_reg_id,
2519 oh->prcm.omap2.idlest_idle_bit);
2520}
2521
2522/**
2523 * _omap4_wait_target_ready - wait for a module to leave slave idle
2524 * @oh: struct omap_hwmod *
2525 *
2526 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2527 * does not have an IDLEST bit or if the module successfully leaves
2528 * slave idle; otherwise, pass along the return value of the
2529 * appropriate *_cm*_wait_module_ready() function.
2530 */
2531static int _omap4_wait_target_ready(struct omap_hwmod *oh)
2532{
2533 if (!oh || !oh->clkdm)
2534 return -EINVAL;
2535
2536 if (oh->flags & HWMOD_NO_IDLEST)
2537 return 0;
2538
2539 if (!_find_mpu_rt_port(oh))
2540 return 0;
2541
2542 /* XXX check module SIDLEMODE, hardreset status */
2543
2544 return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
2545 oh->clkdm->cm_inst,
2546 oh->clkdm->clkdm_offs,
2547 oh->prcm.omap4.clkctrl_offs);
2548}
2549
2550/**
2551 * _omap2_assert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2552 * @oh: struct omap_hwmod * to assert hardreset
2553 * @ohri: hardreset line data
2554 *
2555 * Call omap2_prm_assert_hardreset() with parameters extracted from
2556 * the hwmod @oh and the hardreset line data @ohri. Only intended for
2557 * use as an soc_ops function pointer. Passes along the return value
2558 * from omap2_prm_assert_hardreset(). XXX This function is scheduled
2559 * for removal when the PRM code is moved into drivers/.
2560 */
2561static int _omap2_assert_hardreset(struct omap_hwmod *oh,
2562 struct omap_hwmod_rst_info *ohri)
2563{
2564 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
2565 ohri->rst_shift);
2566}
2567
2568/**
2569 * _omap2_deassert_hardreset - call OMAP2 PRM hardreset fn with hwmod args
2570 * @oh: struct omap_hwmod * to deassert hardreset
2571 * @ohri: hardreset line data
2572 *
2573 * Call omap2_prm_deassert_hardreset() with parameters extracted from
2574 * the hwmod @oh and the hardreset line data @ohri. Only intended for
2575 * use as an soc_ops function pointer. Passes along the return value
2576 * from omap2_prm_deassert_hardreset(). XXX This function is
2577 * scheduled for removal when the PRM code is moved into drivers/.
2578 */
2579static int _omap2_deassert_hardreset(struct omap_hwmod *oh,
2580 struct omap_hwmod_rst_info *ohri)
2581{
2582 return omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
2583 ohri->rst_shift,
2584 ohri->st_shift);
2585}
2586
2587/**
2588 * _omap2_is_hardreset_asserted - call OMAP2 PRM hardreset fn with hwmod args
2589 * @oh: struct omap_hwmod * to test hardreset
2590 * @ohri: hardreset line data
2591 *
2592 * Call omap2_prm_is_hardreset_asserted() with parameters extracted
2593 * from the hwmod @oh and the hardreset line data @ohri. Only
2594 * intended for use as an soc_ops function pointer. Passes along the
2595 * return value from omap2_prm_is_hardreset_asserted(). XXX This
2596 * function is scheduled for removal when the PRM code is moved into
2597 * drivers/.
2598 */
2599static int _omap2_is_hardreset_asserted(struct omap_hwmod *oh,
2600 struct omap_hwmod_rst_info *ohri)
2601{
2602 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
2603 ohri->st_shift);
2604}
2605
2606/**
2607 * _omap4_assert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2608 * @oh: struct omap_hwmod * to assert hardreset
2609 * @ohri: hardreset line data
2610 *
2611 * Call omap4_prminst_assert_hardreset() with parameters extracted
2612 * from the hwmod @oh and the hardreset line data @ohri. Only
2613 * intended for use as an soc_ops function pointer. Passes along the
2614 * return value from omap4_prminst_assert_hardreset(). XXX This
2615 * function is scheduled for removal when the PRM code is moved into
2616 * drivers/.
2617 */
2618static int _omap4_assert_hardreset(struct omap_hwmod *oh,
2619 struct omap_hwmod_rst_info *ohri)
2620{
2621 if (!oh->clkdm)
2622 return -EINVAL;
2623
2624 return omap4_prminst_assert_hardreset(ohri->rst_shift,
2625 oh->clkdm->pwrdm.ptr->prcm_partition,
2626 oh->clkdm->pwrdm.ptr->prcm_offs,
2627 oh->prcm.omap4.rstctrl_offs);
2628}
2629
2630/**
2631 * _omap4_deassert_hardreset - call OMAP4 PRM hardreset fn with hwmod args
2632 * @oh: struct omap_hwmod * to deassert hardreset
2633 * @ohri: hardreset line data
2634 *
2635 * Call omap4_prminst_deassert_hardreset() with parameters extracted
2636 * from the hwmod @oh and the hardreset line data @ohri. Only
2637 * intended for use as an soc_ops function pointer. Passes along the
2638 * return value from omap4_prminst_deassert_hardreset(). XXX This
2639 * function is scheduled for removal when the PRM code is moved into
2640 * drivers/.
2641 */
2642static int _omap4_deassert_hardreset(struct omap_hwmod *oh,
2643 struct omap_hwmod_rst_info *ohri)
2644{
2645 if (!oh->clkdm)
2646 return -EINVAL;
2647
2648 if (ohri->st_shift)
2649 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
2650 oh->name, ohri->name);
2651 return omap4_prminst_deassert_hardreset(ohri->rst_shift,
2652 oh->clkdm->pwrdm.ptr->prcm_partition,
2653 oh->clkdm->pwrdm.ptr->prcm_offs,
2654 oh->prcm.omap4.rstctrl_offs);
2655}
2656
2657/**
2658 * _omap4_is_hardreset_asserted - call OMAP4 PRM hardreset fn with hwmod args
2659 * @oh: struct omap_hwmod * to test hardreset
2660 * @ohri: hardreset line data
2661 *
2662 * Call omap4_prminst_is_hardreset_asserted() with parameters
2663 * extracted from the hwmod @oh and the hardreset line data @ohri.
2664 * Only intended for use as an soc_ops function pointer. Passes along
2665 * the return value from omap4_prminst_is_hardreset_asserted(). XXX
2666 * This function is scheduled for removal when the PRM code is moved
2667 * into drivers/.
2668 */
2669static int _omap4_is_hardreset_asserted(struct omap_hwmod *oh,
2670 struct omap_hwmod_rst_info *ohri)
2671{
2672 if (!oh->clkdm)
2673 return -EINVAL;
2674
2675 return omap4_prminst_is_hardreset_asserted(ohri->rst_shift,
2676 oh->clkdm->pwrdm.ptr->prcm_partition,
2677 oh->clkdm->pwrdm.ptr->prcm_offs,
2678 oh->prcm.omap4.rstctrl_offs);
2679}
2680
2434/* Public functions */ 2681/* Public functions */
2435 2682
2436u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) 2683u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
@@ -2563,12 +2810,18 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
2563 * 2810 *
2564 * Intended to be called early in boot before the clock framework is 2811 * Intended to be called early in boot before the clock framework is
2565 * initialized. If @ois is not null, will register all omap_hwmods 2812 * initialized. If @ois is not null, will register all omap_hwmods
2566 * listed in @ois that are valid for this chip. Returns 0. 2813 * listed in @ois that are valid for this chip. Returns -EINVAL if
2814 * omap_hwmod_init() hasn't been called before calling this function,
2815 * -ENOMEM if the link memory area can't be allocated, or 0 upon
2816 * success.
2567 */ 2817 */
2568int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois) 2818int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois)
2569{ 2819{
2570 int r, i; 2820 int r, i;
2571 2821
2822 if (!inited)
2823 return -EINVAL;
2824
2572 if (!ois) 2825 if (!ois)
2573 return 0; 2826 return 0;
2574 2827
@@ -3401,3 +3654,47 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3401 3654
3402 return 0; 3655 return 0;
3403} 3656}
3657
3658/**
3659 * omap_hwmod_init - initialize the hwmod code
3660 *
3661 * Sets up some function pointers needed by the hwmod code to operate on the
3662 * currently-booted SoC. Intended to be called once during kernel init
3663 * before any hwmods are registered. No return value.
3664 */
3665void __init omap_hwmod_init(void)
3666{
3667 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
3668 soc_ops.wait_target_ready = _omap2_wait_target_ready;
3669 soc_ops.assert_hardreset = _omap2_assert_hardreset;
3670 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
3671 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
3672 } else if (cpu_is_omap44xx() || soc_is_omap54xx()) {
3673 soc_ops.enable_module = _omap4_enable_module;
3674 soc_ops.disable_module = _omap4_disable_module;
3675 soc_ops.wait_target_ready = _omap4_wait_target_ready;
3676 soc_ops.assert_hardreset = _omap4_assert_hardreset;
3677 soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
3678 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
3679 soc_ops.init_clkdm = _init_clkdm;
3680 } else {
3681 WARN(1, "omap_hwmod: unknown SoC type\n");
3682 }
3683
3684 inited = true;
3685}
3686
3687/**
3688 * omap_hwmod_get_main_clk - get pointer to main clock name
3689 * @oh: struct omap_hwmod *
3690 *
3691 * Returns the main clock name assocated with @oh upon success,
3692 * or NULL if @oh is NULL.
3693 */
3694const char *omap_hwmod_get_main_clk(struct omap_hwmod *oh)
3695{
3696 if (!oh)
3697 return NULL;
3698
3699 return oh->main_clk;
3700}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a7640d1b215e..50cfab61b0e2 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -192,6 +192,11 @@ static struct omap_hwmod_class omap2420_mcbsp_hwmod_class = {
192 .name = "mcbsp", 192 .name = "mcbsp",
193}; 193};
194 194
195static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
196 { .role = "pad_fck", .clk = "mcbsp_clks" },
197 { .role = "prcm_fck", .clk = "func_96m_ck" },
198};
199
195/* mcbsp1 */ 200/* mcbsp1 */
196static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = { 201static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = {
197 { .name = "tx", .irq = 59 }, 202 { .name = "tx", .irq = 59 },
@@ -214,6 +219,8 @@ static struct omap_hwmod omap2420_mcbsp1_hwmod = {
214 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT, 219 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT,
215 }, 220 },
216 }, 221 },
222 .opt_clks = mcbsp_opt_clks,
223 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
217}; 224};
218 225
219/* mcbsp2 */ 226/* mcbsp2 */
@@ -238,6 +245,8 @@ static struct omap_hwmod omap2420_mcbsp2_hwmod = {
238 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT, 245 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT,
239 }, 246 },
240 }, 247 },
248 .opt_clks = mcbsp_opt_clks,
249 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
241}; 250};
242 251
243static struct omap_hwmod_class_sysconfig omap2420_msdi_sysc = { 252static struct omap_hwmod_class_sysconfig omap2420_msdi_sysc = {
@@ -585,5 +594,6 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
585 594
586int __init omap2420_hwmod_init(void) 595int __init omap2420_hwmod_init(void)
587{ 596{
597 omap_hwmod_init();
588 return omap_hwmod_register_links(omap2420_hwmod_ocp_ifs); 598 return omap_hwmod_register_links(omap2420_hwmod_ocp_ifs);
589} 599}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4d7264981230..58b5bc196d32 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -296,6 +296,11 @@ static struct omap_hwmod_class omap2430_mcbsp_hwmod_class = {
296 .rev = MCBSP_CONFIG_TYPE2, 296 .rev = MCBSP_CONFIG_TYPE2,
297}; 297};
298 298
299static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
300 { .role = "pad_fck", .clk = "mcbsp_clks" },
301 { .role = "prcm_fck", .clk = "func_96m_ck" },
302};
303
299/* mcbsp1 */ 304/* mcbsp1 */
300static struct omap_hwmod_irq_info omap2430_mcbsp1_irqs[] = { 305static struct omap_hwmod_irq_info omap2430_mcbsp1_irqs[] = {
301 { .name = "tx", .irq = 59 }, 306 { .name = "tx", .irq = 59 },
@@ -320,6 +325,8 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
320 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT, 325 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT,
321 }, 326 },
322 }, 327 },
328 .opt_clks = mcbsp_opt_clks,
329 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
323}; 330};
324 331
325/* mcbsp2 */ 332/* mcbsp2 */
@@ -345,6 +352,8 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
345 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT, 352 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT,
346 }, 353 },
347 }, 354 },
355 .opt_clks = mcbsp_opt_clks,
356 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
348}; 357};
349 358
350/* mcbsp3 */ 359/* mcbsp3 */
@@ -370,6 +379,8 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
370 .idlest_idle_bit = OMAP2430_ST_MCBSP3_SHIFT, 379 .idlest_idle_bit = OMAP2430_ST_MCBSP3_SHIFT,
371 }, 380 },
372 }, 381 },
382 .opt_clks = mcbsp_opt_clks,
383 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
373}; 384};
374 385
375/* mcbsp4 */ 386/* mcbsp4 */
@@ -401,6 +412,8 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
401 .idlest_idle_bit = OMAP2430_ST_MCBSP4_SHIFT, 412 .idlest_idle_bit = OMAP2430_ST_MCBSP4_SHIFT,
402 }, 413 },
403 }, 414 },
415 .opt_clks = mcbsp_opt_clks,
416 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
404}; 417};
405 418
406/* mcbsp5 */ 419/* mcbsp5 */
@@ -432,6 +445,8 @@ static struct omap_hwmod omap2430_mcbsp5_hwmod = {
432 .idlest_idle_bit = OMAP2430_ST_MCBSP5_SHIFT, 445 .idlest_idle_bit = OMAP2430_ST_MCBSP5_SHIFT,
433 }, 446 },
434 }, 447 },
448 .opt_clks = mcbsp_opt_clks,
449 .opt_clks_cnt = ARRAY_SIZE(mcbsp_opt_clks),
435}; 450};
436 451
437/* MMC/SD/SDIO common */ 452/* MMC/SD/SDIO common */
@@ -938,5 +953,6 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
938 953
939int __init omap2430_hwmod_init(void) 954int __init omap2430_hwmod_init(void)
940{ 955{
956 omap_hwmod_init();
941 return omap_hwmod_register_links(omap2430_hwmod_ocp_ifs); 957 return omap_hwmod_register_links(omap2430_hwmod_ocp_ifs);
942} 958}
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 83eafd96ecaa..afad69c6ba6e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -68,7 +68,6 @@ static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = {
68struct omap_hwmod_class omap2xxx_timer_hwmod_class = { 68struct omap_hwmod_class omap2xxx_timer_hwmod_class = {
69 .name = "timer", 69 .name = "timer",
70 .sysc = &omap2xxx_timer_sysc, 70 .sysc = &omap2xxx_timer_sysc,
71 .rev = OMAP_TIMER_IP_VERSION_1,
72}; 71};
73 72
74/* 73/*
@@ -257,7 +256,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
257 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 256 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
258 }, 257 },
259 }, 258 },
260 .dev_attr = &capability_alwon_dev_attr,
261 .class = &omap2xxx_timer_hwmod_class, 259 .class = &omap2xxx_timer_hwmod_class,
262}; 260};
263 261
@@ -276,7 +274,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
276 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 274 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
277 }, 275 },
278 }, 276 },
279 .dev_attr = &capability_alwon_dev_attr,
280 .class = &omap2xxx_timer_hwmod_class, 277 .class = &omap2xxx_timer_hwmod_class,
281}; 278};
282 279
@@ -295,7 +292,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
295 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 292 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
296 }, 293 },
297 }, 294 },
298 .dev_attr = &capability_alwon_dev_attr,
299 .class = &omap2xxx_timer_hwmod_class, 295 .class = &omap2xxx_timer_hwmod_class,
300}; 296};
301 297
@@ -314,7 +310,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
314 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 310 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
315 }, 311 },
316 }, 312 },
317 .dev_attr = &capability_alwon_dev_attr,
318 .class = &omap2xxx_timer_hwmod_class, 313 .class = &omap2xxx_timer_hwmod_class,
319}; 314};
320 315
@@ -333,7 +328,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
333 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 328 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
334 }, 329 },
335 }, 330 },
336 .dev_attr = &capability_alwon_dev_attr,
337 .class = &omap2xxx_timer_hwmod_class, 331 .class = &omap2xxx_timer_hwmod_class,
338}; 332};
339 333
@@ -352,7 +346,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
352 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 346 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
353 }, 347 },
354 }, 348 },
355 .dev_attr = &capability_alwon_dev_attr,
356 .class = &omap2xxx_timer_hwmod_class, 349 .class = &omap2xxx_timer_hwmod_class,
357}; 350};
358 351
@@ -371,7 +364,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
371 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 364 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
372 }, 365 },
373 }, 366 },
374 .dev_attr = &capability_alwon_dev_attr,
375 .class = &omap2xxx_timer_hwmod_class, 367 .class = &omap2xxx_timer_hwmod_class,
376}; 368};
377 369
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index b26d3c9bca16..c9e38200216b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -14,6 +14,8 @@
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#include <linux/power/smartreflex.h>
18
17#include <plat/omap_hwmod.h> 19#include <plat/omap_hwmod.h>
18#include <mach/irqs.h> 20#include <mach/irqs.h>
19#include <plat/cpu.h> 21#include <plat/cpu.h>
@@ -29,8 +31,6 @@
29#include <plat/dmtimer.h> 31#include <plat/dmtimer.h>
30 32
31#include "omap_hwmod_common_data.h" 33#include "omap_hwmod_common_data.h"
32
33#include "smartreflex.h"
34#include "prm-regbits-34xx.h" 34#include "prm-regbits-34xx.h"
35#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
36#include "wd_timer.h" 36#include "wd_timer.h"
@@ -129,7 +129,6 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_1ms_sysc = {
129static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = { 129static struct omap_hwmod_class omap3xxx_timer_1ms_hwmod_class = {
130 .name = "timer", 130 .name = "timer",
131 .sysc = &omap3xxx_timer_1ms_sysc, 131 .sysc = &omap3xxx_timer_1ms_sysc,
132 .rev = OMAP_TIMER_IP_VERSION_1,
133}; 132};
134 133
135static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = { 134static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
@@ -145,12 +144,11 @@ static struct omap_hwmod_class_sysconfig omap3xxx_timer_sysc = {
145static struct omap_hwmod_class omap3xxx_timer_hwmod_class = { 144static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
146 .name = "timer", 145 .name = "timer",
147 .sysc = &omap3xxx_timer_sysc, 146 .sysc = &omap3xxx_timer_sysc,
148 .rev = OMAP_TIMER_IP_VERSION_1,
149}; 147};
150 148
151/* secure timers dev attribute */ 149/* secure timers dev attribute */
152static struct omap_timer_capability_dev_attr capability_secure_dev_attr = { 150static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
153 .timer_capability = OMAP_TIMER_SECURE, 151 .timer_capability = OMAP_TIMER_ALWON | OMAP_TIMER_SECURE,
154}; 152};
155 153
156/* always-on timers dev attribute */ 154/* always-on timers dev attribute */
@@ -195,7 +193,6 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
195 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, 193 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
196 }, 194 },
197 }, 195 },
198 .dev_attr = &capability_alwon_dev_attr,
199 .class = &omap3xxx_timer_1ms_hwmod_class, 196 .class = &omap3xxx_timer_1ms_hwmod_class,
200}; 197};
201 198
@@ -213,7 +210,6 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
213 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT, 210 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
214 }, 211 },
215 }, 212 },
216 .dev_attr = &capability_alwon_dev_attr,
217 .class = &omap3xxx_timer_hwmod_class, 213 .class = &omap3xxx_timer_hwmod_class,
218}; 214};
219 215
@@ -231,7 +227,6 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
231 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT, 227 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
232 }, 228 },
233 }, 229 },
234 .dev_attr = &capability_alwon_dev_attr,
235 .class = &omap3xxx_timer_hwmod_class, 230 .class = &omap3xxx_timer_hwmod_class,
236}; 231};
237 232
@@ -249,7 +244,6 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
249 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT, 244 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
250 }, 245 },
251 }, 246 },
252 .dev_attr = &capability_alwon_dev_attr,
253 .class = &omap3xxx_timer_hwmod_class, 247 .class = &omap3xxx_timer_hwmod_class,
254}; 248};
255 249
@@ -267,7 +261,6 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
267 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT, 261 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
268 }, 262 },
269 }, 263 },
270 .dev_attr = &capability_alwon_dev_attr,
271 .class = &omap3xxx_timer_hwmod_class, 264 .class = &omap3xxx_timer_hwmod_class,
272}; 265};
273 266
@@ -285,7 +278,6 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
285 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT, 278 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
286 }, 279 },
287 }, 280 },
288 .dev_attr = &capability_alwon_dev_attr,
289 .class = &omap3xxx_timer_hwmod_class, 281 .class = &omap3xxx_timer_hwmod_class,
290}; 282};
291 283
@@ -527,11 +519,27 @@ static struct omap_hwmod omap36xx_uart4_hwmod = {
527 519
528static struct omap_hwmod_irq_info am35xx_uart4_mpu_irqs[] = { 520static struct omap_hwmod_irq_info am35xx_uart4_mpu_irqs[] = {
529 { .irq = INT_35XX_UART4_IRQ, }, 521 { .irq = INT_35XX_UART4_IRQ, },
522 { .irq = -1 }
530}; 523};
531 524
532static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = { 525static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = {
533 { .name = "rx", .dma_req = AM35XX_DMA_UART4_RX, }, 526 { .name = "rx", .dma_req = AM35XX_DMA_UART4_RX, },
534 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, }, 527 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, },
528 { .dma_req = -1 }
529};
530
531/*
532 * XXX AM35xx UART4 cannot complete its softreset without uart1_fck or
533 * uart2_fck being enabled. So we add uart1_fck as an optional clock,
534 * below, and set the HWMOD_CONTROL_OPT_CLKS_IN_RESET. This really
535 * should not be needed. The functional clock structure of the AM35xx
536 * UART4 is extremely unclear and opaque; it is unclear what the role
537 * of uart1/2_fck is for the UART4. Any clarification from either
538 * empirical testing or the AM3505/3517 hardware designers would be
539 * most welcome.
540 */
541static struct omap_hwmod_opt_clk am35xx_uart4_opt_clks[] = {
542 { .role = "softreset_uart1_fck", .clk = "uart1_fck" },
535}; 543};
536 544
537static struct omap_hwmod am35xx_uart4_hwmod = { 545static struct omap_hwmod am35xx_uart4_hwmod = {
@@ -543,11 +551,14 @@ static struct omap_hwmod am35xx_uart4_hwmod = {
543 .omap2 = { 551 .omap2 = {
544 .module_offs = CORE_MOD, 552 .module_offs = CORE_MOD,
545 .prcm_reg_id = 1, 553 .prcm_reg_id = 1,
546 .module_bit = OMAP3430_EN_UART4_SHIFT, 554 .module_bit = AM35XX_EN_UART4_SHIFT,
547 .idlest_reg_id = 1, 555 .idlest_reg_id = 1,
548 .idlest_idle_bit = OMAP3430_EN_UART4_SHIFT, 556 .idlest_idle_bit = AM35XX_ST_UART4_SHIFT,
549 }, 557 },
550 }, 558 },
559 .opt_clks = am35xx_uart4_opt_clks,
560 .opt_clks_cnt = ARRAY_SIZE(am35xx_uart4_opt_clks),
561 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
551 .class = &omap2_uart_class, 562 .class = &omap2_uart_class,
552}; 563};
553 564
@@ -1074,6 +1085,17 @@ static struct omap_hwmod_class omap3xxx_mcbsp_hwmod_class = {
1074 .rev = MCBSP_CONFIG_TYPE3, 1085 .rev = MCBSP_CONFIG_TYPE3,
1075}; 1086};
1076 1087
1088/* McBSP functional clock mapping */
1089static struct omap_hwmod_opt_clk mcbsp15_opt_clks[] = {
1090 { .role = "pad_fck", .clk = "mcbsp_clks" },
1091 { .role = "prcm_fck", .clk = "core_96m_fck" },
1092};
1093
1094static struct omap_hwmod_opt_clk mcbsp234_opt_clks[] = {
1095 { .role = "pad_fck", .clk = "mcbsp_clks" },
1096 { .role = "prcm_fck", .clk = "per_96m_fck" },
1097};
1098
1077/* mcbsp1 */ 1099/* mcbsp1 */
1078static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = { 1100static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = {
1079 { .name = "common", .irq = 16 }, 1101 { .name = "common", .irq = 16 },
@@ -1097,6 +1119,8 @@ static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
1097 .idlest_idle_bit = OMAP3430_ST_MCBSP1_SHIFT, 1119 .idlest_idle_bit = OMAP3430_ST_MCBSP1_SHIFT,
1098 }, 1120 },
1099 }, 1121 },
1122 .opt_clks = mcbsp15_opt_clks,
1123 .opt_clks_cnt = ARRAY_SIZE(mcbsp15_opt_clks),
1100}; 1124};
1101 1125
1102/* mcbsp2 */ 1126/* mcbsp2 */
@@ -1126,6 +1150,8 @@ static struct omap_hwmod omap3xxx_mcbsp2_hwmod = {
1126 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT, 1150 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT,
1127 }, 1151 },
1128 }, 1152 },
1153 .opt_clks = mcbsp234_opt_clks,
1154 .opt_clks_cnt = ARRAY_SIZE(mcbsp234_opt_clks),
1129 .dev_attr = &omap34xx_mcbsp2_dev_attr, 1155 .dev_attr = &omap34xx_mcbsp2_dev_attr,
1130}; 1156};
1131 1157
@@ -1156,6 +1182,8 @@ static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
1156 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT, 1182 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT,
1157 }, 1183 },
1158 }, 1184 },
1185 .opt_clks = mcbsp234_opt_clks,
1186 .opt_clks_cnt = ARRAY_SIZE(mcbsp234_opt_clks),
1159 .dev_attr = &omap34xx_mcbsp3_dev_attr, 1187 .dev_attr = &omap34xx_mcbsp3_dev_attr,
1160}; 1188};
1161 1189
@@ -1188,6 +1216,8 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
1188 .idlest_idle_bit = OMAP3430_ST_MCBSP4_SHIFT, 1216 .idlest_idle_bit = OMAP3430_ST_MCBSP4_SHIFT,
1189 }, 1217 },
1190 }, 1218 },
1219 .opt_clks = mcbsp234_opt_clks,
1220 .opt_clks_cnt = ARRAY_SIZE(mcbsp234_opt_clks),
1191}; 1221};
1192 1222
1193/* mcbsp5 */ 1223/* mcbsp5 */
@@ -1219,6 +1249,8 @@ static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
1219 .idlest_idle_bit = OMAP3430_ST_MCBSP5_SHIFT, 1249 .idlest_idle_bit = OMAP3430_ST_MCBSP5_SHIFT,
1220 }, 1250 },
1221 }, 1251 },
1252 .opt_clks = mcbsp15_opt_clks,
1253 .opt_clks_cnt = ARRAY_SIZE(mcbsp15_opt_clks),
1222}; 1254};
1223 1255
1224/* 'mcbsp sidetone' class */ 1256/* 'mcbsp sidetone' class */
@@ -1325,7 +1357,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
1325}; 1357};
1326 1358
1327static struct omap_hwmod omap34xx_sr1_hwmod = { 1359static struct omap_hwmod omap34xx_sr1_hwmod = {
1328 .name = "sr1", 1360 .name = "smartreflex_mpu_iva",
1329 .class = &omap34xx_smartreflex_hwmod_class, 1361 .class = &omap34xx_smartreflex_hwmod_class,
1330 .main_clk = "sr1_fck", 1362 .main_clk = "sr1_fck",
1331 .prcm = { 1363 .prcm = {
@@ -1343,7 +1375,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
1343}; 1375};
1344 1376
1345static struct omap_hwmod omap36xx_sr1_hwmod = { 1377static struct omap_hwmod omap36xx_sr1_hwmod = {
1346 .name = "sr1", 1378 .name = "smartreflex_mpu_iva",
1347 .class = &omap36xx_smartreflex_hwmod_class, 1379 .class = &omap36xx_smartreflex_hwmod_class,
1348 .main_clk = "sr1_fck", 1380 .main_clk = "sr1_fck",
1349 .prcm = { 1381 .prcm = {
@@ -1370,7 +1402,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
1370}; 1402};
1371 1403
1372static struct omap_hwmod omap34xx_sr2_hwmod = { 1404static struct omap_hwmod omap34xx_sr2_hwmod = {
1373 .name = "sr2", 1405 .name = "smartreflex_core",
1374 .class = &omap34xx_smartreflex_hwmod_class, 1406 .class = &omap34xx_smartreflex_hwmod_class,
1375 .main_clk = "sr2_fck", 1407 .main_clk = "sr2_fck",
1376 .prcm = { 1408 .prcm = {
@@ -1388,7 +1420,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
1388}; 1420};
1389 1421
1390static struct omap_hwmod omap36xx_sr2_hwmod = { 1422static struct omap_hwmod omap36xx_sr2_hwmod = {
1391 .name = "sr2", 1423 .name = "smartreflex_core",
1392 .class = &omap36xx_smartreflex_hwmod_class, 1424 .class = &omap36xx_smartreflex_hwmod_class,
1393 .main_clk = "sr2_fck", 1425 .main_clk = "sr2_fck",
1394 .prcm = { 1426 .prcm = {
@@ -1638,25 +1670,20 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
1638 1670
1639/* usb_otg_hs */ 1671/* usb_otg_hs */
1640static struct omap_hwmod_irq_info am35xx_usbhsotg_mpu_irqs[] = { 1672static struct omap_hwmod_irq_info am35xx_usbhsotg_mpu_irqs[] = {
1641
1642 { .name = "mc", .irq = 71 }, 1673 { .name = "mc", .irq = 71 },
1643 { .irq = -1 } 1674 { .irq = -1 }
1644}; 1675};
1645 1676
1646static struct omap_hwmod_class am35xx_usbotg_class = { 1677static struct omap_hwmod_class am35xx_usbotg_class = {
1647 .name = "am35xx_usbotg", 1678 .name = "am35xx_usbotg",
1648 .sysc = NULL,
1649}; 1679};
1650 1680
1651static struct omap_hwmod am35xx_usbhsotg_hwmod = { 1681static struct omap_hwmod am35xx_usbhsotg_hwmod = {
1652 .name = "am35x_otg_hs", 1682 .name = "am35x_otg_hs",
1653 .mpu_irqs = am35xx_usbhsotg_mpu_irqs, 1683 .mpu_irqs = am35xx_usbhsotg_mpu_irqs,
1654 .main_clk = NULL, 1684 .main_clk = "hsotgusb_fck",
1655 .prcm = {
1656 .omap2 = {
1657 },
1658 },
1659 .class = &am35xx_usbotg_class, 1685 .class = &am35xx_usbotg_class,
1686 .flags = HWMOD_NO_IDLEST,
1660}; 1687};
1661 1688
1662/* MMC/SD/SDIO common */ 1689/* MMC/SD/SDIO common */
@@ -2097,9 +2124,10 @@ static struct omap_hwmod_ocp_if omap3xxx_usbhsotg__l3 = {
2097static struct omap_hwmod_ocp_if am35xx_usbhsotg__l3 = { 2124static struct omap_hwmod_ocp_if am35xx_usbhsotg__l3 = {
2098 .master = &am35xx_usbhsotg_hwmod, 2125 .master = &am35xx_usbhsotg_hwmod,
2099 .slave = &omap3xxx_l3_main_hwmod, 2126 .slave = &omap3xxx_l3_main_hwmod,
2100 .clk = "core_l3_ick", 2127 .clk = "hsotgusb_ick",
2101 .user = OCP_USER_MPU, 2128 .user = OCP_USER_MPU,
2102}; 2129};
2130
2103/* L4_CORE -> L4_WKUP interface */ 2131/* L4_CORE -> L4_WKUP interface */
2104static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { 2132static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
2105 .master = &omap3xxx_l4_core_hwmod, 2133 .master = &omap3xxx_l4_core_hwmod,
@@ -2243,6 +2271,7 @@ static struct omap_hwmod_addr_space am35xx_uart4_addr_space[] = {
2243 .pa_end = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1, 2271 .pa_end = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1,
2244 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT, 2272 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2245 }, 2273 },
2274 { }
2246}; 2275};
2247 2276
2248static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = { 2277static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = {
@@ -2393,7 +2422,7 @@ static struct omap_hwmod_addr_space am35xx_usbhsotg_addrs[] = {
2393static struct omap_hwmod_ocp_if am35xx_l4_core__usbhsotg = { 2422static struct omap_hwmod_ocp_if am35xx_l4_core__usbhsotg = {
2394 .master = &omap3xxx_l4_core_hwmod, 2423 .master = &omap3xxx_l4_core_hwmod,
2395 .slave = &am35xx_usbhsotg_hwmod, 2424 .slave = &am35xx_usbhsotg_hwmod,
2396 .clk = "l4_ick", 2425 .clk = "hsotgusb_ick",
2397 .addr = am35xx_usbhsotg_addrs, 2426 .addr = am35xx_usbhsotg_addrs,
2398 .user = OCP_USER_MPU, 2427 .user = OCP_USER_MPU,
2399}; 2428};
@@ -3138,6 +3167,107 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = {
3138 .user = OCP_USER_MPU | OCP_USER_SDMA, 3167 .user = OCP_USER_MPU | OCP_USER_SDMA,
3139}; 3168};
3140 3169
3170/* am35xx has Davinci MDIO & EMAC */
3171static struct omap_hwmod_class am35xx_mdio_class = {
3172 .name = "davinci_mdio",
3173};
3174
3175static struct omap_hwmod am35xx_mdio_hwmod = {
3176 .name = "davinci_mdio",
3177 .class = &am35xx_mdio_class,
3178 .flags = HWMOD_NO_IDLEST,
3179};
3180
3181/*
3182 * XXX Should be connected to an IPSS hwmod, not the L3 directly;
3183 * but this will probably require some additional hwmod core support,
3184 * so is left as a future to-do item.
3185 */
3186static struct omap_hwmod_ocp_if am35xx_mdio__l3 = {
3187 .master = &am35xx_mdio_hwmod,
3188 .slave = &omap3xxx_l3_main_hwmod,
3189 .clk = "emac_fck",
3190 .user = OCP_USER_MPU,
3191};
3192
3193static struct omap_hwmod_addr_space am35xx_mdio_addrs[] = {
3194 {
3195 .pa_start = AM35XX_IPSS_MDIO_BASE,
3196 .pa_end = AM35XX_IPSS_MDIO_BASE + SZ_4K - 1,
3197 .flags = ADDR_TYPE_RT,
3198 },
3199 { }
3200};
3201
3202/* l4_core -> davinci mdio */
3203/*
3204 * XXX Should be connected to an IPSS hwmod, not the L4_CORE directly;
3205 * but this will probably require some additional hwmod core support,
3206 * so is left as a future to-do item.
3207 */
3208static struct omap_hwmod_ocp_if am35xx_l4_core__mdio = {
3209 .master = &omap3xxx_l4_core_hwmod,
3210 .slave = &am35xx_mdio_hwmod,
3211 .clk = "emac_fck",
3212 .addr = am35xx_mdio_addrs,
3213 .user = OCP_USER_MPU,
3214};
3215
3216static struct omap_hwmod_irq_info am35xx_emac_mpu_irqs[] = {
3217 { .name = "rxthresh", .irq = INT_35XX_EMAC_C0_RXTHRESH_IRQ },
3218 { .name = "rx_pulse", .irq = INT_35XX_EMAC_C0_RX_PULSE_IRQ },
3219 { .name = "tx_pulse", .irq = INT_35XX_EMAC_C0_TX_PULSE_IRQ },
3220 { .name = "misc_pulse", .irq = INT_35XX_EMAC_C0_MISC_PULSE_IRQ },
3221 { .irq = -1 }
3222};
3223
3224static struct omap_hwmod_class am35xx_emac_class = {
3225 .name = "davinci_emac",
3226};
3227
3228static struct omap_hwmod am35xx_emac_hwmod = {
3229 .name = "davinci_emac",
3230 .mpu_irqs = am35xx_emac_mpu_irqs,
3231 .class = &am35xx_emac_class,
3232 .flags = HWMOD_NO_IDLEST,
3233};
3234
3235/* l3_core -> davinci emac interface */
3236/*
3237 * XXX Should be connected to an IPSS hwmod, not the L3 directly;
3238 * but this will probably require some additional hwmod core support,
3239 * so is left as a future to-do item.
3240 */
3241static struct omap_hwmod_ocp_if am35xx_emac__l3 = {
3242 .master = &am35xx_emac_hwmod,
3243 .slave = &omap3xxx_l3_main_hwmod,
3244 .clk = "emac_ick",
3245 .user = OCP_USER_MPU,
3246};
3247
3248static struct omap_hwmod_addr_space am35xx_emac_addrs[] = {
3249 {
3250 .pa_start = AM35XX_IPSS_EMAC_BASE,
3251 .pa_end = AM35XX_IPSS_EMAC_BASE + 0x30000 - 1,
3252 .flags = ADDR_TYPE_RT,
3253 },
3254 { }
3255};
3256
3257/* l4_core -> davinci emac */
3258/*
3259 * XXX Should be connected to an IPSS hwmod, not the L4_CORE directly;
3260 * but this will probably require some additional hwmod core support,
3261 * so is left as a future to-do item.
3262 */
3263static struct omap_hwmod_ocp_if am35xx_l4_core__emac = {
3264 .master = &omap3xxx_l4_core_hwmod,
3265 .slave = &am35xx_emac_hwmod,
3266 .clk = "emac_ick",
3267 .addr = am35xx_emac_addrs,
3268 .user = OCP_USER_MPU,
3269};
3270
3141static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3271static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3142 &omap3xxx_l3_main__l4_core, 3272 &omap3xxx_l3_main__l4_core,
3143 &omap3xxx_l3_main__l4_per, 3273 &omap3xxx_l3_main__l4_per,
@@ -3266,6 +3396,10 @@ static struct omap_hwmod_ocp_if *am35xx_hwmod_ocp_ifs[] __initdata = {
3266 &omap3xxx_l4_core__usb_tll_hs, 3396 &omap3xxx_l4_core__usb_tll_hs,
3267 &omap3xxx_l4_core__es3plus_mmc1, 3397 &omap3xxx_l4_core__es3plus_mmc1,
3268 &omap3xxx_l4_core__es3plus_mmc2, 3398 &omap3xxx_l4_core__es3plus_mmc2,
3399 &am35xx_mdio__l3,
3400 &am35xx_l4_core__mdio,
3401 &am35xx_emac__l3,
3402 &am35xx_l4_core__emac,
3269 NULL 3403 NULL
3270}; 3404};
3271 3405
@@ -3283,6 +3417,8 @@ int __init omap3xxx_hwmod_init(void)
3283 struct omap_hwmod_ocp_if **h = NULL; 3417 struct omap_hwmod_ocp_if **h = NULL;
3284 unsigned int rev; 3418 unsigned int rev;
3285 3419
3420 omap_hwmod_init();
3421
3286 /* Register hwmod links common to all OMAP3 */ 3422 /* Register hwmod links common to all OMAP3 */
3287 r = omap_hwmod_register_links(omap3xxx_hwmod_ocp_ifs); 3423 r = omap_hwmod_register_links(omap3xxx_hwmod_ocp_ifs);
3288 if (r < 0) 3424 if (r < 0)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 950454a3fa31..242aee498ceb 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/power/smartreflex.h>
22 23
23#include <plat/omap_hwmod.h> 24#include <plat/omap_hwmod.h>
24#include <plat/cpu.h> 25#include <plat/cpu.h>
@@ -32,8 +33,6 @@
32#include <plat/common.h> 33#include <plat/common.h>
33 34
34#include "omap_hwmod_common_data.h" 35#include "omap_hwmod_common_data.h"
35
36#include "smartreflex.h"
37#include "cm1_44xx.h" 36#include "cm1_44xx.h"
38#include "cm2_44xx.h" 37#include "cm2_44xx.h"
39#include "prm44xx.h" 38#include "prm44xx.h"
@@ -393,8 +392,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_counter_sysc = {
393 .rev_offs = 0x0000, 392 .rev_offs = 0x0000,
394 .sysc_offs = 0x0004, 393 .sysc_offs = 0x0004,
395 .sysc_flags = SYSC_HAS_SIDLEMODE, 394 .sysc_flags = SYSC_HAS_SIDLEMODE,
396 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 395 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
397 SIDLE_SMART_WKUP),
398 .sysc_fields = &omap_hwmod_sysc_type1, 396 .sysc_fields = &omap_hwmod_sysc_type1,
399}; 397};
400 398
@@ -854,6 +852,11 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
854 .name = "dss_hdmi", 852 .name = "dss_hdmi",
855 .class = &omap44xx_hdmi_hwmod_class, 853 .class = &omap44xx_hdmi_hwmod_class,
856 .clkdm_name = "l3_dss_clkdm", 854 .clkdm_name = "l3_dss_clkdm",
855 /*
856 * HDMI audio requires to use no-idle mode. Hence,
857 * set idle mode by software.
858 */
859 .flags = HWMOD_SWSUP_SIDLE,
857 .mpu_irqs = omap44xx_dss_hdmi_irqs, 860 .mpu_irqs = omap44xx_dss_hdmi_irqs,
858 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, 861 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs,
859 .main_clk = "dss_48mhz_clk", 862 .main_clk = "dss_48mhz_clk",
@@ -1924,7 +1927,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp1_sdma_reqs[] = {
1924 1927
1925static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = { 1928static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
1926 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1929 { .role = "pad_fck", .clk = "pad_clks_ck" },
1927 { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" }, 1930 { .role = "prcm_fck", .clk = "mcbsp1_sync_mux_ck" },
1928}; 1931};
1929 1932
1930static struct omap_hwmod omap44xx_mcbsp1_hwmod = { 1933static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
@@ -1959,7 +1962,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp2_sdma_reqs[] = {
1959 1962
1960static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = { 1963static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
1961 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1964 { .role = "pad_fck", .clk = "pad_clks_ck" },
1962 { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" }, 1965 { .role = "prcm_fck", .clk = "mcbsp2_sync_mux_ck" },
1963}; 1966};
1964 1967
1965static struct omap_hwmod omap44xx_mcbsp2_hwmod = { 1968static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
@@ -1994,7 +1997,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp3_sdma_reqs[] = {
1994 1997
1995static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = { 1998static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
1996 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1999 { .role = "pad_fck", .clk = "pad_clks_ck" },
1997 { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" }, 2000 { .role = "prcm_fck", .clk = "mcbsp3_sync_mux_ck" },
1998}; 2001};
1999 2002
2000static struct omap_hwmod omap44xx_mcbsp3_hwmod = { 2003static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
@@ -2029,7 +2032,7 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp4_sdma_reqs[] = {
2029 2032
2030static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = { 2033static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = {
2031 { .role = "pad_fck", .clk = "pad_clks_ck" }, 2034 { .role = "pad_fck", .clk = "pad_clks_ck" },
2032 { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" }, 2035 { .role = "prcm_fck", .clk = "mcbsp4_sync_mux_ck" },
2033}; 2036};
2034 2037
2035static struct omap_hwmod omap44xx_mcbsp4_hwmod = { 2038static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
@@ -2540,14 +2543,12 @@ static struct omap_hwmod omap44xx_prcm_mpu_hwmod = {
2540static struct omap_hwmod omap44xx_cm_core_aon_hwmod = { 2543static struct omap_hwmod omap44xx_cm_core_aon_hwmod = {
2541 .name = "cm_core_aon", 2544 .name = "cm_core_aon",
2542 .class = &omap44xx_prcm_hwmod_class, 2545 .class = &omap44xx_prcm_hwmod_class,
2543 .clkdm_name = "cm_clkdm",
2544}; 2546};
2545 2547
2546/* cm_core */ 2548/* cm_core */
2547static struct omap_hwmod omap44xx_cm_core_hwmod = { 2549static struct omap_hwmod omap44xx_cm_core_hwmod = {
2548 .name = "cm_core", 2550 .name = "cm_core",
2549 .class = &omap44xx_prcm_hwmod_class, 2551 .class = &omap44xx_prcm_hwmod_class,
2550 .clkdm_name = "cm_clkdm",
2551}; 2552};
2552 2553
2553/* prm */ 2554/* prm */
@@ -2564,7 +2565,6 @@ static struct omap_hwmod_rst_info omap44xx_prm_resets[] = {
2564static struct omap_hwmod omap44xx_prm_hwmod = { 2565static struct omap_hwmod omap44xx_prm_hwmod = {
2565 .name = "prm", 2566 .name = "prm",
2566 .class = &omap44xx_prcm_hwmod_class, 2567 .class = &omap44xx_prcm_hwmod_class,
2567 .clkdm_name = "prm_clkdm",
2568 .mpu_irqs = omap44xx_prm_irqs, 2568 .mpu_irqs = omap44xx_prm_irqs,
2569 .rst_lines = omap44xx_prm_resets, 2569 .rst_lines = omap44xx_prm_resets,
2570 .rst_lines_cnt = ARRAY_SIZE(omap44xx_prm_resets), 2570 .rst_lines_cnt = ARRAY_SIZE(omap44xx_prm_resets),
@@ -2943,7 +2943,6 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
2943 .modulemode = MODULEMODE_SWCTRL, 2943 .modulemode = MODULEMODE_SWCTRL,
2944 }, 2944 },
2945 }, 2945 },
2946 .dev_attr = &capability_alwon_dev_attr,
2947}; 2946};
2948 2947
2949/* timer3 */ 2948/* timer3 */
@@ -2965,7 +2964,6 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
2965 .modulemode = MODULEMODE_SWCTRL, 2964 .modulemode = MODULEMODE_SWCTRL,
2966 }, 2965 },
2967 }, 2966 },
2968 .dev_attr = &capability_alwon_dev_attr,
2969}; 2967};
2970 2968
2971/* timer4 */ 2969/* timer4 */
@@ -2987,7 +2985,6 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
2987 .modulemode = MODULEMODE_SWCTRL, 2985 .modulemode = MODULEMODE_SWCTRL,
2988 }, 2986 },
2989 }, 2987 },
2990 .dev_attr = &capability_alwon_dev_attr,
2991}; 2988};
2992 2989
2993/* timer5 */ 2990/* timer5 */
@@ -3009,7 +3006,6 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
3009 .modulemode = MODULEMODE_SWCTRL, 3006 .modulemode = MODULEMODE_SWCTRL,
3010 }, 3007 },
3011 }, 3008 },
3012 .dev_attr = &capability_alwon_dev_attr,
3013}; 3009};
3014 3010
3015/* timer6 */ 3011/* timer6 */
@@ -3032,7 +3028,6 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
3032 .modulemode = MODULEMODE_SWCTRL, 3028 .modulemode = MODULEMODE_SWCTRL,
3033 }, 3029 },
3034 }, 3030 },
3035 .dev_attr = &capability_alwon_dev_attr,
3036}; 3031};
3037 3032
3038/* timer7 */ 3033/* timer7 */
@@ -3054,7 +3049,6 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
3054 .modulemode = MODULEMODE_SWCTRL, 3049 .modulemode = MODULEMODE_SWCTRL,
3055 }, 3050 },
3056 }, 3051 },
3057 .dev_attr = &capability_alwon_dev_attr,
3058}; 3052};
3059 3053
3060/* timer8 */ 3054/* timer8 */
@@ -3860,7 +3854,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
3860}; 3854};
3861 3855
3862/* usb_host_fs -> l3_main_2 */ 3856/* usb_host_fs -> l3_main_2 */
3863static struct omap_hwmod_ocp_if omap44xx_usb_host_fs__l3_main_2 = { 3857static struct omap_hwmod_ocp_if __maybe_unused omap44xx_usb_host_fs__l3_main_2 = {
3864 .master = &omap44xx_usb_host_fs_hwmod, 3858 .master = &omap44xx_usb_host_fs_hwmod,
3865 .slave = &omap44xx_l3_main_2_hwmod, 3859 .slave = &omap44xx_l3_main_2_hwmod,
3866 .clk = "l3_div_ck", 3860 .clk = "l3_div_ck",
@@ -3918,7 +3912,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
3918}; 3912};
3919 3913
3920/* aess -> l4_abe */ 3914/* aess -> l4_abe */
3921static struct omap_hwmod_ocp_if omap44xx_aess__l4_abe = { 3915static struct omap_hwmod_ocp_if __maybe_unused omap44xx_aess__l4_abe = {
3922 .master = &omap44xx_aess_hwmod, 3916 .master = &omap44xx_aess_hwmod,
3923 .slave = &omap44xx_l4_abe_hwmod, 3917 .slave = &omap44xx_l4_abe_hwmod,
3924 .clk = "ocp_abe_iclk", 3918 .clk = "ocp_abe_iclk",
@@ -4009,7 +4003,7 @@ static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
4009}; 4003};
4010 4004
4011/* l4_abe -> aess */ 4005/* l4_abe -> aess */
4012static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess = { 4006static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess = {
4013 .master = &omap44xx_l4_abe_hwmod, 4007 .master = &omap44xx_l4_abe_hwmod,
4014 .slave = &omap44xx_aess_hwmod, 4008 .slave = &omap44xx_aess_hwmod,
4015 .clk = "ocp_abe_iclk", 4009 .clk = "ocp_abe_iclk",
@@ -4027,7 +4021,7 @@ static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
4027}; 4021};
4028 4022
4029/* l4_abe -> aess (dma) */ 4023/* l4_abe -> aess (dma) */
4030static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess_dma = { 4024static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess_dma = {
4031 .master = &omap44xx_l4_abe_hwmod, 4025 .master = &omap44xx_l4_abe_hwmod,
4032 .slave = &omap44xx_aess_hwmod, 4026 .slave = &omap44xx_aess_hwmod,
4033 .clk = "ocp_abe_iclk", 4027 .clk = "ocp_abe_iclk",
@@ -5853,7 +5847,7 @@ static struct omap_hwmod_addr_space omap44xx_usb_host_fs_addrs[] = {
5853}; 5847};
5854 5848
5855/* l4_cfg -> usb_host_fs */ 5849/* l4_cfg -> usb_host_fs */
5856static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_fs = { 5850static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = {
5857 .master = &omap44xx_l4_cfg_hwmod, 5851 .master = &omap44xx_l4_cfg_hwmod,
5858 .slave = &omap44xx_usb_host_fs_hwmod, 5852 .slave = &omap44xx_usb_host_fs_hwmod,
5859 .clk = "l4_div_ck", 5853 .clk = "l4_div_ck",
@@ -6010,13 +6004,13 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6010 &omap44xx_iva__l3_main_2, 6004 &omap44xx_iva__l3_main_2,
6011 &omap44xx_l3_main_1__l3_main_2, 6005 &omap44xx_l3_main_1__l3_main_2,
6012 &omap44xx_l4_cfg__l3_main_2, 6006 &omap44xx_l4_cfg__l3_main_2,
6013 &omap44xx_usb_host_fs__l3_main_2, 6007 /* &omap44xx_usb_host_fs__l3_main_2, */
6014 &omap44xx_usb_host_hs__l3_main_2, 6008 &omap44xx_usb_host_hs__l3_main_2,
6015 &omap44xx_usb_otg_hs__l3_main_2, 6009 &omap44xx_usb_otg_hs__l3_main_2,
6016 &omap44xx_l3_main_1__l3_main_3, 6010 &omap44xx_l3_main_1__l3_main_3,
6017 &omap44xx_l3_main_2__l3_main_3, 6011 &omap44xx_l3_main_2__l3_main_3,
6018 &omap44xx_l4_cfg__l3_main_3, 6012 &omap44xx_l4_cfg__l3_main_3,
6019 &omap44xx_aess__l4_abe, 6013 /* &omap44xx_aess__l4_abe, */
6020 &omap44xx_dsp__l4_abe, 6014 &omap44xx_dsp__l4_abe,
6021 &omap44xx_l3_main_1__l4_abe, 6015 &omap44xx_l3_main_1__l4_abe,
6022 &omap44xx_mpu__l4_abe, 6016 &omap44xx_mpu__l4_abe,
@@ -6025,8 +6019,8 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6025 &omap44xx_l4_cfg__l4_wkup, 6019 &omap44xx_l4_cfg__l4_wkup,
6026 &omap44xx_mpu__mpu_private, 6020 &omap44xx_mpu__mpu_private,
6027 &omap44xx_l4_cfg__ocp_wp_noc, 6021 &omap44xx_l4_cfg__ocp_wp_noc,
6028 &omap44xx_l4_abe__aess, 6022 /* &omap44xx_l4_abe__aess, */
6029 &omap44xx_l4_abe__aess_dma, 6023 /* &omap44xx_l4_abe__aess_dma, */
6030 &omap44xx_l3_main_2__c2c, 6024 &omap44xx_l3_main_2__c2c,
6031 &omap44xx_l4_wkup__counter_32k, 6025 &omap44xx_l4_wkup__counter_32k,
6032 &omap44xx_l4_cfg__ctrl_module_core, 6026 &omap44xx_l4_cfg__ctrl_module_core,
@@ -6132,7 +6126,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6132 &omap44xx_l4_per__uart2, 6126 &omap44xx_l4_per__uart2,
6133 &omap44xx_l4_per__uart3, 6127 &omap44xx_l4_per__uart3,
6134 &omap44xx_l4_per__uart4, 6128 &omap44xx_l4_per__uart4,
6135 &omap44xx_l4_cfg__usb_host_fs, 6129 /* &omap44xx_l4_cfg__usb_host_fs, */
6136 &omap44xx_l4_cfg__usb_host_hs, 6130 &omap44xx_l4_cfg__usb_host_hs,
6137 &omap44xx_l4_cfg__usb_otg_hs, 6131 &omap44xx_l4_cfg__usb_otg_hs,
6138 &omap44xx_l4_cfg__usb_tll_hs, 6132 &omap44xx_l4_cfg__usb_tll_hs,
@@ -6144,6 +6138,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6144 6138
6145int __init omap44xx_hwmod_init(void) 6139int __init omap44xx_hwmod_init(void)
6146{ 6140{
6141 omap_hwmod_init();
6147 return omap_hwmod_register_links(omap44xx_hwmod_ocp_ifs); 6142 return omap_hwmod_register_links(omap44xx_hwmod_ocp_ifs);
6148} 6143}
6149 6144
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.c b/arch/arm/mach-omap2/omap_hwmod_common_data.c
index 51e5418899fb..9f1ccdc8cc8c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.c
@@ -47,6 +47,16 @@ struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2 = {
47 .midle_shift = SYSC_TYPE2_MIDLEMODE_SHIFT, 47 .midle_shift = SYSC_TYPE2_MIDLEMODE_SHIFT,
48 .sidle_shift = SYSC_TYPE2_SIDLEMODE_SHIFT, 48 .sidle_shift = SYSC_TYPE2_SIDLEMODE_SHIFT,
49 .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT, 49 .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT,
50 .dmadisable_shift = SYSC_TYPE2_DMADISABLE_SHIFT,
51};
52
53/**
54 * struct omap_hwmod_sysc_type3 - TYPE3 sysconfig scheme.
55 * Used by some IPs on AM33xx
56 */
57struct omap_hwmod_sysc_fields omap_hwmod_sysc_type3 = {
58 .midle_shift = SYSC_TYPE3_MIDLEMODE_SHIFT,
59 .sidle_shift = SYSC_TYPE3_SIDLEMODE_SHIFT,
50}; 60};
51 61
52struct omap_dss_dispc_dev_attr omap2_3_dss_dispc_dev_attr = { 62struct omap_dss_dispc_dev_attr omap2_3_dss_dispc_dev_attr = {
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h b/arch/arm/mach-omap2/omap_l3_noc.h
index 90b50984cd2e..a6ce34dc4814 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.h
+++ b/arch/arm/mach-omap2/omap_l3_noc.h
@@ -51,7 +51,9 @@ static u32 l3_targ_inst_clk1[] = {
51 0x200, /* DMM2 */ 51 0x200, /* DMM2 */
52 0x300, /* ABE */ 52 0x300, /* ABE */
53 0x400, /* L4CFG */ 53 0x400, /* L4CFG */
54 0x600 /* CLK2 PWR DISC */ 54 0x600, /* CLK2 PWR DISC */
55 0x0, /* Host CLK1 */
56 0x900 /* L4 Wakeup */
55}; 57};
56 58
57static u32 l3_targ_inst_clk2[] = { 59static u32 l3_targ_inst_clk2[] = {
@@ -72,11 +74,16 @@ static u32 l3_targ_inst_clk2[] = {
72 0xE00, /* missing in TRM corresponds to AES2*/ 74 0xE00, /* missing in TRM corresponds to AES2*/
73 0xC00, /* L4 PER3 */ 75 0xC00, /* L4 PER3 */
74 0xA00, /* L4 PER1*/ 76 0xA00, /* L4 PER1*/
75 0xB00 /* L4 PER2*/ 77 0xB00, /* L4 PER2*/
78 0x0, /* HOST CLK2 */
79 0x1800, /* CAL */
80 0x1700 /* LLI */
76}; 81};
77 82
78static u32 l3_targ_inst_clk3[] = { 83static u32 l3_targ_inst_clk3[] = {
79 0x0100 /* EMUSS */ 84 0x0100 /* EMUSS */,
85 0x0300, /* DEBUGSS_CT_TBR */
86 0x0 /* HOST CLK3 */
80}; 87};
81 88
82static struct l3_masters_data { 89static struct l3_masters_data {
@@ -110,13 +117,15 @@ static struct l3_masters_data {
110 { 0xC8, "USBHOSTFS"} 117 { 0xC8, "USBHOSTFS"}
111}; 118};
112 119
113static char *l3_targ_inst_name[L3_MODULES][18] = { 120static char *l3_targ_inst_name[L3_MODULES][21] = {
114 { 121 {
115 "DMM1", 122 "DMM1",
116 "DMM2", 123 "DMM2",
117 "ABE", 124 "ABE",
118 "L4CFG", 125 "L4CFG",
119 "CLK2 PWR DISC", 126 "CLK2 PWR DISC",
127 "HOST CLK1",
128 "L4 WAKEUP"
120 }, 129 },
121 { 130 {
122 "CORTEX M3" , 131 "CORTEX M3" ,
@@ -137,9 +146,14 @@ static char *l3_targ_inst_name[L3_MODULES][18] = {
137 "L4 PER3", 146 "L4 PER3",
138 "L4 PER1", 147 "L4 PER1",
139 "L4 PER2", 148 "L4 PER2",
149 "HOST CLK2",
150 "CAL",
151 "LLI"
140 }, 152 },
141 { 153 {
142 "EMUSS", 154 "EMUSS",
155 "DEBUG SOURCE",
156 "HOST CLK3"
143 }, 157 },
144}; 158};
145 159
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
index a05a62f9ee5b..acc216491b8a 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ b/arch/arm/mach-omap2/omap_l3_smx.c
@@ -155,10 +155,11 @@ static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
155 u8 multi = error & L3_ERROR_LOG_MULTI; 155 u8 multi = error & L3_ERROR_LOG_MULTI;
156 u32 address = omap3_l3_decode_addr(error_addr); 156 u32 address = omap3_l3_decode_addr(error_addr);
157 157
158 WARN(true, "%s seen by %s %s at address %x\n", 158 pr_err("%s seen by %s %s at address %x\n",
159 omap3_l3_code_string(code), 159 omap3_l3_code_string(code),
160 omap3_l3_initiator_string(initid), 160 omap3_l3_initiator_string(initid),
161 multi ? "Multiple Errors" : "", address); 161 multi ? "Multiple Errors" : "", address);
162 WARN_ON(1);
162 163
163 return IRQ_HANDLED; 164 return IRQ_HANDLED;
164} 165}
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index 4c90477e6f82..d52651a05daa 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -239,21 +239,15 @@ void am35x_set_mode(u8 musb_mode)
239 239
240 devconf2 &= ~CONF2_OTGMODE; 240 devconf2 &= ~CONF2_OTGMODE;
241 switch (musb_mode) { 241 switch (musb_mode) {
242#ifdef CONFIG_USB_MUSB_HDRC_HCD
243 case MUSB_HOST: /* Force VBUS valid, ID = 0 */ 242 case MUSB_HOST: /* Force VBUS valid, ID = 0 */
244 devconf2 |= CONF2_FORCE_HOST; 243 devconf2 |= CONF2_FORCE_HOST;
245 break; 244 break;
246#endif
247#ifdef CONFIG_USB_GADGET_MUSB_HDRC
248 case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */ 245 case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */
249 devconf2 |= CONF2_FORCE_DEVICE; 246 devconf2 |= CONF2_FORCE_DEVICE;
250 break; 247 break;
251#endif
252#ifdef CONFIG_USB_MUSB_OTG
253 case MUSB_OTG: /* Don't override the VBUS/ID comparators */ 248 case MUSB_OTG: /* Don't override the VBUS/ID comparators */
254 devconf2 |= CONF2_NO_OVERRIDE; 249 devconf2 |= CONF2_NO_OVERRIDE;
255 break; 250 break;
256#endif
257 default: 251 default:
258 pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode); 252 pr_info(KERN_INFO "Unsupported mode %u\n", musb_mode);
259 } 253 }
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index de6d46451746..d8f6dbf45d16 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -53,7 +53,7 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
53 omap_table_init = 1; 53 omap_table_init = 1;
54 54
55 /* Lets now register with OPP library */ 55 /* Lets now register with OPP library */
56 for (i = 0; i < opp_def_size; i++) { 56 for (i = 0; i < opp_def_size; i++, opp_def++) {
57 struct omap_hwmod *oh; 57 struct omap_hwmod *oh;
58 struct device *dev; 58 struct device *dev;
59 59
@@ -86,7 +86,6 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
86 __func__, opp_def->freq, 86 __func__, opp_def->freq,
87 opp_def->hwmod_name, i, r); 87 opp_def->hwmod_name, i, r);
88 } 88 }
89 opp_def++;
90 } 89 }
91 90
92 return 0; 91 return 0;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 78564895e914..686137d164da 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -15,12 +15,25 @@
15 15
16#include "powerdomain.h" 16#include "powerdomain.h"
17 17
18#ifdef CONFIG_CPU_IDLE
19extern int __init omap3_idle_init(void);
20extern int __init omap4_idle_init(void);
21#else
22static inline int omap3_idle_init(void)
23{
24 return 0;
25}
26
27static inline int omap4_idle_init(void)
28{
29 return 0;
30}
31#endif
32
18extern void *omap3_secure_ram_storage; 33extern void *omap3_secure_ram_storage;
19extern void omap3_pm_off_mode_enable(int); 34extern void omap3_pm_off_mode_enable(int);
20extern void omap_sram_idle(void); 35extern void omap_sram_idle(void);
21extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state); 36extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
22extern int omap3_idle_init(void);
23extern int omap4_idle_init(void);
24extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused); 37extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
25extern int (*omap_pm_suspend)(void); 38extern int (*omap_pm_suspend)(void);
26 39
@@ -88,7 +101,7 @@ extern void enable_omap3630_toggle_l2_on_restore(void);
88static inline void enable_omap3630_toggle_l2_on_restore(void) { } 101static inline void enable_omap3630_toggle_l2_on_restore(void) { }
89#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ 102#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
90 103
91#ifdef CONFIG_OMAP_SMARTREFLEX 104#ifdef CONFIG_POWER_AVS_OMAP
92extern int omap_devinit_smartreflex(void); 105extern int omap_devinit_smartreflex(void);
93extern void omap_enable_smartreflex_on_init(void); 106extern void omap_enable_smartreflex_on_init(void);
94#else 107#else
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a34023d0ca7c..e4fc88c65dbd 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -70,34 +70,6 @@ void (*omap3_do_wfi_sram)(void);
70 70
71static struct powerdomain *mpu_pwrdm, *neon_pwrdm; 71static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
72static struct powerdomain *core_pwrdm, *per_pwrdm; 72static struct powerdomain *core_pwrdm, *per_pwrdm;
73static struct powerdomain *cam_pwrdm;
74
75static void omap3_enable_io_chain(void)
76{
77 int timeout = 0;
78
79 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
80 PM_WKEN);
81 /* Do a readback to assure write has been done */
82 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
83
84 while (!(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
85 OMAP3430_ST_IO_CHAIN_MASK)) {
86 timeout++;
87 if (timeout > 1000) {
88 pr_err("Wake up daisy chain activation failed.\n");
89 return;
90 }
91 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
92 WKUP_MOD, PM_WKEN);
93 }
94}
95
96static void omap3_disable_io_chain(void)
97{
98 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
99 PM_WKEN);
100}
101 73
102static void omap3_core_save_context(void) 74static void omap3_core_save_context(void)
103{ 75{
@@ -299,24 +271,22 @@ void omap_sram_idle(void)
299 /* Enable IO-PAD and IO-CHAIN wakeups */ 271 /* Enable IO-PAD and IO-CHAIN wakeups */
300 per_next_state = pwrdm_read_next_pwrst(per_pwrdm); 272 per_next_state = pwrdm_read_next_pwrst(per_pwrdm);
301 core_next_state = pwrdm_read_next_pwrst(core_pwrdm); 273 core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
302 if (omap3_has_io_wakeup() &&
303 (per_next_state < PWRDM_POWER_ON ||
304 core_next_state < PWRDM_POWER_ON)) {
305 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN);
306 if (omap3_has_io_chain_ctrl())
307 omap3_enable_io_chain();
308 }
309 274
310 pwrdm_pre_transition(); 275 if (mpu_next_state < PWRDM_POWER_ON) {
276 pwrdm_pre_transition(mpu_pwrdm);
277 pwrdm_pre_transition(neon_pwrdm);
278 }
311 279
312 /* PER */ 280 /* PER */
313 if (per_next_state < PWRDM_POWER_ON) { 281 if (per_next_state < PWRDM_POWER_ON) {
282 pwrdm_pre_transition(per_pwrdm);
314 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; 283 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
315 omap2_gpio_prepare_for_idle(per_going_off); 284 omap2_gpio_prepare_for_idle(per_going_off);
316 } 285 }
317 286
318 /* CORE */ 287 /* CORE */
319 if (core_next_state < PWRDM_POWER_ON) { 288 if (core_next_state < PWRDM_POWER_ON) {
289 pwrdm_pre_transition(core_pwrdm);
320 if (core_next_state == PWRDM_POWER_OFF) { 290 if (core_next_state == PWRDM_POWER_OFF) {
321 omap3_core_save_context(); 291 omap3_core_save_context();
322 omap3_cm_save_context(); 292 omap3_cm_save_context();
@@ -369,26 +339,20 @@ void omap_sram_idle(void)
369 omap2_prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK, 339 omap2_prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK,
370 OMAP3430_GR_MOD, 340 OMAP3430_GR_MOD,
371 OMAP3_PRM_VOLTCTRL_OFFSET); 341 OMAP3_PRM_VOLTCTRL_OFFSET);
342 pwrdm_post_transition(core_pwrdm);
372 } 343 }
373 omap3_intc_resume_idle(); 344 omap3_intc_resume_idle();
374 345
375 pwrdm_post_transition();
376
377 /* PER */ 346 /* PER */
378 if (per_next_state < PWRDM_POWER_ON) 347 if (per_next_state < PWRDM_POWER_ON) {
379 omap2_gpio_resume_after_idle(); 348 omap2_gpio_resume_after_idle();
380 349 pwrdm_post_transition(per_pwrdm);
381 /* Disable IO-PAD and IO-CHAIN wakeup */
382 if (omap3_has_io_wakeup() &&
383 (per_next_state < PWRDM_POWER_ON ||
384 core_next_state < PWRDM_POWER_ON)) {
385 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
386 PM_WKEN);
387 if (omap3_has_io_chain_ctrl())
388 omap3_disable_io_chain();
389 } 350 }
390 351
391 clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); 352 if (mpu_next_state < PWRDM_POWER_ON) {
353 pwrdm_post_transition(mpu_pwrdm);
354 pwrdm_post_transition(neon_pwrdm);
355 }
392} 356}
393 357
394static void omap3_pm_idle(void) 358static void omap3_pm_idle(void)
@@ -581,10 +545,13 @@ static void __init prcm_setup_regs(void)
581 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL); 545 OMAP3430_PER_MOD, OMAP3430_PM_MPUGRPSEL);
582 546
583 /* Don't attach IVA interrupts */ 547 /* Don't attach IVA interrupts */
584 omap2_prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL); 548 if (omap3_has_iva()) {
585 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1); 549 omap2_prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
586 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3); 550 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
587 omap2_prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL); 551 omap2_prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
552 omap2_prm_write_mod_reg(0, OMAP3430_PER_MOD,
553 OMAP3430_PM_IVAGRPSEL);
554 }
588 555
589 /* Clear any pending 'reset' flags */ 556 /* Clear any pending 'reset' flags */
590 omap2_prm_write_mod_reg(0xffffffff, MPU_MOD, OMAP2_RM_RSTST); 557 omap2_prm_write_mod_reg(0xffffffff, MPU_MOD, OMAP2_RM_RSTST);
@@ -598,7 +565,9 @@ static void __init prcm_setup_regs(void)
598 /* Clear any pending PRCM interrupts */ 565 /* Clear any pending PRCM interrupts */
599 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 566 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
600 567
601 omap3_iva_idle(); 568 if (omap3_has_iva())
569 omap3_iva_idle();
570
602 omap3_d2d_idle(); 571 omap3_d2d_idle();
603} 572}
604 573
@@ -724,6 +693,7 @@ int __init omap3_pm_init(void)
724 ret = request_irq(omap_prcm_event_to_irq("io"), 693 ret = request_irq(omap_prcm_event_to_irq("io"),
725 _prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io", 694 _prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io",
726 omap3_pm_init); 695 omap3_pm_init);
696 enable_irq(omap_prcm_event_to_irq("io"));
727 697
728 if (ret) { 698 if (ret) {
729 pr_err("pm: Failed to request pm_io irq\n"); 699 pr_err("pm: Failed to request pm_io irq\n");
@@ -748,7 +718,6 @@ int __init omap3_pm_init(void)
748 neon_pwrdm = pwrdm_lookup("neon_pwrdm"); 718 neon_pwrdm = pwrdm_lookup("neon_pwrdm");
749 per_pwrdm = pwrdm_lookup("per_pwrdm"); 719 per_pwrdm = pwrdm_lookup("per_pwrdm");
750 core_pwrdm = pwrdm_lookup("core_pwrdm"); 720 core_pwrdm = pwrdm_lookup("core_pwrdm");
751 cam_pwrdm = pwrdm_lookup("cam_pwrdm");
752 721
753 neon_clkdm = clkdm_lookup("neon_clkdm"); 722 neon_clkdm = clkdm_lookup("neon_clkdm");
754 mpu_clkdm = clkdm_lookup("mpu_clkdm"); 723 mpu_clkdm = clkdm_lookup("mpu_clkdm");
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 96114901b932..69b36e185e9b 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -526,7 +526,8 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
526 * 526 *
527 * Return the powerdomain @pwrdm's current power state. Returns -EINVAL 527 * Return the powerdomain @pwrdm's current power state. Returns -EINVAL
528 * if the powerdomain pointer is null or returns the current power state 528 * if the powerdomain pointer is null or returns the current power state
529 * upon success. 529 * upon success. Note that if the power domain only supports the ON state
530 * then just return ON as the current state.
530 */ 531 */
531int pwrdm_read_pwrst(struct powerdomain *pwrdm) 532int pwrdm_read_pwrst(struct powerdomain *pwrdm)
532{ 533{
@@ -535,6 +536,9 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm)
535 if (!pwrdm) 536 if (!pwrdm)
536 return -EINVAL; 537 return -EINVAL;
537 538
539 if (pwrdm->pwrsts == PWRSTS_ON)
540 return PWRDM_POWER_ON;
541
538 if (arch_pwrdm && arch_pwrdm->pwrdm_read_pwrst) 542 if (arch_pwrdm && arch_pwrdm->pwrdm_read_pwrst)
539 ret = arch_pwrdm->pwrdm_read_pwrst(pwrdm); 543 ret = arch_pwrdm->pwrdm_read_pwrst(pwrdm);
540 544
@@ -981,15 +985,23 @@ int pwrdm_state_switch(struct powerdomain *pwrdm)
981 return ret; 985 return ret;
982} 986}
983 987
984int pwrdm_pre_transition(void) 988int pwrdm_pre_transition(struct powerdomain *pwrdm)
985{ 989{
986 pwrdm_for_each(_pwrdm_pre_transition_cb, NULL); 990 if (pwrdm)
991 _pwrdm_pre_transition_cb(pwrdm, NULL);
992 else
993 pwrdm_for_each(_pwrdm_pre_transition_cb, NULL);
994
987 return 0; 995 return 0;
988} 996}
989 997
990int pwrdm_post_transition(void) 998int pwrdm_post_transition(struct powerdomain *pwrdm)
991{ 999{
992 pwrdm_for_each(_pwrdm_post_transition_cb, NULL); 1000 if (pwrdm)
1001 _pwrdm_post_transition_cb(pwrdm, NULL);
1002 else
1003 pwrdm_for_each(_pwrdm_post_transition_cb, NULL);
1004
993 return 0; 1005 return 0;
994} 1006}
995 1007
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 8f88d65c46ea..baee90608d11 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -67,9 +67,9 @@
67 67
68/* 68/*
69 * Maximum number of clockdomains that can be associated with a powerdomain. 69 * Maximum number of clockdomains that can be associated with a powerdomain.
70 * CORE powerdomain on OMAP4 is the worst case 70 * PER powerdomain on AM33XX is the worst case
71 */ 71 */
72#define PWRDM_MAX_CLKDMS 9 72#define PWRDM_MAX_CLKDMS 11
73 73
74/* XXX A completely arbitrary number. What is reasonable here? */ 74/* XXX A completely arbitrary number. What is reasonable here? */
75#define PWRDM_TRANSITION_BAILOUT 100000 75#define PWRDM_TRANSITION_BAILOUT 100000
@@ -92,6 +92,15 @@ struct powerdomain;
92 * @pwrdm_clkdms: Clockdomains in this powerdomain 92 * @pwrdm_clkdms: Clockdomains in this powerdomain
93 * @node: list_head linking all powerdomains 93 * @node: list_head linking all powerdomains
94 * @voltdm_node: list_head linking all powerdomains in a voltagedomain 94 * @voltdm_node: list_head linking all powerdomains in a voltagedomain
95 * @pwrstctrl_offs: (AM33XX only) XXX_PWRSTCTRL reg offset from prcm_offs
96 * @pwrstst_offs: (AM33XX only) XXX_PWRSTST reg offset from prcm_offs
97 * @logicretstate_mask: (AM33XX only) mask for logic retention bitfield
98 * in @pwrstctrl_offs
99 * @mem_on_mask: (AM33XX only) mask for mem on bitfield in @pwrstctrl_offs
100 * @mem_ret_mask: (AM33XX only) mask for mem ret bitfield in @pwrstctrl_offs
101 * @mem_pwrst_mask: (AM33XX only) mask for mem state bitfield in @pwrstst_offs
102 * @mem_retst_mask: (AM33XX only) mask for mem retention state bitfield
103 * in @pwrstctrl_offs
95 * @state: 104 * @state:
96 * @state_counter: 105 * @state_counter:
97 * @timer: 106 * @timer:
@@ -121,6 +130,14 @@ struct powerdomain {
121 unsigned ret_logic_off_counter; 130 unsigned ret_logic_off_counter;
122 unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS]; 131 unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
123 132
133 const u8 pwrstctrl_offs;
134 const u8 pwrstst_offs;
135 const u32 logicretstate_mask;
136 const u32 mem_on_mask[PWRDM_MAX_MEM_BANKS];
137 const u32 mem_ret_mask[PWRDM_MAX_MEM_BANKS];
138 const u32 mem_pwrst_mask[PWRDM_MAX_MEM_BANKS];
139 const u32 mem_retst_mask[PWRDM_MAX_MEM_BANKS];
140
124#ifdef CONFIG_PM_DEBUG 141#ifdef CONFIG_PM_DEBUG
125 s64 timer; 142 s64 timer;
126 s64 state_timer[PWRDM_MAX_PWRSTS]; 143 s64 state_timer[PWRDM_MAX_PWRSTS];
@@ -213,8 +230,8 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);
213int pwrdm_wait_transition(struct powerdomain *pwrdm); 230int pwrdm_wait_transition(struct powerdomain *pwrdm);
214 231
215int pwrdm_state_switch(struct powerdomain *pwrdm); 232int pwrdm_state_switch(struct powerdomain *pwrdm);
216int pwrdm_pre_transition(void); 233int pwrdm_pre_transition(struct powerdomain *pwrdm);
217int pwrdm_post_transition(void); 234int pwrdm_post_transition(struct powerdomain *pwrdm);
218int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); 235int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
219int pwrdm_get_context_loss_count(struct powerdomain *pwrdm); 236int pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
220bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); 237bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
@@ -222,10 +239,12 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
222extern void omap242x_powerdomains_init(void); 239extern void omap242x_powerdomains_init(void);
223extern void omap243x_powerdomains_init(void); 240extern void omap243x_powerdomains_init(void);
224extern void omap3xxx_powerdomains_init(void); 241extern void omap3xxx_powerdomains_init(void);
242extern void am33xx_powerdomains_init(void);
225extern void omap44xx_powerdomains_init(void); 243extern void omap44xx_powerdomains_init(void);
226 244
227extern struct pwrdm_ops omap2_pwrdm_operations; 245extern struct pwrdm_ops omap2_pwrdm_operations;
228extern struct pwrdm_ops omap3_pwrdm_operations; 246extern struct pwrdm_ops omap3_pwrdm_operations;
247extern struct pwrdm_ops am33xx_pwrdm_operations;
229extern struct pwrdm_ops omap4_pwrdm_operations; 248extern struct pwrdm_ops omap4_pwrdm_operations;
230 249
231/* Common Internal functions used across OMAP rev's */ 250/* Common Internal functions used across OMAP rev's */
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c
new file mode 100644
index 000000000000..67c5663899b6
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomain33xx.c
@@ -0,0 +1,229 @@
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/powerdomains33xx_data.c b/arch/arm/mach-omap2/powerdomains33xx_data.c
new file mode 100644
index 000000000000..869adb82569e
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains33xx_data.c
@@ -0,0 +1,185 @@
1/*
2 * AM33XX Power domain data
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include "powerdomain.h"
20#include "prcm-common.h"
21#include "prm-regbits-33xx.h"
22#include "prm33xx.h"
23
24static struct powerdomain gfx_33xx_pwrdm = {
25 .name = "gfx_pwrdm",
26 .voltdm = { .name = "core" },
27 .prcm_offs = AM33XX_PRM_GFX_MOD,
28 .pwrstctrl_offs = AM33XX_PM_GFX_PWRSTCTRL_OFFSET,
29 .pwrstst_offs = AM33XX_PM_GFX_PWRSTST_OFFSET,
30 .pwrsts = PWRSTS_OFF_RET_ON,
31 .pwrsts_logic_ret = PWRSTS_OFF_RET,
32 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
33 .banks = 1,
34 .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
35 .mem_on_mask = {
36 [0] = AM33XX_GFX_MEM_ONSTATE_MASK, /* gfx_mem */
37 },
38 .mem_ret_mask = {
39 [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
40 },
41 .mem_pwrst_mask = {
42 [0] = AM33XX_GFX_MEM_STATEST_MASK, /* gfx_mem */
43 },
44 .mem_retst_mask = {
45 [0] = AM33XX_GFX_MEM_RETSTATE_MASK, /* gfx_mem */
46 },
47 .pwrsts_mem_ret = {
48 [0] = PWRSTS_OFF_RET, /* gfx_mem */
49 },
50 .pwrsts_mem_on = {
51 [0] = PWRSTS_ON, /* gfx_mem */
52 },
53};
54
55static struct powerdomain rtc_33xx_pwrdm = {
56 .name = "rtc_pwrdm",
57 .voltdm = { .name = "rtc" },
58 .prcm_offs = AM33XX_PRM_RTC_MOD,
59 .pwrstctrl_offs = AM33XX_PM_RTC_PWRSTCTRL_OFFSET,
60 .pwrstst_offs = AM33XX_PM_RTC_PWRSTST_OFFSET,
61 .pwrsts = PWRSTS_ON,
62 .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
63};
64
65static struct powerdomain wkup_33xx_pwrdm = {
66 .name = "wkup_pwrdm",
67 .voltdm = { .name = "core" },
68 .prcm_offs = AM33XX_PRM_WKUP_MOD,
69 .pwrstctrl_offs = AM33XX_PM_WKUP_PWRSTCTRL_OFFSET,
70 .pwrstst_offs = AM33XX_PM_WKUP_PWRSTST_OFFSET,
71 .pwrsts = PWRSTS_ON,
72 .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
73};
74
75static struct powerdomain per_33xx_pwrdm = {
76 .name = "per_pwrdm",
77 .voltdm = { .name = "core" },
78 .prcm_offs = AM33XX_PRM_PER_MOD,
79 .pwrstctrl_offs = AM33XX_PM_PER_PWRSTCTRL_OFFSET,
80 .pwrstst_offs = AM33XX_PM_PER_PWRSTST_OFFSET,
81 .pwrsts = PWRSTS_OFF_RET_ON,
82 .pwrsts_logic_ret = PWRSTS_OFF_RET,
83 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
84 .banks = 3,
85 .logicretstate_mask = AM33XX_LOGICRETSTATE_3_3_MASK,
86 .mem_on_mask = {
87 [0] = AM33XX_PRUSS_MEM_ONSTATE_MASK, /* pruss_mem */
88 [1] = AM33XX_PER_MEM_ONSTATE_MASK, /* per_mem */
89 [2] = AM33XX_RAM_MEM_ONSTATE_MASK, /* ram_mem */
90 },
91 .mem_ret_mask = {
92 [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
93 [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
94 [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
95 },
96 .mem_pwrst_mask = {
97 [0] = AM33XX_PRUSS_MEM_STATEST_MASK, /* pruss_mem */
98 [1] = AM33XX_PER_MEM_STATEST_MASK, /* per_mem */
99 [2] = AM33XX_RAM_MEM_STATEST_MASK, /* ram_mem */
100 },
101 .mem_retst_mask = {
102 [0] = AM33XX_PRUSS_MEM_RETSTATE_MASK, /* pruss_mem */
103 [1] = AM33XX_PER_MEM_RETSTATE_MASK, /* per_mem */
104 [2] = AM33XX_RAM_MEM_RETSTATE_MASK, /* ram_mem */
105 },
106 .pwrsts_mem_ret = {
107 [0] = PWRSTS_OFF_RET, /* pruss_mem */
108 [1] = PWRSTS_OFF_RET, /* per_mem */
109 [2] = PWRSTS_OFF_RET, /* ram_mem */
110 },
111 .pwrsts_mem_on = {
112 [0] = PWRSTS_ON, /* pruss_mem */
113 [1] = PWRSTS_ON, /* per_mem */
114 [2] = PWRSTS_ON, /* ram_mem */
115 },
116};
117
118static struct powerdomain mpu_33xx_pwrdm = {
119 .name = "mpu_pwrdm",
120 .voltdm = { .name = "mpu" },
121 .prcm_offs = AM33XX_PRM_MPU_MOD,
122 .pwrstctrl_offs = AM33XX_PM_MPU_PWRSTCTRL_OFFSET,
123 .pwrstst_offs = AM33XX_PM_MPU_PWRSTST_OFFSET,
124 .pwrsts = PWRSTS_OFF_RET_ON,
125 .pwrsts_logic_ret = PWRSTS_OFF_RET,
126 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
127 .banks = 3,
128 .logicretstate_mask = AM33XX_LOGICRETSTATE_MASK,
129 .mem_on_mask = {
130 [0] = AM33XX_MPU_L1_ONSTATE_MASK, /* mpu_l1 */
131 [1] = AM33XX_MPU_L2_ONSTATE_MASK, /* mpu_l2 */
132 [2] = AM33XX_MPU_RAM_ONSTATE_MASK, /* mpu_ram */
133 },
134 .mem_ret_mask = {
135 [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
136 [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
137 [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
138 },
139 .mem_pwrst_mask = {
140 [0] = AM33XX_MPU_L1_STATEST_MASK, /* mpu_l1 */
141 [1] = AM33XX_MPU_L2_STATEST_MASK, /* mpu_l2 */
142 [2] = AM33XX_MPU_RAM_STATEST_MASK, /* mpu_ram */
143 },
144 .mem_retst_mask = {
145 [0] = AM33XX_MPU_L1_RETSTATE_MASK, /* mpu_l1 */
146 [1] = AM33XX_MPU_L2_RETSTATE_MASK, /* mpu_l2 */
147 [2] = AM33XX_MPU_RAM_RETSTATE_MASK, /* mpu_ram */
148 },
149 .pwrsts_mem_ret = {
150 [0] = PWRSTS_OFF_RET, /* mpu_l1 */
151 [1] = PWRSTS_OFF_RET, /* mpu_l2 */
152 [2] = PWRSTS_OFF_RET, /* mpu_ram */
153 },
154 .pwrsts_mem_on = {
155 [0] = PWRSTS_ON, /* mpu_l1 */
156 [1] = PWRSTS_ON, /* mpu_l2 */
157 [2] = PWRSTS_ON, /* mpu_ram */
158 },
159};
160
161static struct powerdomain cefuse_33xx_pwrdm = {
162 .name = "cefuse_pwrdm",
163 .voltdm = { .name = "core" },
164 .prcm_offs = AM33XX_PRM_CEFUSE_MOD,
165 .pwrstctrl_offs = AM33XX_PM_CEFUSE_PWRSTCTRL_OFFSET,
166 .pwrstst_offs = AM33XX_PM_CEFUSE_PWRSTST_OFFSET,
167 .pwrsts = PWRSTS_OFF_ON,
168};
169
170static struct powerdomain *powerdomains_am33xx[] __initdata = {
171 &gfx_33xx_pwrdm,
172 &rtc_33xx_pwrdm,
173 &wkup_33xx_pwrdm,
174 &per_33xx_pwrdm,
175 &mpu_33xx_pwrdm,
176 &cefuse_33xx_pwrdm,
177 NULL,
178};
179
180void __init am33xx_powerdomains_init(void)
181{
182 pwrdm_register_platform_funcs(&am33xx_pwrdm_operations);
183 pwrdm_register_pwrdms(powerdomains_am33xx);
184 pwrdm_complete_init();
185}
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index fb0a0a6869d1..bb883e463078 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -71,6 +71,22 @@ static struct powerdomain mpu_3xxx_pwrdm = {
71 .voltdm = { .name = "mpu_iva" }, 71 .voltdm = { .name = "mpu_iva" },
72}; 72};
73 73
74static struct powerdomain mpu_am35x_pwrdm = {
75 .name = "mpu_pwrdm",
76 .prcm_offs = MPU_MOD,
77 .pwrsts = PWRSTS_ON,
78 .pwrsts_logic_ret = PWRSTS_ON,
79 .flags = PWRDM_HAS_MPU_QUIRK,
80 .banks = 1,
81 .pwrsts_mem_ret = {
82 [0] = PWRSTS_ON,
83 },
84 .pwrsts_mem_on = {
85 [0] = PWRSTS_ON,
86 },
87 .voltdm = { .name = "mpu_iva" },
88};
89
74/* 90/*
75 * The USBTLL Save-and-Restore mechanism is broken on 91 * The USBTLL Save-and-Restore mechanism is broken on
76 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature 92 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
@@ -120,6 +136,23 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
120 .voltdm = { .name = "core" }, 136 .voltdm = { .name = "core" },
121}; 137};
122 138
139static struct powerdomain core_am35x_pwrdm = {
140 .name = "core_pwrdm",
141 .prcm_offs = CORE_MOD,
142 .pwrsts = PWRSTS_ON,
143 .pwrsts_logic_ret = PWRSTS_ON,
144 .banks = 2,
145 .pwrsts_mem_ret = {
146 [0] = PWRSTS_ON, /* MEM1RETSTATE */
147 [1] = PWRSTS_ON, /* MEM2RETSTATE */
148 },
149 .pwrsts_mem_on = {
150 [0] = PWRSTS_ON, /* MEM1ONSTATE */
151 [1] = PWRSTS_ON, /* MEM2ONSTATE */
152 },
153 .voltdm = { .name = "core" },
154};
155
123static struct powerdomain dss_pwrdm = { 156static struct powerdomain dss_pwrdm = {
124 .name = "dss_pwrdm", 157 .name = "dss_pwrdm",
125 .prcm_offs = OMAP3430_DSS_MOD, 158 .prcm_offs = OMAP3430_DSS_MOD,
@@ -135,6 +168,21 @@ static struct powerdomain dss_pwrdm = {
135 .voltdm = { .name = "core" }, 168 .voltdm = { .name = "core" },
136}; 169};
137 170
171static struct powerdomain dss_am35x_pwrdm = {
172 .name = "dss_pwrdm",
173 .prcm_offs = OMAP3430_DSS_MOD,
174 .pwrsts = PWRSTS_ON,
175 .pwrsts_logic_ret = PWRSTS_ON,
176 .banks = 1,
177 .pwrsts_mem_ret = {
178 [0] = PWRSTS_ON, /* MEMRETSTATE */
179 },
180 .pwrsts_mem_on = {
181 [0] = PWRSTS_ON, /* MEMONSTATE */
182 },
183 .voltdm = { .name = "core" },
184};
185
138/* 186/*
139 * Although the 34XX TRM Rev K Table 4-371 notes that retention is a 187 * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
140 * possible SGX powerstate, the SGX device itself does not support 188 * possible SGX powerstate, the SGX device itself does not support
@@ -156,6 +204,21 @@ static struct powerdomain sgx_pwrdm = {
156 .voltdm = { .name = "core" }, 204 .voltdm = { .name = "core" },
157}; 205};
158 206
207static struct powerdomain sgx_am35x_pwrdm = {
208 .name = "sgx_pwrdm",
209 .prcm_offs = OMAP3430ES2_SGX_MOD,
210 .pwrsts = PWRSTS_ON,
211 .pwrsts_logic_ret = PWRSTS_ON,
212 .banks = 1,
213 .pwrsts_mem_ret = {
214 [0] = PWRSTS_ON, /* MEMRETSTATE */
215 },
216 .pwrsts_mem_on = {
217 [0] = PWRSTS_ON, /* MEMONSTATE */
218 },
219 .voltdm = { .name = "core" },
220};
221
159static struct powerdomain cam_pwrdm = { 222static struct powerdomain cam_pwrdm = {
160 .name = "cam_pwrdm", 223 .name = "cam_pwrdm",
161 .prcm_offs = OMAP3430_CAM_MOD, 224 .prcm_offs = OMAP3430_CAM_MOD,
@@ -186,6 +249,21 @@ static struct powerdomain per_pwrdm = {
186 .voltdm = { .name = "core" }, 249 .voltdm = { .name = "core" },
187}; 250};
188 251
252static struct powerdomain per_am35x_pwrdm = {
253 .name = "per_pwrdm",
254 .prcm_offs = OMAP3430_PER_MOD,
255 .pwrsts = PWRSTS_ON,
256 .pwrsts_logic_ret = PWRSTS_ON,
257 .banks = 1,
258 .pwrsts_mem_ret = {
259 [0] = PWRSTS_ON, /* MEMRETSTATE */
260 },
261 .pwrsts_mem_on = {
262 [0] = PWRSTS_ON, /* MEMONSTATE */
263 },
264 .voltdm = { .name = "core" },
265};
266
189static struct powerdomain emu_pwrdm = { 267static struct powerdomain emu_pwrdm = {
190 .name = "emu_pwrdm", 268 .name = "emu_pwrdm",
191 .prcm_offs = OMAP3430_EMU_MOD, 269 .prcm_offs = OMAP3430_EMU_MOD,
@@ -200,6 +278,14 @@ static struct powerdomain neon_pwrdm = {
200 .voltdm = { .name = "mpu_iva" }, 278 .voltdm = { .name = "mpu_iva" },
201}; 279};
202 280
281static struct powerdomain neon_am35x_pwrdm = {
282 .name = "neon_pwrdm",
283 .prcm_offs = OMAP3430_NEON_MOD,
284 .pwrsts = PWRSTS_ON,
285 .pwrsts_logic_ret = PWRSTS_ON,
286 .voltdm = { .name = "mpu_iva" },
287};
288
203static struct powerdomain usbhost_pwrdm = { 289static struct powerdomain usbhost_pwrdm = {
204 .name = "usbhost_pwrdm", 290 .name = "usbhost_pwrdm",
205 .prcm_offs = OMAP3430ES2_USBHOST_MOD, 291 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
@@ -293,6 +379,22 @@ static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
293 NULL 379 NULL
294}; 380};
295 381
382static struct powerdomain *powerdomains_am35x[] __initdata = {
383 &wkup_omap2_pwrdm,
384 &mpu_am35x_pwrdm,
385 &neon_am35x_pwrdm,
386 &core_am35x_pwrdm,
387 &sgx_am35x_pwrdm,
388 &dss_am35x_pwrdm,
389 &per_am35x_pwrdm,
390 &emu_pwrdm,
391 &dpll1_pwrdm,
392 &dpll3_pwrdm,
393 &dpll4_pwrdm,
394 &dpll5_pwrdm,
395 NULL
396};
397
296void __init omap3xxx_powerdomains_init(void) 398void __init omap3xxx_powerdomains_init(void)
297{ 399{
298 unsigned int rev; 400 unsigned int rev;
@@ -301,21 +403,34 @@ void __init omap3xxx_powerdomains_init(void)
301 return; 403 return;
302 404
303 pwrdm_register_platform_funcs(&omap3_pwrdm_operations); 405 pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
304 pwrdm_register_pwrdms(powerdomains_omap3430_common);
305 406
306 rev = omap_rev(); 407 rev = omap_rev();
307 408
308 if (rev == OMAP3430_REV_ES1_0) 409 if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
309 pwrdm_register_pwrdms(powerdomains_omap3430es1); 410 pwrdm_register_pwrdms(powerdomains_am35x);
310 else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 || 411 } else {
311 rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0) 412 pwrdm_register_pwrdms(powerdomains_omap3430_common);
312 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0); 413
313 else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 || 414 switch (rev) {
314 rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1 || 415 case OMAP3430_REV_ES1_0:
315 rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2) 416 pwrdm_register_pwrdms(powerdomains_omap3430es1);
316 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus); 417 break;
317 else 418 case OMAP3430_REV_ES2_0:
318 WARN(1, "OMAP3 powerdomain init: unknown chip type\n"); 419 case OMAP3430_REV_ES2_1:
420 case OMAP3430_REV_ES3_0:
421 case OMAP3630_REV_ES1_0:
422 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
423 break;
424 case OMAP3430_REV_ES3_1:
425 case OMAP3430_REV_ES3_1_2:
426 case OMAP3630_REV_ES1_1:
427 case OMAP3630_REV_ES1_2:
428 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
429 break;
430 default:
431 WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
432 }
433 }
319 434
320 pwrdm_complete_init(); 435 pwrdm_complete_init();
321} 436}
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 6da3ba483ad1..e5f0503a68b0 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -203,8 +203,8 @@
203#define OMAP3430_EN_MMC2_SHIFT 25 203#define OMAP3430_EN_MMC2_SHIFT 25
204#define OMAP3430_EN_MMC1_MASK (1 << 24) 204#define OMAP3430_EN_MMC1_MASK (1 << 24)
205#define OMAP3430_EN_MMC1_SHIFT 24 205#define OMAP3430_EN_MMC1_SHIFT 24
206#define OMAP3430_EN_UART4_MASK (1 << 23) 206#define AM35XX_EN_UART4_MASK (1 << 23)
207#define OMAP3430_EN_UART4_SHIFT 23 207#define AM35XX_EN_UART4_SHIFT 23
208#define OMAP3430_EN_MCSPI4_MASK (1 << 21) 208#define OMAP3430_EN_MCSPI4_MASK (1 << 21)
209#define OMAP3430_EN_MCSPI4_SHIFT 21 209#define OMAP3430_EN_MCSPI4_SHIFT 21
210#define OMAP3430_EN_MCSPI3_MASK (1 << 20) 210#define OMAP3430_EN_MCSPI3_MASK (1 << 20)
@@ -410,13 +410,21 @@
410 */ 410 */
411#define MAX_MODULE_HARDRESET_WAIT 10000 411#define MAX_MODULE_HARDRESET_WAIT 10000
412 412
413/*
414 * Maximum time(us) it takes to output the signal WUCLKOUT of the last
415 * pad of the I/O ring after asserting WUCLKIN high. Tero measured
416 * the actual time at 7 to 8 microseconds on OMAP3 and 2 to 4
417 * microseconds on OMAP4, so this timeout may be too high.
418 */
419#define MAX_IOPAD_LATCH_TIME 100
420
413# ifndef __ASSEMBLER__ 421# ifndef __ASSEMBLER__
414extern void __iomem *prm_base; 422extern void __iomem *prm_base;
415extern void __iomem *cm_base; 423extern void __iomem *cm_base;
416extern void __iomem *cm2_base; 424extern void __iomem *cm2_base;
417extern void __iomem *prcm_mpu_base; 425extern void __iomem *prcm_mpu_base;
418 426
419#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_OMAP5) 427#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
420extern void omap_prm_base_init(void); 428extern void omap_prm_base_init(void);
421extern void omap_cm_base_init(void); 429extern void omap_cm_base_init(void);
422#else 430#else
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 480f40a5ee42..053e24ed3c48 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -35,6 +35,7 @@
35#include "prm2xxx_3xxx.h" 35#include "prm2xxx_3xxx.h"
36#include "prm44xx.h" 36#include "prm44xx.h"
37#include "prminst44xx.h" 37#include "prminst44xx.h"
38#include "cminst44xx.h"
38#include "prm-regbits-24xx.h" 39#include "prm-regbits-24xx.h"
39#include "prm-regbits-44xx.h" 40#include "prm-regbits-44xx.h"
40#include "control.h" 41#include "control.h"
@@ -159,8 +160,30 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
159 if (omap2_globals->prcm_mpu) 160 if (omap2_globals->prcm_mpu)
160 prcm_mpu_base = omap2_globals->prcm_mpu; 161 prcm_mpu_base = omap2_globals->prcm_mpu;
161 162
162 if (cpu_is_omap44xx()) { 163 if (cpu_is_omap44xx() || soc_is_omap54xx()) {
163 omap_prm_base_init(); 164 omap_prm_base_init();
164 omap_cm_base_init(); 165 omap_cm_base_init();
165 } 166 }
166} 167}
168
169/*
170 * Stubbed functions so that common files continue to build when
171 * custom builds are used
172 * XXX These are temporary and should be removed at the earliest possible
173 * opportunity
174 */
175int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
176 u16 clkctrl_offs)
177{
178 return 0;
179}
180
181void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
182 s16 cdoffs, u16 clkctrl_offs)
183{
184}
185
186void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
187 u16 clkctrl_offs)
188{
189}
diff --git a/arch/arm/mach-omap2/prm-regbits-33xx.h b/arch/arm/mach-omap2/prm-regbits-33xx.h
new file mode 100644
index 000000000000..0221b5c20e87
--- /dev/null
+++ b/arch/arm/mach-omap2/prm-regbits-33xx.h
@@ -0,0 +1,357 @@
1/*
2 * AM33XX PRM_XXX register bits
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_33XX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_33XX_H
18
19#include "prm.h"
20
21/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
22#define AM33XX_ABBOFF_ACT_EXPORT_SHIFT 1
23#define AM33XX_ABBOFF_ACT_EXPORT_MASK (1 << 1)
24
25/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
26#define AM33XX_ABBOFF_SLEEP_EXPORT_SHIFT 2
27#define AM33XX_ABBOFF_SLEEP_EXPORT_MASK (1 << 2)
28
29/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
30#define AM33XX_AIPOFF_SHIFT 8
31#define AM33XX_AIPOFF_MASK (1 << 8)
32
33/* Used by PM_WKUP_PWRSTST */
34#define AM33XX_DEBUGSS_MEM_STATEST_SHIFT 17
35#define AM33XX_DEBUGSS_MEM_STATEST_MASK (0x3 << 17)
36
37/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
38#define AM33XX_DISABLE_RTA_EXPORT_SHIFT 0
39#define AM33XX_DISABLE_RTA_EXPORT_MASK (1 << 0)
40
41/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
42#define AM33XX_DPLL_CORE_RECAL_EN_SHIFT 12
43#define AM33XX_DPLL_CORE_RECAL_EN_MASK (1 << 12)
44
45/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
46#define AM33XX_DPLL_CORE_RECAL_ST_SHIFT 12
47#define AM33XX_DPLL_CORE_RECAL_ST_MASK (1 << 12)
48
49/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
50#define AM33XX_DPLL_DDR_RECAL_EN_SHIFT 14
51#define AM33XX_DPLL_DDR_RECAL_EN_MASK (1 << 14)
52
53/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
54#define AM33XX_DPLL_DDR_RECAL_ST_SHIFT 14
55#define AM33XX_DPLL_DDR_RECAL_ST_MASK (1 << 14)
56
57/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
58#define AM33XX_DPLL_DISP_RECAL_EN_SHIFT 15
59#define AM33XX_DPLL_DISP_RECAL_EN_MASK (1 << 15)
60
61/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
62#define AM33XX_DPLL_DISP_RECAL_ST_SHIFT 13
63#define AM33XX_DPLL_DISP_RECAL_ST_MASK (1 << 13)
64
65/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
66#define AM33XX_DPLL_MPU_RECAL_EN_SHIFT 11
67#define AM33XX_DPLL_MPU_RECAL_EN_MASK (1 << 11)
68
69/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
70#define AM33XX_DPLL_MPU_RECAL_ST_SHIFT 11
71#define AM33XX_DPLL_MPU_RECAL_ST_MASK (1 << 11)
72
73/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
74#define AM33XX_DPLL_PER_RECAL_EN_SHIFT 13
75#define AM33XX_DPLL_PER_RECAL_EN_MASK (1 << 13)
76
77/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
78#define AM33XX_DPLL_PER_RECAL_ST_SHIFT 15
79#define AM33XX_DPLL_PER_RECAL_ST_MASK (1 << 15)
80
81/* Used by RM_WKUP_RSTST */
82#define AM33XX_EMULATION_M3_RST_SHIFT 6
83#define AM33XX_EMULATION_M3_RST_MASK (1 << 6)
84
85/* Used by RM_MPU_RSTST */
86#define AM33XX_EMULATION_MPU_RST_SHIFT 5
87#define AM33XX_EMULATION_MPU_RST_MASK (1 << 5)
88
89/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
90#define AM33XX_ENFUNC1_EXPORT_SHIFT 3
91#define AM33XX_ENFUNC1_EXPORT_MASK (1 << 3)
92
93/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
94#define AM33XX_ENFUNC3_EXPORT_SHIFT 5
95#define AM33XX_ENFUNC3_EXPORT_MASK (1 << 5)
96
97/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
98#define AM33XX_ENFUNC4_SHIFT 6
99#define AM33XX_ENFUNC4_MASK (1 << 6)
100
101/* Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_MPU_SETUP */
102#define AM33XX_ENFUNC5_SHIFT 7
103#define AM33XX_ENFUNC5_MASK (1 << 7)
104
105/* Used by PRM_RSTST */
106#define AM33XX_EXTERNAL_WARM_RST_SHIFT 5
107#define AM33XX_EXTERNAL_WARM_RST_MASK (1 << 5)
108
109/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
110#define AM33XX_FORCEWKUP_EN_SHIFT 10
111#define AM33XX_FORCEWKUP_EN_MASK (1 << 10)
112
113/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
114#define AM33XX_FORCEWKUP_ST_SHIFT 10
115#define AM33XX_FORCEWKUP_ST_MASK (1 << 10)
116
117/* Used by PM_GFX_PWRSTCTRL */
118#define AM33XX_GFX_MEM_ONSTATE_SHIFT 17
119#define AM33XX_GFX_MEM_ONSTATE_MASK (0x3 << 17)
120
121/* Used by PM_GFX_PWRSTCTRL */
122#define AM33XX_GFX_MEM_RETSTATE_SHIFT 6
123#define AM33XX_GFX_MEM_RETSTATE_MASK (1 << 6)
124
125/* Used by PM_GFX_PWRSTST */
126#define AM33XX_GFX_MEM_STATEST_SHIFT 4
127#define AM33XX_GFX_MEM_STATEST_MASK (0x3 << 4)
128
129/* Used by RM_GFX_RSTCTRL, RM_GFX_RSTST */
130#define AM33XX_GFX_RST_SHIFT 0
131#define AM33XX_GFX_RST_MASK (1 << 0)
132
133/* Used by PRM_RSTST */
134#define AM33XX_GLOBAL_COLD_RST_SHIFT 0
135#define AM33XX_GLOBAL_COLD_RST_MASK (1 << 0)
136
137/* Used by PRM_RSTST */
138#define AM33XX_GLOBAL_WARM_SW_RST_SHIFT 1
139#define AM33XX_GLOBAL_WARM_SW_RST_MASK (1 << 1)
140
141/* Used by RM_WKUP_RSTST */
142#define AM33XX_ICECRUSHER_M3_RST_SHIFT 7
143#define AM33XX_ICECRUSHER_M3_RST_MASK (1 << 7)
144
145/* Used by RM_MPU_RSTST */
146#define AM33XX_ICECRUSHER_MPU_RST_SHIFT 6
147#define AM33XX_ICECRUSHER_MPU_RST_MASK (1 << 6)
148
149/* Used by PRM_RSTST */
150#define AM33XX_ICEPICK_RST_SHIFT 9
151#define AM33XX_ICEPICK_RST_MASK (1 << 9)
152
153/* Used by RM_PER_RSTCTRL */
154#define AM33XX_PRUSS_LRST_SHIFT 1
155#define AM33XX_PRUSS_LRST_MASK (1 << 1)
156
157/* Used by PM_PER_PWRSTCTRL */
158#define AM33XX_PRUSS_MEM_ONSTATE_SHIFT 5
159#define AM33XX_PRUSS_MEM_ONSTATE_MASK (0x3 << 5)
160
161/* Used by PM_PER_PWRSTCTRL */
162#define AM33XX_PRUSS_MEM_RETSTATE_SHIFT 7
163#define AM33XX_PRUSS_MEM_RETSTATE_MASK (1 << 7)
164
165/* Used by PM_PER_PWRSTST */
166#define AM33XX_PRUSS_MEM_STATEST_SHIFT 23
167#define AM33XX_PRUSS_MEM_STATEST_MASK (0x3 << 23)
168
169/*
170 * Used by PM_GFX_PWRSTST, PM_CEFUSE_PWRSTST, PM_PER_PWRSTST, PM_MPU_PWRSTST,
171 * PM_WKUP_PWRSTST, PM_RTC_PWRSTST
172 */
173#define AM33XX_INTRANSITION_SHIFT 20
174#define AM33XX_INTRANSITION_MASK (1 << 20)
175
176/* Used by PM_CEFUSE_PWRSTST */
177#define AM33XX_LASTPOWERSTATEENTERED_SHIFT 24
178#define AM33XX_LASTPOWERSTATEENTERED_MASK (0x3 << 24)
179
180/* Used by PM_GFX_PWRSTCTRL, PM_MPU_PWRSTCTRL, PM_RTC_PWRSTCTRL */
181#define AM33XX_LOGICRETSTATE_SHIFT 2
182#define AM33XX_LOGICRETSTATE_MASK (1 << 2)
183
184/* Renamed from LOGICRETSTATE Used by PM_PER_PWRSTCTRL, PM_WKUP_PWRSTCTRL */
185#define AM33XX_LOGICRETSTATE_3_3_SHIFT 3
186#define AM33XX_LOGICRETSTATE_3_3_MASK (1 << 3)
187
188/*
189 * Used by PM_GFX_PWRSTST, PM_CEFUSE_PWRSTST, PM_PER_PWRSTST, PM_MPU_PWRSTST,
190 * PM_WKUP_PWRSTST, PM_RTC_PWRSTST
191 */
192#define AM33XX_LOGICSTATEST_SHIFT 2
193#define AM33XX_LOGICSTATEST_MASK (1 << 2)
194
195/*
196 * Used by PM_GFX_PWRSTCTRL, PM_CEFUSE_PWRSTCTRL, PM_PER_PWRSTCTRL,
197 * PM_MPU_PWRSTCTRL, PM_WKUP_PWRSTCTRL, PM_RTC_PWRSTCTRL
198 */
199#define AM33XX_LOWPOWERSTATECHANGE_SHIFT 4
200#define AM33XX_LOWPOWERSTATECHANGE_MASK (1 << 4)
201
202/* Used by PM_MPU_PWRSTCTRL */
203#define AM33XX_MPU_L1_ONSTATE_SHIFT 18
204#define AM33XX_MPU_L1_ONSTATE_MASK (0x3 << 18)
205
206/* Used by PM_MPU_PWRSTCTRL */
207#define AM33XX_MPU_L1_RETSTATE_SHIFT 22
208#define AM33XX_MPU_L1_RETSTATE_MASK (1 << 22)
209
210/* Used by PM_MPU_PWRSTST */
211#define AM33XX_MPU_L1_STATEST_SHIFT 6
212#define AM33XX_MPU_L1_STATEST_MASK (0x3 << 6)
213
214/* Used by PM_MPU_PWRSTCTRL */
215#define AM33XX_MPU_L2_ONSTATE_SHIFT 20
216#define AM33XX_MPU_L2_ONSTATE_MASK (0x3 << 20)
217
218/* Used by PM_MPU_PWRSTCTRL */
219#define AM33XX_MPU_L2_RETSTATE_SHIFT 23
220#define AM33XX_MPU_L2_RETSTATE_MASK (1 << 23)
221
222/* Used by PM_MPU_PWRSTST */
223#define AM33XX_MPU_L2_STATEST_SHIFT 8
224#define AM33XX_MPU_L2_STATEST_MASK (0x3 << 8)
225
226/* Used by PM_MPU_PWRSTCTRL */
227#define AM33XX_MPU_RAM_ONSTATE_SHIFT 16
228#define AM33XX_MPU_RAM_ONSTATE_MASK (0x3 << 16)
229
230/* Used by PM_MPU_PWRSTCTRL */
231#define AM33XX_MPU_RAM_RETSTATE_SHIFT 24
232#define AM33XX_MPU_RAM_RETSTATE_MASK (1 << 24)
233
234/* Used by PM_MPU_PWRSTST */
235#define AM33XX_MPU_RAM_STATEST_SHIFT 4
236#define AM33XX_MPU_RAM_STATEST_MASK (0x3 << 4)
237
238/* Used by PRM_RSTST */
239#define AM33XX_MPU_SECURITY_VIOL_RST_SHIFT 2
240#define AM33XX_MPU_SECURITY_VIOL_RST_MASK (1 << 2)
241
242/* Used by PRM_SRAM_COUNT */
243#define AM33XX_PCHARGECNT_VALUE_SHIFT 0
244#define AM33XX_PCHARGECNT_VALUE_MASK (0x3f << 0)
245
246/* Used by RM_PER_RSTCTRL */
247#define AM33XX_PCI_LRST_SHIFT 0
248#define AM33XX_PCI_LRST_MASK (1 << 0)
249
250/* Renamed from PCI_LRST Used by RM_PER_RSTST */
251#define AM33XX_PCI_LRST_5_5_SHIFT 5
252#define AM33XX_PCI_LRST_5_5_MASK (1 << 5)
253
254/* Used by PM_PER_PWRSTCTRL */
255#define AM33XX_PER_MEM_ONSTATE_SHIFT 25
256#define AM33XX_PER_MEM_ONSTATE_MASK (0x3 << 25)
257
258/* Used by PM_PER_PWRSTCTRL */
259#define AM33XX_PER_MEM_RETSTATE_SHIFT 29
260#define AM33XX_PER_MEM_RETSTATE_MASK (1 << 29)
261
262/* Used by PM_PER_PWRSTST */
263#define AM33XX_PER_MEM_STATEST_SHIFT 17
264#define AM33XX_PER_MEM_STATEST_MASK (0x3 << 17)
265
266/*
267 * Used by PM_GFX_PWRSTCTRL, PM_CEFUSE_PWRSTCTRL, PM_PER_PWRSTCTRL,
268 * PM_MPU_PWRSTCTRL
269 */
270#define AM33XX_POWERSTATE_SHIFT 0
271#define AM33XX_POWERSTATE_MASK (0x3 << 0)
272
273/* Used by PM_GFX_PWRSTST, PM_CEFUSE_PWRSTST, PM_PER_PWRSTST, PM_MPU_PWRSTST */
274#define AM33XX_POWERSTATEST_SHIFT 0
275#define AM33XX_POWERSTATEST_MASK (0x3 << 0)
276
277/* Used by PM_PER_PWRSTCTRL */
278#define AM33XX_RAM_MEM_ONSTATE_SHIFT 30
279#define AM33XX_RAM_MEM_ONSTATE_MASK (0x3 << 30)
280
281/* Used by PM_PER_PWRSTCTRL */
282#define AM33XX_RAM_MEM_RETSTATE_SHIFT 27
283#define AM33XX_RAM_MEM_RETSTATE_MASK (1 << 27)
284
285/* Used by PM_PER_PWRSTST */
286#define AM33XX_RAM_MEM_STATEST_SHIFT 21
287#define AM33XX_RAM_MEM_STATEST_MASK (0x3 << 21)
288
289/* Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_MPU_CTRL */
290#define AM33XX_RETMODE_ENABLE_SHIFT 0
291#define AM33XX_RETMODE_ENABLE_MASK (1 << 0)
292
293/* Used by REVISION_PRM */
294#define AM33XX_REV_SHIFT 0
295#define AM33XX_REV_MASK (0xff << 0)
296
297/* Used by PRM_RSTTIME */
298#define AM33XX_RSTTIME1_SHIFT 0
299#define AM33XX_RSTTIME1_MASK (0xff << 0)
300
301/* Used by PRM_RSTTIME */
302#define AM33XX_RSTTIME2_SHIFT 8
303#define AM33XX_RSTTIME2_MASK (0x1f << 8)
304
305/* Used by PRM_RSTCTRL */
306#define AM33XX_RST_GLOBAL_COLD_SW_SHIFT 1
307#define AM33XX_RST_GLOBAL_COLD_SW_MASK (1 << 1)
308
309/* Used by PRM_RSTCTRL */
310#define AM33XX_RST_GLOBAL_WARM_SW_SHIFT 0
311#define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0)
312
313/* Used by PRM_SRAM_COUNT */
314#define AM33XX_SLPCNT_VALUE_SHIFT 16
315#define AM33XX_SLPCNT_VALUE_MASK (0xff << 16)
316
317/* Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_MPU_CTRL */
318#define AM33XX_SRAMLDO_STATUS_SHIFT 8
319#define AM33XX_SRAMLDO_STATUS_MASK (1 << 8)
320
321/* Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_MPU_CTRL */
322#define AM33XX_SRAM_IN_TRANSITION_SHIFT 9
323#define AM33XX_SRAM_IN_TRANSITION_MASK (1 << 9)
324
325/* Used by PRM_SRAM_COUNT */
326#define AM33XX_STARTUP_COUNT_SHIFT 24
327#define AM33XX_STARTUP_COUNT_MASK (0xff << 24)
328
329/* Used by PRM_IRQENABLE_M3, PRM_IRQENABLE_MPU */
330#define AM33XX_TRANSITION_EN_SHIFT 8
331#define AM33XX_TRANSITION_EN_MASK (1 << 8)
332
333/* Used by PRM_IRQSTATUS_M3, PRM_IRQSTATUS_MPU */
334#define AM33XX_TRANSITION_ST_SHIFT 8
335#define AM33XX_TRANSITION_ST_MASK (1 << 8)
336
337/* Used by PRM_SRAM_COUNT */
338#define AM33XX_VSETUPCNT_VALUE_SHIFT 8
339#define AM33XX_VSETUPCNT_VALUE_MASK (0xff << 8)
340
341/* Used by PRM_RSTST */
342#define AM33XX_WDT0_RST_SHIFT 3
343#define AM33XX_WDT0_RST_MASK (1 << 3)
344
345/* Used by PRM_RSTST */
346#define AM33XX_WDT1_RST_SHIFT 4
347#define AM33XX_WDT1_RST_MASK (1 << 4)
348
349/* Used by RM_WKUP_RSTCTRL */
350#define AM33XX_WKUP_M3_LRST_SHIFT 3
351#define AM33XX_WKUP_M3_LRST_MASK (1 << 3)
352
353/* Renamed from WKUP_M3_LRST Used by RM_WKUP_RSTST */
354#define AM33XX_WKUP_M3_LRST_5_5_SHIFT 5
355#define AM33XX_WKUP_M3_LRST_5_5_MASK (1 << 5)
356
357#endif
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 9ce765407ad5..a0309dea6794 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -15,6 +15,7 @@
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>
18 19
19#include "common.h" 20#include "common.h"
20#include <plat/cpu.h> 21#include <plat/cpu.h>
@@ -301,10 +302,65 @@ void omap3xxx_prm_restore_irqen(u32 *saved_mask)
301 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 302 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
302} 303}
303 304
305/**
306 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
307 *
308 * Clear any previously-latched I/O wakeup events and ensure that the
309 * I/O wakeup gates are aligned with the current mux settings. Works
310 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
311 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
312 * return value.
313 */
314void omap3xxx_prm_reconfigure_io_chain(void)
315{
316 int i = 0;
317
318 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
319 PM_WKEN);
320
321 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
322 OMAP3430_ST_IO_CHAIN_MASK,
323 MAX_IOPAD_LATCH_TIME, i);
324 if (i == MAX_IOPAD_LATCH_TIME)
325 pr_warn("PRM: I/O chain clock line assertion timed out\n");
326
327 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
328 PM_WKEN);
329
330 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
331 PM_WKST);
332
333 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
334}
335
336/**
337 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
338 *
339 * Activates the I/O wakeup event latches and allows events logged by
340 * those latches to signal a wakeup event to the PRCM. For I/O
341 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
342 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
343 * No return value.
344 */
345static void __init omap3xxx_prm_enable_io_wakeup(void)
346{
347 if (omap3_has_io_wakeup())
348 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
349 PM_WKEN);
350}
351
304static int __init omap3xxx_prcm_init(void) 352static int __init omap3xxx_prcm_init(void)
305{ 353{
306 if (cpu_is_omap34xx()) 354 int ret = 0;
307 return omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 355
308 return 0; 356 if (cpu_is_omap34xx()) {
357 omap3xxx_prm_enable_io_wakeup();
358 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
359 if (!ret)
360 irq_set_status_flags(omap_prcm_event_to_irq("io"),
361 IRQ_NOAUTOEN);
362 }
363
364 return ret;
309} 365}
310subsys_initcall(omap3xxx_prcm_init); 366subsys_initcall(omap3xxx_prcm_init);
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 70ac2a19dc5f..c19d249b4816 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -228,68 +228,6 @@
228 228
229 229
230#ifndef __ASSEMBLER__ 230#ifndef __ASSEMBLER__
231/*
232 * Stub omap2xxx/omap3xxx functions so that common files
233 * continue to build when custom builds are used
234 */
235#if defined(CONFIG_ARCH_OMAP4) && !(defined(CONFIG_ARCH_OMAP2) || \
236 defined(CONFIG_ARCH_OMAP3))
237static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
238{
239 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
240 "not suppose to be used on omap4\n");
241 return 0;
242}
243static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
244{
245 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
246 "not suppose to be used on omap4\n");
247}
248static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits,
249 s16 module, s16 idx)
250{
251 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
252 "not suppose to be used on omap4\n");
253 return 0;
254}
255static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
256{
257 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
258 "not suppose to be used on omap4\n");
259 return 0;
260}
261static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
262{
263 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
264 "not suppose to be used on omap4\n");
265 return 0;
266}
267static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
268{
269 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
270 "not suppose to be used on omap4\n");
271 return 0;
272}
273static inline int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
274{
275 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
276 "not suppose to be used on omap4\n");
277 return 0;
278}
279static inline int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
280{
281 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
282 "not suppose to be used on omap4\n");
283 return 0;
284}
285static inline int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift,
286 u8 st_shift)
287{
288 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
289 "not suppose to be used on omap4\n");
290 return 0;
291}
292#else
293/* Power/reset management domain register get/set */ 231/* Power/reset management domain register get/set */
294extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx); 232extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx);
295extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx); 233extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx);
@@ -315,15 +253,15 @@ extern u32 omap3_prm_vcvp_read(u8 offset);
315extern void omap3_prm_vcvp_write(u32 val, u8 offset); 253extern void omap3_prm_vcvp_write(u32 val, u8 offset);
316extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 254extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
317 255
256extern void omap3xxx_prm_reconfigure_io_chain(void);
257
318/* PRM interrupt-related functions */ 258/* PRM interrupt-related functions */
319extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); 259extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
320extern void omap3xxx_prm_ocp_barrier(void); 260extern void omap3xxx_prm_ocp_barrier(void);
321extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); 261extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
322extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); 262extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
323 263
324#endif /* CONFIG_ARCH_OMAP4 */ 264#endif /* __ASSEMBLER */
325
326#endif
327 265
328/* 266/*
329 * Bits common to specific registers 267 * Bits common to specific registers
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
new file mode 100644
index 000000000000..e7dbb6cf1255
--- /dev/null
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -0,0 +1,135 @@
1/*
2 * AM33XX PRM functions
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/errno.h>
19#include <linux/err.h>
20#include <linux/io.h>
21
22#include <plat/common.h>
23
24#include "common.h"
25#include "prm33xx.h"
26#include "prm-regbits-33xx.h"
27
28/* Read a register in a PRM instance */
29u32 am33xx_prm_read_reg(s16 inst, u16 idx)
30{
31 return __raw_readl(prm_base + inst + idx);
32}
33
34/* Write into a register in a PRM instance */
35void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx)
36{
37 __raw_writel(val, prm_base + inst + idx);
38}
39
40/* Read-modify-write a register in PRM. Caller must lock */
41u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
42{
43 u32 v;
44
45 v = am33xx_prm_read_reg(inst, idx);
46 v &= ~mask;
47 v |= bits;
48 am33xx_prm_write_reg(v, inst, idx);
49
50 return v;
51}
52
53/**
54 * am33xx_prm_is_hardreset_asserted - read the HW reset line state of
55 * submodules contained in the hwmod module
56 * @shift: register bit shift corresponding to the reset line to check
57 * @inst: CM instance register offset (*_INST macro)
58 * @rstctrl_offs: RM_RSTCTRL register address offset for this module
59 *
60 * Returns 1 if the (sub)module hardreset line is currently asserted,
61 * 0 if the (sub)module hardreset line is not currently asserted, or
62 * -EINVAL upon parameter error.
63 */
64int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst, u16 rstctrl_offs)
65{
66 u32 v;
67
68 v = am33xx_prm_read_reg(inst, rstctrl_offs);
69 v &= 1 << shift;
70 v >>= shift;
71
72 return v;
73}
74
75/**
76 * am33xx_prm_assert_hardreset - assert the HW reset line of a submodule
77 * @shift: register bit shift corresponding to the reset line to assert
78 * @inst: CM instance register offset (*_INST macro)
79 * @rstctrl_reg: RM_RSTCTRL register address for this module
80 *
81 * Some IPs like dsp, ipu or iva contain processors that require an HW
82 * reset line to be asserted / deasserted in order to fully enable the
83 * IP. These modules may have multiple hard-reset lines that reset
84 * different 'submodules' inside the IP block. This function will
85 * place the submodule into reset. Returns 0 upon success or -EINVAL
86 * upon an argument error.
87 */
88int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs)
89{
90 u32 mask = 1 << shift;
91
92 am33xx_prm_rmw_reg_bits(mask, mask, inst, rstctrl_offs);
93
94 return 0;
95}
96
97/**
98 * am33xx_prm_deassert_hardreset - deassert a submodule hardreset line and
99 * wait
100 * @shift: register bit shift corresponding to the reset line to deassert
101 * @inst: CM instance register offset (*_INST macro)
102 * @rstctrl_reg: RM_RSTCTRL register address for this module
103 * @rstst_reg: RM_RSTST register address for this module
104 *
105 * Some IPs like dsp, ipu or iva contain processors that require an HW
106 * reset line to be asserted / deasserted in order to fully enable the
107 * IP. These modules may have multiple hard-reset lines that reset
108 * different 'submodules' inside the IP block. This function will
109 * take the submodule out of reset and wait until the PRCM indicates
110 * that the reset has completed before returning. Returns 0 upon success or
111 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
112 * of reset, or -EBUSY if the submodule did not exit reset promptly.
113 */
114int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
115 u16 rstctrl_offs, u16 rstst_offs)
116{
117 int c;
118 u32 mask = 1 << shift;
119
120 /* Check the current status to avoid de-asserting the line twice */
121 if (am33xx_prm_is_hardreset_asserted(shift, inst, rstctrl_offs) == 0)
122 return -EEXIST;
123
124 /* Clear the reset status by writing 1 to the status bit */
125 am33xx_prm_rmw_reg_bits(0xffffffff, mask, inst, rstst_offs);
126 /* de-assert the reset control line */
127 am33xx_prm_rmw_reg_bits(mask, 0, inst, rstctrl_offs);
128 /* wait the status to be set */
129
130 omap_test_timeout(am33xx_prm_is_hardreset_asserted(shift, inst,
131 rstst_offs),
132 MAX_MODULE_HARDRESET_WAIT, c);
133
134 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
135}
diff --git a/arch/arm/mach-omap2/prm33xx.h b/arch/arm/mach-omap2/prm33xx.h
new file mode 100644
index 000000000000..3f25c563a821
--- /dev/null
+++ b/arch/arm/mach-omap2/prm33xx.h
@@ -0,0 +1,129 @@
1/*
2 * AM33XX PRM instance offset macros
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM33XX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM33XX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21
22#define AM33XX_PRM_BASE 0x44E00000
23
24#define AM33XX_PRM_REGADDR(inst, reg) \
25 AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRM_BASE + (inst) + (reg))
26
27
28/* PRM instances */
29#define AM33XX_PRM_OCP_SOCKET_MOD 0x0B00
30#define AM33XX_PRM_PER_MOD 0x0C00
31#define AM33XX_PRM_WKUP_MOD 0x0D00
32#define AM33XX_PRM_MPU_MOD 0x0E00
33#define AM33XX_PRM_DEVICE_MOD 0x0F00
34#define AM33XX_PRM_RTC_MOD 0x1000
35#define AM33XX_PRM_GFX_MOD 0x1100
36#define AM33XX_PRM_CEFUSE_MOD 0x1200
37
38/* PRM */
39
40/* PRM.OCP_SOCKET_PRM register offsets */
41#define AM33XX_REVISION_PRM_OFFSET 0x0000
42#define AM33XX_REVISION_PRM AM33XX_PRM_REGADDR(AM33XX_PRM_OCP_SOCKET_MOD, 0x0000)
43#define AM33XX_PRM_IRQSTATUS_MPU_OFFSET 0x0004
44#define AM33XX_PRM_IRQSTATUS_MPU AM33XX_PRM_REGADDR(AM33XX_PRM_OCP_SOCKET_MOD, 0x0004)
45#define AM33XX_PRM_IRQENABLE_MPU_OFFSET 0x0008
46#define AM33XX_PRM_IRQENABLE_MPU AM33XX_PRM_REGADDR(AM33XX_PRM_OCP_SOCKET_MOD, 0x0008)
47#define AM33XX_PRM_IRQSTATUS_M3_OFFSET 0x000c
48#define AM33XX_PRM_IRQSTATUS_M3 AM33XX_PRM_REGADDR(AM33XX_PRM_OCP_SOCKET_MOD, 0x000c)
49#define AM33XX_PRM_IRQENABLE_M3_OFFSET 0x0010
50#define AM33XX_PRM_IRQENABLE_M3 AM33XX_PRM_REGADDR(AM33XX_PRM_OCP_SOCKET_MOD, 0x0010)
51
52/* PRM.PER_PRM register offsets */
53#define AM33XX_RM_PER_RSTCTRL_OFFSET 0x0000
54#define AM33XX_RM_PER_RSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_PER_MOD, 0x0000)
55#define AM33XX_RM_PER_RSTST_OFFSET 0x0004
56#define AM33XX_RM_PER_RSTST AM33XX_PRM_REGADDR(AM33XX_PRM_PER_MOD, 0x0004)
57#define AM33XX_PM_PER_PWRSTST_OFFSET 0x0008
58#define AM33XX_PM_PER_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_PER_MOD, 0x0008)
59#define AM33XX_PM_PER_PWRSTCTRL_OFFSET 0x000c
60#define AM33XX_PM_PER_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_PER_MOD, 0x000c)
61
62/* PRM.WKUP_PRM register offsets */
63#define AM33XX_RM_WKUP_RSTCTRL_OFFSET 0x0000
64#define AM33XX_RM_WKUP_RSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_WKUP_MOD, 0x0000)
65#define AM33XX_PM_WKUP_PWRSTCTRL_OFFSET 0x0004
66#define AM33XX_PM_WKUP_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_WKUP_MOD, 0x0004)
67#define AM33XX_PM_WKUP_PWRSTST_OFFSET 0x0008
68#define AM33XX_PM_WKUP_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_WKUP_MOD, 0x0008)
69#define AM33XX_RM_WKUP_RSTST_OFFSET 0x000c
70#define AM33XX_RM_WKUP_RSTST AM33XX_PRM_REGADDR(AM33XX_PRM_WKUP_MOD, 0x000c)
71
72/* PRM.MPU_PRM register offsets */
73#define AM33XX_PM_MPU_PWRSTCTRL_OFFSET 0x0000
74#define AM33XX_PM_MPU_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_MPU_MOD, 0x0000)
75#define AM33XX_PM_MPU_PWRSTST_OFFSET 0x0004
76#define AM33XX_PM_MPU_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_MPU_MOD, 0x0004)
77#define AM33XX_RM_MPU_RSTST_OFFSET 0x0008
78#define AM33XX_RM_MPU_RSTST AM33XX_PRM_REGADDR(AM33XX_PRM_MPU_MOD, 0x0008)
79
80/* PRM.DEVICE_PRM register offsets */
81#define AM33XX_PRM_RSTCTRL_OFFSET 0x0000
82#define AM33XX_PRM_RSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0000)
83#define AM33XX_PRM_RSTTIME_OFFSET 0x0004
84#define AM33XX_PRM_RSTTIME AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0004)
85#define AM33XX_PRM_RSTST_OFFSET 0x0008
86#define AM33XX_PRM_RSTST AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0008)
87#define AM33XX_PRM_SRAM_COUNT_OFFSET 0x000c
88#define AM33XX_PRM_SRAM_COUNT AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x000c)
89#define AM33XX_PRM_LDO_SRAM_CORE_SETUP_OFFSET 0x0010
90#define AM33XX_PRM_LDO_SRAM_CORE_SETUP AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0010)
91#define AM33XX_PRM_LDO_SRAM_CORE_CTRL_OFFSET 0x0014
92#define AM33XX_PRM_LDO_SRAM_CORE_CTRL AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0014)
93#define AM33XX_PRM_LDO_SRAM_MPU_SETUP_OFFSET 0x0018
94#define AM33XX_PRM_LDO_SRAM_MPU_SETUP AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x0018)
95#define AM33XX_PRM_LDO_SRAM_MPU_CTRL_OFFSET 0x001c
96#define AM33XX_PRM_LDO_SRAM_MPU_CTRL AM33XX_PRM_REGADDR(AM33XX_PRM_DEVICE_MOD, 0x001c)
97
98/* PRM.RTC_PRM register offsets */
99#define AM33XX_PM_RTC_PWRSTCTRL_OFFSET 0x0000
100#define AM33XX_PM_RTC_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_RTC_MOD, 0x0000)
101#define AM33XX_PM_RTC_PWRSTST_OFFSET 0x0004
102#define AM33XX_PM_RTC_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_RTC_MOD, 0x0004)
103
104/* PRM.GFX_PRM register offsets */
105#define AM33XX_PM_GFX_PWRSTCTRL_OFFSET 0x0000
106#define AM33XX_PM_GFX_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_GFX_MOD, 0x0000)
107#define AM33XX_RM_GFX_RSTCTRL_OFFSET 0x0004
108#define AM33XX_RM_GFX_RSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_GFX_MOD, 0x0004)
109#define AM33XX_PM_GFX_PWRSTST_OFFSET 0x0010
110#define AM33XX_PM_GFX_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_GFX_MOD, 0x0010)
111#define AM33XX_RM_GFX_RSTST_OFFSET 0x0014
112#define AM33XX_RM_GFX_RSTST AM33XX_PRM_REGADDR(AM33XX_PRM_GFX_MOD, 0x0014)
113
114/* PRM.CEFUSE_PRM register offsets */
115#define AM33XX_PM_CEFUSE_PWRSTCTRL_OFFSET 0x0000
116#define AM33XX_PM_CEFUSE_PWRSTCTRL AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0000)
117#define AM33XX_PM_CEFUSE_PWRSTST_OFFSET 0x0004
118#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004)
119
120extern u32 am33xx_prm_read_reg(s16 inst, u16 idx);
121extern void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx);
122extern u32 am33xx_prm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
123extern void am33xx_prm_global_warm_sw_reset(void);
124extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
125 u16 rstctrl_offs);
126extern int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs);
127extern int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
128 u16 rstctrl_offs, u16 rstst_offs);
129#endif
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index f106d21ff581..bb727c2d9337 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -233,10 +233,71 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask)
233 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); 233 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
234} 234}
235 235
236/**
237 * omap44xx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
238 *
239 * Clear any previously-latched I/O wakeup events and ensure that the
240 * I/O wakeup gates are aligned with the current mux settings. Works
241 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
242 * deasserting WUCLKIN and waiting for WUCLKOUT to be deasserted.
243 * No return value. XXX Are the final two steps necessary?
244 */
245void omap44xx_prm_reconfigure_io_chain(void)
246{
247 int i = 0;
248
249 /* Trigger WUCLKIN enable */
250 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK,
251 OMAP4430_WUCLK_CTRL_MASK,
252 OMAP4430_PRM_DEVICE_INST,
253 OMAP4_PRM_IO_PMCTRL_OFFSET);
254 omap_test_timeout(
255 (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
256 OMAP4_PRM_IO_PMCTRL_OFFSET) &
257 OMAP4430_WUCLK_STATUS_MASK) >>
258 OMAP4430_WUCLK_STATUS_SHIFT) == 1),
259 MAX_IOPAD_LATCH_TIME, i);
260 if (i == MAX_IOPAD_LATCH_TIME)
261 pr_warn("PRM: I/O chain clock line assertion timed out\n");
262
263 /* Trigger WUCLKIN disable */
264 omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0,
265 OMAP4430_PRM_DEVICE_INST,
266 OMAP4_PRM_IO_PMCTRL_OFFSET);
267 omap_test_timeout(
268 (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
269 OMAP4_PRM_IO_PMCTRL_OFFSET) &
270 OMAP4430_WUCLK_STATUS_MASK) >>
271 OMAP4430_WUCLK_STATUS_SHIFT) == 0),
272 MAX_IOPAD_LATCH_TIME, i);
273 if (i == MAX_IOPAD_LATCH_TIME)
274 pr_warn("PRM: I/O chain clock line deassertion timed out\n");
275
276 return;
277}
278
279/**
280 * omap44xx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
281 *
282 * Activates the I/O wakeup event latches and allows events logged by
283 * those latches to signal a wakeup event to the PRCM. For I/O wakeups
284 * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
285 * omap44xx_prm_reconfigure_io_chain() must be called. No return value.
286 */
287static void __init omap44xx_prm_enable_io_wakeup(void)
288{
289 omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK,
290 OMAP4430_GLOBAL_WUEN_MASK,
291 OMAP4430_PRM_DEVICE_INST,
292 OMAP4_PRM_IO_PMCTRL_OFFSET);
293}
294
236static int __init omap4xxx_prcm_init(void) 295static int __init omap4xxx_prcm_init(void)
237{ 296{
238 if (cpu_is_omap44xx()) 297 if (cpu_is_omap44xx()) {
298 omap44xx_prm_enable_io_wakeup();
239 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 299 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
300 }
240 return 0; 301 return 0;
241} 302}
242subsys_initcall(omap4xxx_prcm_init); 303subsys_initcall(omap4xxx_prcm_init);
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 7978092946db..ee72ae6bd8c9 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -763,6 +763,8 @@ extern u32 omap4_prm_vcvp_read(u8 offset);
763extern void omap4_prm_vcvp_write(u32 val, u8 offset); 763extern void omap4_prm_vcvp_write(u32 val, u8 offset);
764extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 764extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
765 765
766extern void omap44xx_prm_reconfigure_io_chain(void);
767
766/* PRM interrupt-related functions */ 768/* PRM interrupt-related functions */
767extern void omap44xx_prm_read_pending_irqs(unsigned long *events); 769extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
768extern void omap44xx_prm_ocp_barrier(void); 770extern void omap44xx_prm_ocp_barrier(void);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index dfe00ddb5c60..03b126d9ad94 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -85,7 +85,7 @@ static void omap_prcm_irq_handler(unsigned int irq, struct irq_desc *desc)
85 unsigned long priority_pending[OMAP_PRCM_MAX_NR_PENDING_REG]; 85 unsigned long priority_pending[OMAP_PRCM_MAX_NR_PENDING_REG];
86 struct irq_chip *chip = irq_desc_get_chip(desc); 86 struct irq_chip *chip = irq_desc_get_chip(desc);
87 unsigned int virtirq; 87 unsigned int virtirq;
88 int nr_irqs = prcm_irq_setup->nr_regs * 32; 88 int nr_irq = prcm_irq_setup->nr_regs * 32;
89 89
90 /* 90 /*
91 * If we are suspended, mask all interrupts from PRCM level, 91 * If we are suspended, mask all interrupts from PRCM level,
@@ -110,7 +110,7 @@ static void omap_prcm_irq_handler(unsigned int irq, struct irq_desc *desc)
110 prcm_irq_setup->read_pending_irqs(pending); 110 prcm_irq_setup->read_pending_irqs(pending);
111 111
112 /* No bit set, then all IRQs are handled */ 112 /* No bit set, then all IRQs are handled */
113 if (find_first_bit(pending, nr_irqs) >= nr_irqs) 113 if (find_first_bit(pending, nr_irq) >= nr_irq)
114 break; 114 break;
115 115
116 omap_prcm_events_filter_priority(pending, priority_pending); 116 omap_prcm_events_filter_priority(pending, priority_pending);
@@ -121,11 +121,11 @@ static void omap_prcm_irq_handler(unsigned int irq, struct irq_desc *desc)
121 */ 121 */
122 122
123 /* Serve priority events first */ 123 /* Serve priority events first */
124 for_each_set_bit(virtirq, priority_pending, nr_irqs) 124 for_each_set_bit(virtirq, priority_pending, nr_irq)
125 generic_handle_irq(prcm_irq_setup->base_irq + virtirq); 125 generic_handle_irq(prcm_irq_setup->base_irq + virtirq);
126 126
127 /* Serve normal events next */ 127 /* Serve normal events next */
128 for_each_set_bit(virtirq, pending, nr_irqs) 128 for_each_set_bit(virtirq, pending, nr_irq)
129 generic_handle_irq(prcm_irq_setup->base_irq + virtirq); 129 generic_handle_irq(prcm_irq_setup->base_irq + virtirq);
130 } 130 }
131 if (chip->irq_ack) 131 if (chip->irq_ack)
@@ -319,3 +319,65 @@ err:
319 omap_prcm_irq_cleanup(); 319 omap_prcm_irq_cleanup();
320 return -ENOMEM; 320 return -ENOMEM;
321} 321}
322
323/*
324 * Stubbed functions so that common files continue to build when
325 * custom builds are used
326 * XXX These are temporary and should be removed at the earliest possible
327 * opportunity
328 */
329u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx)
330{
331 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
332 return 0;
333}
334
335void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
336{
337 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
338}
339
340u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits,
341 s16 module, s16 idx)
342{
343 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
344 return 0;
345}
346
347u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
348{
349 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
350 return 0;
351}
352
353u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
354{
355 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
356 return 0;
357}
358
359u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
360{
361 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
362 return 0;
363}
364
365int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
366{
367 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
368 return 0;
369}
370
371int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
372{
373 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
374 return 0;
375}
376
377int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift,
378 u8 st_shift)
379{
380 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
381 return 0;
382}
383
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 292d4aaca068..c1b93c752d70 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -57,6 +57,7 @@ struct omap_uart_state {
57 57
58 struct list_head node; 58 struct list_head node;
59 struct omap_hwmod *oh; 59 struct omap_hwmod *oh;
60 struct omap_device_pad default_omap_uart_pads[2];
60}; 61};
61 62
62static LIST_HEAD(uart_list); 63static LIST_HEAD(uart_list);
@@ -126,11 +127,70 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
126#endif /* CONFIG_PM */ 127#endif /* CONFIG_PM */
127 128
128#ifdef CONFIG_OMAP_MUX 129#ifdef CONFIG_OMAP_MUX
129static void omap_serial_fill_default_pads(struct omap_board_data *bdata) 130
131#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28
132static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN],
133 tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata;
134
135static void __init
136omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata,
137 struct omap_uart_state *uart)
138{
139 uart->default_omap_uart_pads[0].name = rx_pad_name;
140 uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX |
141 OMAP_DEVICE_PAD_WAKEUP;
142 uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT |
143 OMAP_MUX_MODE0;
144 uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0;
145 uart->default_omap_uart_pads[1].name = tx_pad_name;
146 uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT |
147 OMAP_MUX_MODE0;
148 bdata->pads = uart->default_omap_uart_pads;
149 bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads);
150}
151
152static void __init omap_serial_check_wakeup(struct omap_board_data *bdata,
153 struct omap_uart_state *uart)
130{ 154{
155 struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL;
156 struct omap_mux *rx_mux = NULL, *tx_mux = NULL;
157 char *rx_fmt, *tx_fmt;
158 int uart_nr = bdata->id + 1;
159
160 if (bdata->id != 2) {
161 rx_fmt = "uart%d_rx.uart%d_rx";
162 tx_fmt = "uart%d_tx.uart%d_tx";
163 } else {
164 rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx";
165 tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx";
166 }
167
168 snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt,
169 uart_nr, uart_nr);
170 snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt,
171 uart_nr, uart_nr);
172
173 if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 &&
174 omap_mux_get_by_name
175 (tx_pad_name, &tx_partition, &tx_mux) >= 0) {
176 u16 tx_mode, rx_mode;
177
178 tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset);
179 rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset);
180
181 /*
182 * Check if uart is used in default tx/rx mode i.e. in mux mode0
183 * if yes then configure rx pin for wake up capability
184 */
185 if (OMAP_MODE_UART(rx_mode) && OMAP_MODE_UART(tx_mode))
186 omap_serial_fill_uart_tx_rx_pads(bdata, uart);
187 }
131} 188}
132#else 189#else
133static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 190static void __init omap_serial_check_wakeup(struct omap_board_data *bdata,
191 struct omap_uart_state *uart)
192{
193}
134#endif 194#endif
135 195
136static char *cmdline_find_option(char *str) 196static char *cmdline_find_option(char *str)
@@ -287,8 +347,7 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info)
287 bdata.pads = NULL; 347 bdata.pads = NULL;
288 bdata.pads_cnt = 0; 348 bdata.pads_cnt = 0;
289 349
290 if (cpu_is_omap44xx() || cpu_is_omap34xx()) 350 omap_serial_check_wakeup(&bdata, uart);
291 omap_serial_fill_default_pads(&bdata);
292 351
293 if (!info) 352 if (!info)
294 omap_serial_init_port(&bdata, NULL); 353 omap_serial_init_port(&bdata, NULL);
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 955566eefac4..1da8f03c479e 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -11,36 +11,37 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14#include "smartreflex.h" 14#include <linux/power/smartreflex.h>
15#include "voltage.h"
15 16
16static int sr_class3_enable(struct voltagedomain *voltdm) 17static int sr_class3_enable(struct omap_sr *sr)
17{ 18{
18 unsigned long volt = voltdm_get_voltage(voltdm); 19 unsigned long volt = voltdm_get_voltage(sr->voltdm);
19 20
20 if (!volt) { 21 if (!volt) {
21 pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n", 22 pr_warning("%s: Curr voltage unknown. Cannot enable %s\n",
22 __func__, voltdm->name); 23 __func__, sr->name);
23 return -ENODATA; 24 return -ENODATA;
24 } 25 }
25 26
26 omap_vp_enable(voltdm); 27 omap_vp_enable(sr->voltdm);
27 return sr_enable(voltdm, volt); 28 return sr_enable(sr->voltdm, volt);
28} 29}
29 30
30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) 31static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
31{ 32{
32 sr_disable_errgen(voltdm); 33 sr_disable_errgen(sr->voltdm);
33 omap_vp_disable(voltdm); 34 omap_vp_disable(sr->voltdm);
34 sr_disable(voltdm); 35 sr_disable(sr->voltdm);
35 if (is_volt_reset) 36 if (is_volt_reset)
36 voltdm_reset(voltdm); 37 voltdm_reset(sr->voltdm);
37 38
38 return 0; 39 return 0;
39} 40}
40 41
41static int sr_class3_configure(struct voltagedomain *voltdm) 42static int sr_class3_configure(struct omap_sr *sr)
42{ 43{
43 return sr_configure_errgen(voltdm); 44 return sr_configure_errgen(sr->voltdm);
44} 45}
45 46
46/* SR class3 structure */ 47/* SR class3 structure */
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
deleted file mode 100644
index 008fbd7b9352..000000000000
--- a/arch/arm/mach-omap2/smartreflex.c
+++ /dev/null
@@ -1,1165 +0,0 @@
1/*
2 * OMAP SmartReflex Voltage Control
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008 Nokia Corporation
10 * Kalle Jokiniemi
11 *
12 * Copyright (C) 2007 Texas Instruments, Inc.
13 * Lesly A M <x0080970@ti.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#include <linux/module.h>
21#include <linux/interrupt.h>
22#include <linux/clk.h>
23#include <linux/io.h>
24#include <linux/debugfs.h>
25#include <linux/delay.h>
26#include <linux/slab.h>
27#include <linux/pm_runtime.h>
28
29#include "common.h"
30
31#include "pm.h"
32#include "smartreflex.h"
33
34#define SMARTREFLEX_NAME_LEN 16
35#define NVALUE_NAME_LEN 40
36#define SR_DISABLE_TIMEOUT 200
37
38struct omap_sr {
39 struct list_head node;
40 struct platform_device *pdev;
41 struct omap_sr_nvalue_table *nvalue_table;
42 struct voltagedomain *voltdm;
43 struct dentry *dbg_dir;
44 unsigned int irq;
45 int srid;
46 int ip_type;
47 int nvalue_count;
48 bool autocomp_active;
49 u32 clk_length;
50 u32 err_weight;
51 u32 err_minlimit;
52 u32 err_maxlimit;
53 u32 accum_data;
54 u32 senn_avgweight;
55 u32 senp_avgweight;
56 u32 senp_mod;
57 u32 senn_mod;
58 void __iomem *base;
59};
60
61/* sr_list contains all the instances of smartreflex module */
62static LIST_HEAD(sr_list);
63
64static struct omap_sr_class_data *sr_class;
65static struct omap_sr_pmic_data *sr_pmic_data;
66static struct dentry *sr_dbg_dir;
67
68static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
69{
70 __raw_writel(value, (sr->base + offset));
71}
72
73static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask,
74 u32 value)
75{
76 u32 reg_val;
77
78 /*
79 * Smartreflex error config register is special as it contains
80 * certain status bits which if written a 1 into means a clear
81 * of those bits. So in order to make sure no accidental write of
82 * 1 happens to those status bits, do a clear of them in the read
83 * value. This mean this API doesn't rewrite values in these bits
84 * if they are currently set, but does allow the caller to write
85 * those bits.
86 */
87 if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1)
88 mask |= ERRCONFIG_STATUS_V1_MASK;
89 else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2)
90 mask |= ERRCONFIG_VPBOUNDINTST_V2;
91
92 reg_val = __raw_readl(sr->base + offset);
93 reg_val &= ~mask;
94
95 value &= mask;
96
97 reg_val |= value;
98
99 __raw_writel(reg_val, (sr->base + offset));
100}
101
102static inline u32 sr_read_reg(struct omap_sr *sr, unsigned offset)
103{
104 return __raw_readl(sr->base + offset);
105}
106
107static struct omap_sr *_sr_lookup(struct voltagedomain *voltdm)
108{
109 struct omap_sr *sr_info;
110
111 if (!voltdm) {
112 pr_err("%s: Null voltage domain passed!\n", __func__);
113 return ERR_PTR(-EINVAL);
114 }
115
116 list_for_each_entry(sr_info, &sr_list, node) {
117 if (voltdm == sr_info->voltdm)
118 return sr_info;
119 }
120
121 return ERR_PTR(-ENODATA);
122}
123
124static irqreturn_t sr_interrupt(int irq, void *data)
125{
126 struct omap_sr *sr_info = data;
127 u32 status = 0;
128
129 switch (sr_info->ip_type) {
130 case SR_TYPE_V1:
131 /* Read the status bits */
132 status = sr_read_reg(sr_info, ERRCONFIG_V1);
133
134 /* Clear them by writing back */
135 sr_write_reg(sr_info, ERRCONFIG_V1, status);
136 break;
137 case SR_TYPE_V2:
138 /* Read the status bits */
139 status = sr_read_reg(sr_info, IRQSTATUS);
140
141 /* Clear them by writing back */
142 sr_write_reg(sr_info, IRQSTATUS, status);
143 break;
144 default:
145 dev_err(&sr_info->pdev->dev, "UNKNOWN IP type %d\n",
146 sr_info->ip_type);
147 return IRQ_NONE;
148 }
149
150 if (sr_class->notify)
151 sr_class->notify(sr_info->voltdm, status);
152
153 return IRQ_HANDLED;
154}
155
156static void sr_set_clk_length(struct omap_sr *sr)
157{
158 struct clk *sys_ck;
159 u32 sys_clk_speed;
160
161 if (cpu_is_omap34xx())
162 sys_ck = clk_get(NULL, "sys_ck");
163 else
164 sys_ck = clk_get(NULL, "sys_clkin_ck");
165
166 if (IS_ERR(sys_ck)) {
167 dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n",
168 __func__);
169 return;
170 }
171
172 sys_clk_speed = clk_get_rate(sys_ck);
173 clk_put(sys_ck);
174
175 switch (sys_clk_speed) {
176 case 12000000:
177 sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK;
178 break;
179 case 13000000:
180 sr->clk_length = SRCLKLENGTH_13MHZ_SYSCLK;
181 break;
182 case 19200000:
183 sr->clk_length = SRCLKLENGTH_19MHZ_SYSCLK;
184 break;
185 case 26000000:
186 sr->clk_length = SRCLKLENGTH_26MHZ_SYSCLK;
187 break;
188 case 38400000:
189 sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK;
190 break;
191 default:
192 dev_err(&sr->pdev->dev, "%s: Invalid sysclk value: %d\n",
193 __func__, sys_clk_speed);
194 break;
195 }
196}
197
198static void sr_set_regfields(struct omap_sr *sr)
199{
200 /*
201 * For time being these values are defined in smartreflex.h
202 * and populated during init. May be they can be moved to board
203 * file or pmic specific data structure. In that case these structure
204 * fields will have to be populated using the pdata or pmic structure.
205 */
206 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
207 sr->err_weight = OMAP3430_SR_ERRWEIGHT;
208 sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
209 sr->accum_data = OMAP3430_SR_ACCUMDATA;
210 if (!(strcmp(sr->voltdm->name, "mpu"))) {
211 sr->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT;
212 sr->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT;
213 } else {
214 sr->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT;
215 sr->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT;
216 }
217 }
218}
219
220static void sr_start_vddautocomp(struct omap_sr *sr)
221{
222 if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
223 dev_warn(&sr->pdev->dev,
224 "%s: smartreflex class driver not registered\n",
225 __func__);
226 return;
227 }
228
229 if (!sr_class->enable(sr->voltdm))
230 sr->autocomp_active = true;
231}
232
233static void sr_stop_vddautocomp(struct omap_sr *sr)
234{
235 if (!sr_class || !(sr_class->disable)) {
236 dev_warn(&sr->pdev->dev,
237 "%s: smartreflex class driver not registered\n",
238 __func__);
239 return;
240 }
241
242 if (sr->autocomp_active) {
243 sr_class->disable(sr->voltdm, 1);
244 sr->autocomp_active = false;
245 }
246}
247
248/*
249 * This function handles the intializations which have to be done
250 * only when both sr device and class driver regiter has
251 * completed. This will be attempted to be called from both sr class
252 * driver register and sr device intializtion API's. Only one call
253 * will ultimately succeed.
254 *
255 * Currently this function registers interrupt handler for a particular SR
256 * if smartreflex class driver is already registered and has
257 * requested for interrupts and the SR interrupt line in present.
258 */
259static int sr_late_init(struct omap_sr *sr_info)
260{
261 char *name;
262 struct omap_sr_data *pdata = sr_info->pdev->dev.platform_data;
263 struct resource *mem;
264 int ret = 0;
265
266 if (sr_class->notify && sr_class->notify_flags && sr_info->irq) {
267 name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
268 if (name == NULL) {
269 ret = -ENOMEM;
270 goto error;
271 }
272 ret = request_irq(sr_info->irq, sr_interrupt,
273 0, name, sr_info);
274 if (ret)
275 goto error;
276 disable_irq(sr_info->irq);
277 }
278
279 if (pdata && pdata->enable_on_init)
280 sr_start_vddautocomp(sr_info);
281
282 return ret;
283
284error:
285 iounmap(sr_info->base);
286 mem = platform_get_resource(sr_info->pdev, IORESOURCE_MEM, 0);
287 release_mem_region(mem->start, resource_size(mem));
288 list_del(&sr_info->node);
289 dev_err(&sr_info->pdev->dev, "%s: ERROR in registering"
290 "interrupt handler. Smartreflex will"
291 "not function as desired\n", __func__);
292 kfree(name);
293 kfree(sr_info);
294
295 return ret;
296}
297
298static void sr_v1_disable(struct omap_sr *sr)
299{
300 int timeout = 0;
301 int errconf_val = ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST |
302 ERRCONFIG_MCUBOUNDINTST;
303
304 /* Enable MCUDisableAcknowledge interrupt */
305 sr_modify_reg(sr, ERRCONFIG_V1,
306 ERRCONFIG_MCUDISACKINTEN, ERRCONFIG_MCUDISACKINTEN);
307
308 /* SRCONFIG - disable SR */
309 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0);
310
311 /* Disable all other SR interrupts and clear the status as needed */
312 if (sr_read_reg(sr, ERRCONFIG_V1) & ERRCONFIG_VPBOUNDINTST_V1)
313 errconf_val |= ERRCONFIG_VPBOUNDINTST_V1;
314 sr_modify_reg(sr, ERRCONFIG_V1,
315 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN |
316 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1),
317 errconf_val);
318
319 /*
320 * Wait for SR to be disabled.
321 * wait until ERRCONFIG.MCUDISACKINTST = 1. Typical latency is 1us.
322 */
323 omap_test_timeout((sr_read_reg(sr, ERRCONFIG_V1) &
324 ERRCONFIG_MCUDISACKINTST), SR_DISABLE_TIMEOUT,
325 timeout);
326
327 if (timeout >= SR_DISABLE_TIMEOUT)
328 dev_warn(&sr->pdev->dev, "%s: Smartreflex disable timedout\n",
329 __func__);
330
331 /* Disable MCUDisableAcknowledge interrupt & clear pending interrupt */
332 sr_modify_reg(sr, ERRCONFIG_V1, ERRCONFIG_MCUDISACKINTEN,
333 ERRCONFIG_MCUDISACKINTST);
334}
335
336static void sr_v2_disable(struct omap_sr *sr)
337{
338 int timeout = 0;
339
340 /* Enable MCUDisableAcknowledge interrupt */
341 sr_write_reg(sr, IRQENABLE_SET, IRQENABLE_MCUDISABLEACKINT);
342
343 /* SRCONFIG - disable SR */
344 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0);
345
346 /*
347 * Disable all other SR interrupts and clear the status
348 * write to status register ONLY on need basis - only if status
349 * is set.
350 */
351 if (sr_read_reg(sr, ERRCONFIG_V2) & ERRCONFIG_VPBOUNDINTST_V2)
352 sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2,
353 ERRCONFIG_VPBOUNDINTST_V2);
354 else
355 sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2,
356 0x0);
357 sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT |
358 IRQENABLE_MCUVALIDINT |
359 IRQENABLE_MCUBOUNDSINT));
360 sr_write_reg(sr, IRQSTATUS, (IRQSTATUS_MCUACCUMINT |
361 IRQSTATUS_MCVALIDINT |
362 IRQSTATUS_MCBOUNDSINT));
363
364 /*
365 * Wait for SR to be disabled.
366 * wait until IRQSTATUS.MCUDISACKINTST = 1. Typical latency is 1us.
367 */
368 omap_test_timeout((sr_read_reg(sr, IRQSTATUS) &
369 IRQSTATUS_MCUDISABLEACKINT), SR_DISABLE_TIMEOUT,
370 timeout);
371
372 if (timeout >= SR_DISABLE_TIMEOUT)
373 dev_warn(&sr->pdev->dev, "%s: Smartreflex disable timedout\n",
374 __func__);
375
376 /* Disable MCUDisableAcknowledge interrupt & clear pending interrupt */
377 sr_write_reg(sr, IRQENABLE_CLR, IRQENABLE_MCUDISABLEACKINT);
378 sr_write_reg(sr, IRQSTATUS, IRQSTATUS_MCUDISABLEACKINT);
379}
380
381static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 efuse_offs)
382{
383 int i;
384
385 if (!sr->nvalue_table) {
386 dev_warn(&sr->pdev->dev, "%s: Missing ntarget value table\n",
387 __func__);
388 return 0;
389 }
390
391 for (i = 0; i < sr->nvalue_count; i++) {
392 if (sr->nvalue_table[i].efuse_offs == efuse_offs)
393 return sr->nvalue_table[i].nvalue;
394 }
395
396 return 0;
397}
398
399/* Public Functions */
400
401/**
402 * sr_configure_errgen() - Configures the smrtreflex to perform AVS using the
403 * error generator module.
404 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
405 *
406 * This API is to be called from the smartreflex class driver to
407 * configure the error generator module inside the smartreflex module.
408 * SR settings if using the ERROR module inside Smartreflex.
409 * SR CLASS 3 by default uses only the ERROR module where as
410 * SR CLASS 2 can choose between ERROR module and MINMAXAVG
411 * module. Returns 0 on success and error value in case of failure.
412 */
413int sr_configure_errgen(struct voltagedomain *voltdm)
414{
415 u32 sr_config, sr_errconfig, errconfig_offs;
416 u32 vpboundint_en, vpboundint_st;
417 u32 senp_en = 0, senn_en = 0;
418 u8 senp_shift, senn_shift;
419 struct omap_sr *sr = _sr_lookup(voltdm);
420
421 if (IS_ERR(sr)) {
422 pr_warning("%s: omap_sr struct for sr_%s not found\n",
423 __func__, voltdm->name);
424 return PTR_ERR(sr);
425 }
426
427 if (!sr->clk_length)
428 sr_set_clk_length(sr);
429
430 senp_en = sr->senp_mod;
431 senn_en = sr->senn_mod;
432
433 sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) |
434 SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN;
435
436 switch (sr->ip_type) {
437 case SR_TYPE_V1:
438 sr_config |= SRCONFIG_DELAYCTRL;
439 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT;
440 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT;
441 errconfig_offs = ERRCONFIG_V1;
442 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1;
443 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1;
444 break;
445 case SR_TYPE_V2:
446 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT;
447 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT;
448 errconfig_offs = ERRCONFIG_V2;
449 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2;
450 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2;
451 break;
452 default:
453 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
454 "module without specifying the ip\n", __func__);
455 return -EINVAL;
456 }
457
458 sr_config |= ((senn_en << senn_shift) | (senp_en << senp_shift));
459 sr_write_reg(sr, SRCONFIG, sr_config);
460 sr_errconfig = (sr->err_weight << ERRCONFIG_ERRWEIGHT_SHIFT) |
461 (sr->err_maxlimit << ERRCONFIG_ERRMAXLIMIT_SHIFT) |
462 (sr->err_minlimit << ERRCONFIG_ERRMINLIMIT_SHIFT);
463 sr_modify_reg(sr, errconfig_offs, (SR_ERRWEIGHT_MASK |
464 SR_ERRMAXLIMIT_MASK | SR_ERRMINLIMIT_MASK),
465 sr_errconfig);
466
467 /* Enabling the interrupts if the ERROR module is used */
468 sr_modify_reg(sr, errconfig_offs, (vpboundint_en | vpboundint_st),
469 vpboundint_en);
470
471 return 0;
472}
473
474/**
475 * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component
476 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
477 *
478 * This API is to be called from the smartreflex class driver to
479 * disable the error generator module inside the smartreflex module.
480 *
481 * Returns 0 on success and error value in case of failure.
482 */
483int sr_disable_errgen(struct voltagedomain *voltdm)
484{
485 u32 errconfig_offs;
486 u32 vpboundint_en, vpboundint_st;
487 struct omap_sr *sr = _sr_lookup(voltdm);
488
489 if (IS_ERR(sr)) {
490 pr_warning("%s: omap_sr struct for sr_%s not found\n",
491 __func__, voltdm->name);
492 return PTR_ERR(sr);
493 }
494
495 switch (sr->ip_type) {
496 case SR_TYPE_V1:
497 errconfig_offs = ERRCONFIG_V1;
498 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1;
499 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1;
500 break;
501 case SR_TYPE_V2:
502 errconfig_offs = ERRCONFIG_V2;
503 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2;
504 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2;
505 break;
506 default:
507 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
508 "module without specifying the ip\n", __func__);
509 return -EINVAL;
510 }
511
512 /* Disable the interrupts of ERROR module */
513 sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0);
514
515 /* Disable the Sensor and errorgen */
516 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0);
517
518 return 0;
519}
520
521/**
522 * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the
523 * minmaxavg module.
524 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
525 *
526 * This API is to be called from the smartreflex class driver to
527 * configure the minmaxavg module inside the smartreflex module.
528 * SR settings if using the ERROR module inside Smartreflex.
529 * SR CLASS 3 by default uses only the ERROR module where as
530 * SR CLASS 2 can choose between ERROR module and MINMAXAVG
531 * module. Returns 0 on success and error value in case of failure.
532 */
533int sr_configure_minmax(struct voltagedomain *voltdm)
534{
535 u32 sr_config, sr_avgwt;
536 u32 senp_en = 0, senn_en = 0;
537 u8 senp_shift, senn_shift;
538 struct omap_sr *sr = _sr_lookup(voltdm);
539
540 if (IS_ERR(sr)) {
541 pr_warning("%s: omap_sr struct for sr_%s not found\n",
542 __func__, voltdm->name);
543 return PTR_ERR(sr);
544 }
545
546 if (!sr->clk_length)
547 sr_set_clk_length(sr);
548
549 senp_en = sr->senp_mod;
550 senn_en = sr->senn_mod;
551
552 sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) |
553 SRCONFIG_SENENABLE |
554 (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT);
555
556 switch (sr->ip_type) {
557 case SR_TYPE_V1:
558 sr_config |= SRCONFIG_DELAYCTRL;
559 senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT;
560 senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT;
561 break;
562 case SR_TYPE_V2:
563 senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT;
564 senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT;
565 break;
566 default:
567 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
568 "module without specifying the ip\n", __func__);
569 return -EINVAL;
570 }
571
572 sr_config |= ((senn_en << senn_shift) | (senp_en << senp_shift));
573 sr_write_reg(sr, SRCONFIG, sr_config);
574 sr_avgwt = (sr->senp_avgweight << AVGWEIGHT_SENPAVGWEIGHT_SHIFT) |
575 (sr->senn_avgweight << AVGWEIGHT_SENNAVGWEIGHT_SHIFT);
576 sr_write_reg(sr, AVGWEIGHT, sr_avgwt);
577
578 /*
579 * Enabling the interrupts if MINMAXAVG module is used.
580 * TODO: check if all the interrupts are mandatory
581 */
582 switch (sr->ip_type) {
583 case SR_TYPE_V1:
584 sr_modify_reg(sr, ERRCONFIG_V1,
585 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN |
586 ERRCONFIG_MCUBOUNDINTEN),
587 (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST |
588 ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST |
589 ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST));
590 break;
591 case SR_TYPE_V2:
592 sr_write_reg(sr, IRQSTATUS,
593 IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT |
594 IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT);
595 sr_write_reg(sr, IRQENABLE_SET,
596 IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT |
597 IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT);
598 break;
599 default:
600 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
601 "module without specifying the ip\n", __func__);
602 return -EINVAL;
603 }
604
605 return 0;
606}
607
608/**
609 * sr_enable() - Enables the smartreflex module.
610 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
611 * @volt: The voltage at which the Voltage domain associated with
612 * the smartreflex module is operating at.
613 * This is required only to program the correct Ntarget value.
614 *
615 * This API is to be called from the smartreflex class driver to
616 * enable a smartreflex module. Returns 0 on success. Returns error
617 * value if the voltage passed is wrong or if ntarget value is wrong.
618 */
619int sr_enable(struct voltagedomain *voltdm, unsigned long volt)
620{
621 struct omap_volt_data *volt_data;
622 struct omap_sr *sr = _sr_lookup(voltdm);
623 u32 nvalue_reciprocal;
624 int ret;
625
626 if (IS_ERR(sr)) {
627 pr_warning("%s: omap_sr struct for sr_%s not found\n",
628 __func__, voltdm->name);
629 return PTR_ERR(sr);
630 }
631
632 volt_data = omap_voltage_get_voltdata(sr->voltdm, volt);
633
634 if (IS_ERR(volt_data)) {
635 dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table"
636 "for nominal voltage %ld\n", __func__, volt);
637 return PTR_ERR(volt_data);
638 }
639
640 nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs);
641
642 if (!nvalue_reciprocal) {
643 dev_warn(&sr->pdev->dev, "%s: NVALUE = 0 at voltage %ld\n",
644 __func__, volt);
645 return -ENODATA;
646 }
647
648 /* errminlimit is opp dependent and hence linked to voltage */
649 sr->err_minlimit = volt_data->sr_errminlimit;
650
651 pm_runtime_get_sync(&sr->pdev->dev);
652
653 /* Check if SR is already enabled. If yes do nothing */
654 if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE)
655 return 0;
656
657 /* Configure SR */
658 ret = sr_class->configure(voltdm);
659 if (ret)
660 return ret;
661
662 sr_write_reg(sr, NVALUERECIPROCAL, nvalue_reciprocal);
663
664 /* SRCONFIG - enable SR */
665 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, SRCONFIG_SRENABLE);
666 return 0;
667}
668
669/**
670 * sr_disable() - Disables the smartreflex module.
671 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
672 *
673 * This API is to be called from the smartreflex class driver to
674 * disable a smartreflex module.
675 */
676void sr_disable(struct voltagedomain *voltdm)
677{
678 struct omap_sr *sr = _sr_lookup(voltdm);
679
680 if (IS_ERR(sr)) {
681 pr_warning("%s: omap_sr struct for sr_%s not found\n",
682 __func__, voltdm->name);
683 return;
684 }
685
686 /* Check if SR clocks are already disabled. If yes do nothing */
687 if (pm_runtime_suspended(&sr->pdev->dev))
688 return;
689
690 /*
691 * Disable SR if only it is indeed enabled. Else just
692 * disable the clocks.
693 */
694 if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) {
695 switch (sr->ip_type) {
696 case SR_TYPE_V1:
697 sr_v1_disable(sr);
698 break;
699 case SR_TYPE_V2:
700 sr_v2_disable(sr);
701 break;
702 default:
703 dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n",
704 sr->ip_type);
705 }
706 }
707
708 pm_runtime_put_sync_suspend(&sr->pdev->dev);
709}
710
711/**
712 * sr_register_class() - API to register a smartreflex class parameters.
713 * @class_data: The structure containing various sr class specific data.
714 *
715 * This API is to be called by the smartreflex class driver to register itself
716 * with the smartreflex driver during init. Returns 0 on success else the
717 * error value.
718 */
719int sr_register_class(struct omap_sr_class_data *class_data)
720{
721 struct omap_sr *sr_info;
722
723 if (!class_data) {
724 pr_warning("%s:, Smartreflex class data passed is NULL\n",
725 __func__);
726 return -EINVAL;
727 }
728
729 if (sr_class) {
730 pr_warning("%s: Smartreflex class driver already registered\n",
731 __func__);
732 return -EBUSY;
733 }
734
735 sr_class = class_data;
736
737 /*
738 * Call into late init to do intializations that require
739 * both sr driver and sr class driver to be initiallized.
740 */
741 list_for_each_entry(sr_info, &sr_list, node)
742 sr_late_init(sr_info);
743
744 return 0;
745}
746
747/**
748 * omap_sr_enable() - API to enable SR clocks and to call into the
749 * registered smartreflex class enable API.
750 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
751 *
752 * This API is to be called from the kernel in order to enable
753 * a particular smartreflex module. This API will do the initial
754 * configurations to turn on the smartreflex module and in turn call
755 * into the registered smartreflex class enable API.
756 */
757void omap_sr_enable(struct voltagedomain *voltdm)
758{
759 struct omap_sr *sr = _sr_lookup(voltdm);
760
761 if (IS_ERR(sr)) {
762 pr_warning("%s: omap_sr struct for sr_%s not found\n",
763 __func__, voltdm->name);
764 return;
765 }
766
767 if (!sr->autocomp_active)
768 return;
769
770 if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
771 dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
772 "registered\n", __func__);
773 return;
774 }
775
776 sr_class->enable(voltdm);
777}
778
779/**
780 * omap_sr_disable() - API to disable SR without resetting the voltage
781 * processor voltage
782 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
783 *
784 * This API is to be called from the kernel in order to disable
785 * a particular smartreflex module. This API will in turn call
786 * into the registered smartreflex class disable API. This API will tell
787 * the smartreflex class disable not to reset the VP voltage after
788 * disabling smartreflex.
789 */
790void omap_sr_disable(struct voltagedomain *voltdm)
791{
792 struct omap_sr *sr = _sr_lookup(voltdm);
793
794 if (IS_ERR(sr)) {
795 pr_warning("%s: omap_sr struct for sr_%s not found\n",
796 __func__, voltdm->name);
797 return;
798 }
799
800 if (!sr->autocomp_active)
801 return;
802
803 if (!sr_class || !(sr_class->disable)) {
804 dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
805 "registered\n", __func__);
806 return;
807 }
808
809 sr_class->disable(voltdm, 0);
810}
811
812/**
813 * omap_sr_disable_reset_volt() - API to disable SR and reset the
814 * voltage processor voltage
815 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
816 *
817 * This API is to be called from the kernel in order to disable
818 * a particular smartreflex module. This API will in turn call
819 * into the registered smartreflex class disable API. This API will tell
820 * the smartreflex class disable to reset the VP voltage after
821 * disabling smartreflex.
822 */
823void omap_sr_disable_reset_volt(struct voltagedomain *voltdm)
824{
825 struct omap_sr *sr = _sr_lookup(voltdm);
826
827 if (IS_ERR(sr)) {
828 pr_warning("%s: omap_sr struct for sr_%s not found\n",
829 __func__, voltdm->name);
830 return;
831 }
832
833 if (!sr->autocomp_active)
834 return;
835
836 if (!sr_class || !(sr_class->disable)) {
837 dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
838 "registered\n", __func__);
839 return;
840 }
841
842 sr_class->disable(voltdm, 1);
843}
844
845/**
846 * omap_sr_register_pmic() - API to register pmic specific info.
847 * @pmic_data: The structure containing pmic specific data.
848 *
849 * This API is to be called from the PMIC specific code to register with
850 * smartreflex driver pmic specific info. Currently the only info required
851 * is the smartreflex init on the PMIC side.
852 */
853void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data)
854{
855 if (!pmic_data) {
856 pr_warning("%s: Trying to register NULL PMIC data structure"
857 "with smartreflex\n", __func__);
858 return;
859 }
860
861 sr_pmic_data = pmic_data;
862}
863
864/* PM Debug FS entries to enable and disable smartreflex. */
865static int omap_sr_autocomp_show(void *data, u64 *val)
866{
867 struct omap_sr *sr_info = data;
868
869 if (!sr_info) {
870 pr_warning("%s: omap_sr struct not found\n", __func__);
871 return -EINVAL;
872 }
873
874 *val = sr_info->autocomp_active;
875
876 return 0;
877}
878
879static int omap_sr_autocomp_store(void *data, u64 val)
880{
881 struct omap_sr *sr_info = data;
882
883 if (!sr_info) {
884 pr_warning("%s: omap_sr struct not found\n", __func__);
885 return -EINVAL;
886 }
887
888 /* Sanity check */
889 if (val > 1) {
890 pr_warning("%s: Invalid argument %lld\n", __func__, val);
891 return -EINVAL;
892 }
893
894 /* control enable/disable only if there is a delta in value */
895 if (sr_info->autocomp_active != val) {
896 if (!val)
897 sr_stop_vddautocomp(sr_info);
898 else
899 sr_start_vddautocomp(sr_info);
900 }
901
902 return 0;
903}
904
905DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
906 omap_sr_autocomp_store, "%llu\n");
907
908static int __init omap_sr_probe(struct platform_device *pdev)
909{
910 struct omap_sr *sr_info;
911 struct omap_sr_data *pdata = pdev->dev.platform_data;
912 struct resource *mem, *irq;
913 struct dentry *nvalue_dir;
914 struct omap_volt_data *volt_data;
915 int i, ret = 0;
916 char *name;
917
918 sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
919 if (!sr_info) {
920 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
921 __func__);
922 return -ENOMEM;
923 }
924
925 platform_set_drvdata(pdev, sr_info);
926
927 if (!pdata) {
928 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
929 ret = -EINVAL;
930 goto err_free_devinfo;
931 }
932
933 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
934 if (!mem) {
935 dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
936 ret = -ENODEV;
937 goto err_free_devinfo;
938 }
939
940 mem = request_mem_region(mem->start, resource_size(mem),
941 dev_name(&pdev->dev));
942 if (!mem) {
943 dev_err(&pdev->dev, "%s: no mem region\n", __func__);
944 ret = -EBUSY;
945 goto err_free_devinfo;
946 }
947
948 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
949
950 pm_runtime_enable(&pdev->dev);
951 pm_runtime_irq_safe(&pdev->dev);
952
953 sr_info->pdev = pdev;
954 sr_info->srid = pdev->id;
955 sr_info->voltdm = pdata->voltdm;
956 sr_info->nvalue_table = pdata->nvalue_table;
957 sr_info->nvalue_count = pdata->nvalue_count;
958 sr_info->senn_mod = pdata->senn_mod;
959 sr_info->senp_mod = pdata->senp_mod;
960 sr_info->autocomp_active = false;
961 sr_info->ip_type = pdata->ip_type;
962 sr_info->base = ioremap(mem->start, resource_size(mem));
963 if (!sr_info->base) {
964 dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
965 ret = -ENOMEM;
966 goto err_release_region;
967 }
968
969 if (irq)
970 sr_info->irq = irq->start;
971
972 sr_set_clk_length(sr_info);
973 sr_set_regfields(sr_info);
974
975 list_add(&sr_info->node, &sr_list);
976
977 /*
978 * Call into late init to do intializations that require
979 * both sr driver and sr class driver to be initiallized.
980 */
981 if (sr_class) {
982 ret = sr_late_init(sr_info);
983 if (ret) {
984 pr_warning("%s: Error in SR late init\n", __func__);
985 goto err_iounmap;
986 }
987 }
988
989 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
990 if (!sr_dbg_dir) {
991 sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
992 if (IS_ERR_OR_NULL(sr_dbg_dir)) {
993 ret = PTR_ERR(sr_dbg_dir);
994 pr_err("%s:sr debugfs dir creation failed(%d)\n",
995 __func__, ret);
996 goto err_iounmap;
997 }
998 }
999
1000 name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
1001 if (!name) {
1002 dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n",
1003 __func__);
1004 ret = -ENOMEM;
1005 goto err_iounmap;
1006 }
1007 sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
1008 kfree(name);
1009 if (IS_ERR_OR_NULL(sr_info->dbg_dir)) {
1010 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
1011 __func__);
1012 ret = PTR_ERR(sr_info->dbg_dir);
1013 goto err_iounmap;
1014 }
1015
1016 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR,
1017 sr_info->dbg_dir, (void *)sr_info, &pm_sr_fops);
1018 (void) debugfs_create_x32("errweight", S_IRUGO, sr_info->dbg_dir,
1019 &sr_info->err_weight);
1020 (void) debugfs_create_x32("errmaxlimit", S_IRUGO, sr_info->dbg_dir,
1021 &sr_info->err_maxlimit);
1022 (void) debugfs_create_x32("errminlimit", S_IRUGO, sr_info->dbg_dir,
1023 &sr_info->err_minlimit);
1024
1025 nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir);
1026 if (IS_ERR_OR_NULL(nvalue_dir)) {
1027 dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
1028 "for n-values\n", __func__);
1029 ret = PTR_ERR(nvalue_dir);
1030 goto err_debugfs;
1031 }
1032
1033 omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
1034 if (!volt_data) {
1035 dev_warn(&pdev->dev, "%s: No Voltage table for the"
1036 " corresponding vdd vdd_%s. Cannot create debugfs"
1037 "entries for n-values\n",
1038 __func__, sr_info->voltdm->name);
1039 ret = -ENODATA;
1040 goto err_debugfs;
1041 }
1042
1043 for (i = 0; i < sr_info->nvalue_count; i++) {
1044 char name[NVALUE_NAME_LEN + 1];
1045
1046 snprintf(name, sizeof(name), "volt_%d",
1047 volt_data[i].volt_nominal);
1048 (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
1049 &(sr_info->nvalue_table[i].nvalue));
1050 }
1051
1052 return ret;
1053
1054err_debugfs:
1055 debugfs_remove_recursive(sr_info->dbg_dir);
1056err_iounmap:
1057 list_del(&sr_info->node);
1058 iounmap(sr_info->base);
1059err_release_region:
1060 release_mem_region(mem->start, resource_size(mem));
1061err_free_devinfo:
1062 kfree(sr_info);
1063
1064 return ret;
1065}
1066
1067static int __devexit omap_sr_remove(struct platform_device *pdev)
1068{
1069 struct omap_sr_data *pdata = pdev->dev.platform_data;
1070 struct omap_sr *sr_info;
1071 struct resource *mem;
1072
1073 if (!pdata) {
1074 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
1075 return -EINVAL;
1076 }
1077
1078 sr_info = _sr_lookup(pdata->voltdm);
1079 if (IS_ERR(sr_info)) {
1080 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
1081 __func__);
1082 return PTR_ERR(sr_info);
1083 }
1084
1085 if (sr_info->autocomp_active)
1086 sr_stop_vddautocomp(sr_info);
1087 if (sr_info->dbg_dir)
1088 debugfs_remove_recursive(sr_info->dbg_dir);
1089
1090 list_del(&sr_info->node);
1091 iounmap(sr_info->base);
1092 kfree(sr_info);
1093 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1094 release_mem_region(mem->start, resource_size(mem));
1095
1096 return 0;
1097}
1098
1099static void __devexit omap_sr_shutdown(struct platform_device *pdev)
1100{
1101 struct omap_sr_data *pdata = pdev->dev.platform_data;
1102 struct omap_sr *sr_info;
1103
1104 if (!pdata) {
1105 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
1106 return;
1107 }
1108
1109 sr_info = _sr_lookup(pdata->voltdm);
1110 if (IS_ERR(sr_info)) {
1111 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
1112 __func__);
1113 return;
1114 }
1115
1116 if (sr_info->autocomp_active)
1117 sr_stop_vddautocomp(sr_info);
1118
1119 return;
1120}
1121
1122static struct platform_driver smartreflex_driver = {
1123 .remove = __devexit_p(omap_sr_remove),
1124 .shutdown = __devexit_p(omap_sr_shutdown),
1125 .driver = {
1126 .name = "smartreflex",
1127 },
1128};
1129
1130static int __init sr_init(void)
1131{
1132 int ret = 0;
1133
1134 /*
1135 * sr_init is a late init. If by then a pmic specific API is not
1136 * registered either there is no need for anything to be done on
1137 * the PMIC side or somebody has forgotten to register a PMIC
1138 * handler. Warn for the second condition.
1139 */
1140 if (sr_pmic_data && sr_pmic_data->sr_pmic_init)
1141 sr_pmic_data->sr_pmic_init();
1142 else
1143 pr_warning("%s: No PMIC hook to init smartreflex\n", __func__);
1144
1145 ret = platform_driver_probe(&smartreflex_driver, omap_sr_probe);
1146 if (ret) {
1147 pr_err("%s: platform driver register failed for SR\n",
1148 __func__);
1149 return ret;
1150 }
1151
1152 return 0;
1153}
1154late_initcall(sr_init);
1155
1156static void __exit sr_exit(void)
1157{
1158 platform_driver_unregister(&smartreflex_driver);
1159}
1160module_exit(sr_exit);
1161
1162MODULE_DESCRIPTION("OMAP Smartreflex Driver");
1163MODULE_LICENSE("GPL");
1164MODULE_ALIAS("platform:" DRIVER_NAME);
1165MODULE_AUTHOR("Texas Instruments Inc");
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
deleted file mode 100644
index 5809141171f8..000000000000
--- a/arch/arm/mach-omap2/smartreflex.h
+++ /dev/null
@@ -1,256 +0,0 @@
1/*
2 * OMAP Smartreflex Defines and Routines
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008 Nokia Corporation
10 * Kalle Jokiniemi
11 *
12 * Copyright (C) 2007 Texas Instruments, Inc.
13 * Lesly A M <x0080970@ti.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ASM_ARM_OMAP_SMARTREFLEX_H
21#define __ASM_ARM_OMAP_SMARTREFLEX_H
22
23#include <linux/platform_device.h>
24
25#include "voltage.h"
26
27/*
28 * Different Smartreflex IPs version. The v1 is the 65nm version used in
29 * OMAP3430. The v2 is the update for the 45nm version of the IP
30 * used in OMAP3630 and OMAP4430
31 */
32#define SR_TYPE_V1 1
33#define SR_TYPE_V2 2
34
35/* SMART REFLEX REG ADDRESS OFFSET */
36#define SRCONFIG 0x00
37#define SRSTATUS 0x04
38#define SENVAL 0x08
39#define SENMIN 0x0C
40#define SENMAX 0x10
41#define SENAVG 0x14
42#define AVGWEIGHT 0x18
43#define NVALUERECIPROCAL 0x1c
44#define SENERROR_V1 0x20
45#define ERRCONFIG_V1 0x24
46#define IRQ_EOI 0x20
47#define IRQSTATUS_RAW 0x24
48#define IRQSTATUS 0x28
49#define IRQENABLE_SET 0x2C
50#define IRQENABLE_CLR 0x30
51#define SENERROR_V2 0x34
52#define ERRCONFIG_V2 0x38
53
54/* Bit/Shift Positions */
55
56/* SRCONFIG */
57#define SRCONFIG_ACCUMDATA_SHIFT 22
58#define SRCONFIG_SRCLKLENGTH_SHIFT 12
59#define SRCONFIG_SENNENABLE_V1_SHIFT 5
60#define SRCONFIG_SENPENABLE_V1_SHIFT 3
61#define SRCONFIG_SENNENABLE_V2_SHIFT 1
62#define SRCONFIG_SENPENABLE_V2_SHIFT 0
63#define SRCONFIG_CLKCTRL_SHIFT 0
64
65#define SRCONFIG_ACCUMDATA_MASK (0x3ff << 22)
66
67#define SRCONFIG_SRENABLE BIT(11)
68#define SRCONFIG_SENENABLE BIT(10)
69#define SRCONFIG_ERRGEN_EN BIT(9)
70#define SRCONFIG_MINMAXAVG_EN BIT(8)
71#define SRCONFIG_DELAYCTRL BIT(2)
72
73/* AVGWEIGHT */
74#define AVGWEIGHT_SENPAVGWEIGHT_SHIFT 2
75#define AVGWEIGHT_SENNAVGWEIGHT_SHIFT 0
76
77/* NVALUERECIPROCAL */
78#define NVALUERECIPROCAL_SENPGAIN_SHIFT 20
79#define NVALUERECIPROCAL_SENNGAIN_SHIFT 16
80#define NVALUERECIPROCAL_RNSENP_SHIFT 8
81#define NVALUERECIPROCAL_RNSENN_SHIFT 0
82
83/* ERRCONFIG */
84#define ERRCONFIG_ERRWEIGHT_SHIFT 16
85#define ERRCONFIG_ERRMAXLIMIT_SHIFT 8
86#define ERRCONFIG_ERRMINLIMIT_SHIFT 0
87
88#define SR_ERRWEIGHT_MASK (0x07 << 16)
89#define SR_ERRMAXLIMIT_MASK (0xff << 8)
90#define SR_ERRMINLIMIT_MASK (0xff << 0)
91
92#define ERRCONFIG_VPBOUNDINTEN_V1 BIT(31)
93#define ERRCONFIG_VPBOUNDINTST_V1 BIT(30)
94#define ERRCONFIG_MCUACCUMINTEN BIT(29)
95#define ERRCONFIG_MCUACCUMINTST BIT(28)
96#define ERRCONFIG_MCUVALIDINTEN BIT(27)
97#define ERRCONFIG_MCUVALIDINTST BIT(26)
98#define ERRCONFIG_MCUBOUNDINTEN BIT(25)
99#define ERRCONFIG_MCUBOUNDINTST BIT(24)
100#define ERRCONFIG_MCUDISACKINTEN BIT(23)
101#define ERRCONFIG_VPBOUNDINTST_V2 BIT(23)
102#define ERRCONFIG_MCUDISACKINTST BIT(22)
103#define ERRCONFIG_VPBOUNDINTEN_V2 BIT(22)
104
105#define ERRCONFIG_STATUS_V1_MASK (ERRCONFIG_VPBOUNDINTST_V1 | \
106 ERRCONFIG_MCUACCUMINTST | \
107 ERRCONFIG_MCUVALIDINTST | \
108 ERRCONFIG_MCUBOUNDINTST | \
109 ERRCONFIG_MCUDISACKINTST)
110/* IRQSTATUS */
111#define IRQSTATUS_MCUACCUMINT BIT(3)
112#define IRQSTATUS_MCVALIDINT BIT(2)
113#define IRQSTATUS_MCBOUNDSINT BIT(1)
114#define IRQSTATUS_MCUDISABLEACKINT BIT(0)
115
116/* IRQENABLE_SET and IRQENABLE_CLEAR */
117#define IRQENABLE_MCUACCUMINT BIT(3)
118#define IRQENABLE_MCUVALIDINT BIT(2)
119#define IRQENABLE_MCUBOUNDSINT BIT(1)
120#define IRQENABLE_MCUDISABLEACKINT BIT(0)
121
122/* Common Bit values */
123
124#define SRCLKLENGTH_12MHZ_SYSCLK 0x3c
125#define SRCLKLENGTH_13MHZ_SYSCLK 0x41
126#define SRCLKLENGTH_19MHZ_SYSCLK 0x60
127#define SRCLKLENGTH_26MHZ_SYSCLK 0x82
128#define SRCLKLENGTH_38MHZ_SYSCLK 0xC0
129
130/*
131 * 3430 specific values. Maybe these should be passed from board file or
132 * pmic structures.
133 */
134#define OMAP3430_SR_ACCUMDATA 0x1f4
135
136#define OMAP3430_SR1_SENPAVGWEIGHT 0x03
137#define OMAP3430_SR1_SENNAVGWEIGHT 0x03
138
139#define OMAP3430_SR2_SENPAVGWEIGHT 0x01
140#define OMAP3430_SR2_SENNAVGWEIGHT 0x01
141
142#define OMAP3430_SR_ERRWEIGHT 0x04
143#define OMAP3430_SR_ERRMAXLIMIT 0x02
144
145/**
146 * struct omap_sr_pmic_data - Strucutre to be populated by pmic code to pass
147 * pmic specific info to smartreflex driver
148 *
149 * @sr_pmic_init: API to initialize smartreflex on the PMIC side.
150 */
151struct omap_sr_pmic_data {
152 void (*sr_pmic_init) (void);
153};
154
155/**
156 * struct omap_smartreflex_dev_attr - Smartreflex Device attribute.
157 *
158 * @sensor_voltdm_name: Name of voltdomain of SR instance
159 */
160struct omap_smartreflex_dev_attr {
161 const char *sensor_voltdm_name;
162};
163
164#ifdef CONFIG_OMAP_SMARTREFLEX
165/*
166 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR.
167 * The smartreflex class driver should pass the class type.
168 * Should be used to populate the class_type field of the
169 * omap_smartreflex_class_data structure.
170 */
171#define SR_CLASS1 0x1
172#define SR_CLASS2 0x2
173#define SR_CLASS3 0x3
174
175/**
176 * struct omap_sr_class_data - Smartreflex class driver info
177 *
178 * @enable: API to enable a particular class smaartreflex.
179 * @disable: API to disable a particular class smartreflex.
180 * @configure: API to configure a particular class smartreflex.
181 * @notify: API to notify the class driver about an event in SR.
182 * Not needed for class3.
183 * @notify_flags: specify the events to be notified to the class driver
184 * @class_type: specify which smartreflex class.
185 * Can be used by the SR driver to take any class
186 * based decisions.
187 */
188struct omap_sr_class_data {
189 int (*enable)(struct voltagedomain *voltdm);
190 int (*disable)(struct voltagedomain *voltdm, int is_volt_reset);
191 int (*configure)(struct voltagedomain *voltdm);
192 int (*notify)(struct voltagedomain *voltdm, u32 status);
193 u8 notify_flags;
194 u8 class_type;
195};
196
197/**
198 * struct omap_sr_nvalue_table - Smartreflex n-target value info
199 *
200 * @efuse_offs: The offset of the efuse where n-target values are stored.
201 * @nvalue: The n-target value.
202 */
203struct omap_sr_nvalue_table {
204 u32 efuse_offs;
205 u32 nvalue;
206};
207
208/**
209 * struct omap_sr_data - Smartreflex platform data.
210 *
211 * @ip_type: Smartreflex IP type.
212 * @senp_mod: SENPENABLE value for the sr
213 * @senn_mod: SENNENABLE value for sr
214 * @nvalue_count: Number of distinct nvalues in the nvalue table
215 * @enable_on_init: whether this sr module needs to enabled at
216 * boot up or not.
217 * @nvalue_table: table containing the efuse offsets and nvalues
218 * corresponding to them.
219 * @voltdm: Pointer to the voltage domain associated with the SR
220 */
221struct omap_sr_data {
222 int ip_type;
223 u32 senp_mod;
224 u32 senn_mod;
225 int nvalue_count;
226 bool enable_on_init;
227 struct omap_sr_nvalue_table *nvalue_table;
228 struct voltagedomain *voltdm;
229};
230
231/* Smartreflex module enable/disable interface */
232void omap_sr_enable(struct voltagedomain *voltdm);
233void omap_sr_disable(struct voltagedomain *voltdm);
234void omap_sr_disable_reset_volt(struct voltagedomain *voltdm);
235
236/* API to register the pmic specific data with the smartreflex driver. */
237void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
238
239/* Smartreflex driver hooks to be called from Smartreflex class driver */
240int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
241void sr_disable(struct voltagedomain *voltdm);
242int sr_configure_errgen(struct voltagedomain *voltdm);
243int sr_disable_errgen(struct voltagedomain *voltdm);
244int sr_configure_minmax(struct voltagedomain *voltdm);
245
246/* API to register the smartreflex class driver with the smartreflex driver */
247int sr_register_class(struct omap_sr_class_data *class_data);
248#else
249static inline void omap_sr_enable(struct voltagedomain *voltdm) {}
250static inline void omap_sr_disable(struct voltagedomain *voltdm) {}
251static inline void omap_sr_disable_reset_volt(
252 struct voltagedomain *voltdm) {}
253static inline void omap_sr_register_pmic(
254 struct omap_sr_pmic_data *pmic_data) {}
255#endif
256#endif
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index a503e1e8358c..d033a65f4e4e 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -17,6 +17,7 @@
17 * it under the terms of the GNU General Public License version 2 as 17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation. 18 * published by the Free Software Foundation.
19 */ 19 */
20#include <linux/power/smartreflex.h>
20 21
21#include <linux/err.h> 22#include <linux/err.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
@@ -24,7 +25,6 @@
24 25
25#include <plat/omap_device.h> 26#include <plat/omap_device.h>
26 27
27#include "smartreflex.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"
@@ -36,7 +36,10 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
36 struct omap_sr_data *sr_data) 36 struct omap_sr_data *sr_data)
37{ 37{
38 struct omap_sr_nvalue_table *nvalue_table; 38 struct omap_sr_nvalue_table *nvalue_table;
39 int i, count = 0; 39 int i, j, count = 0;
40
41 sr_data->nvalue_count = 0;
42 sr_data->nvalue_table = NULL;
40 43
41 while (volt_data[count].volt_nominal) 44 while (volt_data[count].volt_nominal)
42 count++; 45 count++;
@@ -44,8 +47,14 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
44 nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count, 47 nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count,
45 GFP_KERNEL); 48 GFP_KERNEL);
46 49
47 for (i = 0; i < count; i++) { 50 if (!nvalue_table) {
51 pr_err("OMAP: SmartReflex: cannot allocate memory for n-value table\n");
52 return;
53 }
54
55 for (i = 0, j = 0; i < count; i++) {
48 u32 v; 56 u32 v;
57
49 /* 58 /*
50 * In OMAP4 the efuse registers are 24 bit aligned. 59 * In OMAP4 the efuse registers are 24 bit aligned.
51 * A __raw_readl will fail for non-32 bit aligned address 60 * A __raw_readl will fail for non-32 bit aligned address
@@ -58,15 +67,30 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
58 omap_ctrl_readb(offset + 1) << 8 | 67 omap_ctrl_readb(offset + 1) << 8 |
59 omap_ctrl_readb(offset + 2) << 16; 68 omap_ctrl_readb(offset + 2) << 16;
60 } else { 69 } else {
61 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs); 70 v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
62 } 71 }
63 72
64 nvalue_table[i].efuse_offs = volt_data[i].sr_efuse_offs; 73 /*
65 nvalue_table[i].nvalue = v; 74 * Many OMAP SoCs don't have the eFuse values set.
75 * For example, pretty much all OMAP3xxx before
76 * ES3.something.
77 *
78 * XXX There needs to be some way for board files or
79 * userspace to add these in.
80 */
81 if (v == 0)
82 continue;
83
84 nvalue_table[j].nvalue = v;
85 nvalue_table[j].efuse_offs = volt_data[i].sr_efuse_offs;
86 nvalue_table[j].errminlimit = volt_data[i].sr_errminlimit;
87 nvalue_table[j].volt_nominal = volt_data[i].volt_nominal;
88
89 j++;
66 } 90 }
67 91
68 sr_data->nvalue_table = nvalue_table; 92 sr_data->nvalue_table = nvalue_table;
69 sr_data->nvalue_count = count; 93 sr_data->nvalue_count = j;
70} 94}
71 95
72static int __init sr_dev_init(struct omap_hwmod *oh, void *user) 96static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
@@ -93,6 +117,7 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
93 goto exit; 117 goto exit;
94 } 118 }
95 119
120 sr_data->name = oh->name;
96 sr_data->ip_type = oh->class->rev; 121 sr_data->ip_type = oh->class->rev;
97 sr_data->senn_mod = 0x1; 122 sr_data->senn_mod = 0x1;
98 sr_data->senp_mod = 0x1; 123 sr_data->senp_mod = 0x1;
@@ -106,7 +131,7 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
106 131
107 omap_voltage_get_volttable(sr_data->voltdm, &volt_data); 132 omap_voltage_get_volttable(sr_data->voltdm, &volt_data);
108 if (!volt_data) { 133 if (!volt_data) {
109 pr_warning("%s: No Voltage table registerd fo VDD%d." 134 pr_warning("%s: No Voltage table registered fo VDD%d."
110 "Something really wrong\n\n", __func__, i + 1); 135 "Something really wrong\n\n", __func__, i + 1);
111 goto exit; 136 goto exit;
112 } 137 }
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 840929bd9dae..13d20c8a283d 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -69,11 +69,6 @@
69#define OMAP3_SECURE_TIMER 1 69#define OMAP3_SECURE_TIMER 1
70#endif 70#endif
71 71
72/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
73#define MAX_GPTIMER_ID 12
74
75static u32 sys_timer_reserved;
76
77/* Clockevent code */ 72/* Clockevent code */
78 73
79static struct omap_dm_timer clkev; 74static struct omap_dm_timer clkev;
@@ -173,14 +168,14 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
173 return -ENXIO; 168 return -ENXIO;
174 169
175 /* After the dmtimer is using hwmod these clocks won't be needed */ 170 /* After the dmtimer is using hwmod these clocks won't be needed */
176 sprintf(name, "gpt%d_fck", gptimer_id); 171 timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh));
177 timer->fclk = clk_get(NULL, name);
178 if (IS_ERR(timer->fclk)) 172 if (IS_ERR(timer->fclk))
179 return -ENODEV; 173 return -ENODEV;
180 174
181 omap_hwmod_enable(oh); 175 omap_hwmod_enable(oh);
182 176
183 sys_timer_reserved |= (1 << (gptimer_id - 1)); 177 if (omap_dm_timer_reserve_systimer(gptimer_id))
178 return -ENODEV;
184 179
185 if (gptimer_id != 12) { 180 if (gptimer_id != 12) {
186 struct clk *src; 181 struct clk *src;
@@ -368,6 +363,11 @@ OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
368OMAP_SYS_TIMER(3_secure) 363OMAP_SYS_TIMER(3_secure)
369#endif 364#endif
370 365
366#ifdef CONFIG_SOC_AM33XX
367OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE)
368OMAP_SYS_TIMER(3_am33xx)
369#endif
370
371#ifdef CONFIG_ARCH_OMAP4 371#ifdef CONFIG_ARCH_OMAP4
372#ifdef CONFIG_LOCAL_TIMERS 372#ifdef CONFIG_LOCAL_TIMERS
373static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 373static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
@@ -393,65 +393,10 @@ static void __init omap4_timer_init(void)
393OMAP_SYS_TIMER(4) 393OMAP_SYS_TIMER(4)
394#endif 394#endif
395 395
396/** 396#ifdef CONFIG_SOC_OMAP5
397 * omap2_dm_timer_set_src - change the timer input clock source 397OMAP_SYS_TIMER_INIT(5, 1, OMAP4_CLKEV_SOURCE, 2, OMAP4_MPU_SOURCE)
398 * @pdev: timer platform device pointer 398OMAP_SYS_TIMER(5)
399 * @source: array index of parent clock source 399#endif
400 */
401static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
402{
403 int ret;
404 struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
405 struct clk *fclk, *parent;
406 char *parent_name = NULL;
407
408 fclk = clk_get(&pdev->dev, "fck");
409 if (IS_ERR_OR_NULL(fclk)) {
410 dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
411 __func__, __LINE__);
412 return -EINVAL;
413 }
414
415 switch (source) {
416 case OMAP_TIMER_SRC_SYS_CLK:
417 parent_name = "sys_ck";
418 break;
419
420 case OMAP_TIMER_SRC_32_KHZ:
421 parent_name = "32k_ck";
422 break;
423
424 case OMAP_TIMER_SRC_EXT_CLK:
425 if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
426 parent_name = "alt_ck";
427 break;
428 }
429 dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
430 __func__, __LINE__);
431 clk_put(fclk);
432 return -EINVAL;
433 }
434
435 parent = clk_get(&pdev->dev, parent_name);
436 if (IS_ERR_OR_NULL(parent)) {
437 dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
438 __func__, __LINE__, parent_name);
439 clk_put(fclk);
440 return -EINVAL;
441 }
442
443 ret = clk_set_parent(fclk, parent);
444 if (IS_ERR_VALUE(ret)) {
445 dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
446 __func__, parent_name);
447 ret = -EINVAL;
448 }
449
450 clk_put(parent);
451 clk_put(fclk);
452
453 return ret;
454}
455 400
456/** 401/**
457 * omap_timer_init - build and register timer device with an 402 * omap_timer_init - build and register timer device with an
@@ -473,7 +418,6 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
473 struct dmtimer_platform_data *pdata; 418 struct dmtimer_platform_data *pdata;
474 struct platform_device *pdev; 419 struct platform_device *pdev;
475 struct omap_timer_capability_dev_attr *timer_dev_attr; 420 struct omap_timer_capability_dev_attr *timer_dev_attr;
476 struct powerdomain *pwrdm;
477 421
478 pr_debug("%s: %s\n", __func__, oh->name); 422 pr_debug("%s: %s\n", __func__, oh->name);
479 423
@@ -501,18 +445,9 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
501 */ 445 */
502 sscanf(oh->name, "timer%2d", &id); 446 sscanf(oh->name, "timer%2d", &id);
503 447
504 pdata->set_timer_src = omap2_dm_timer_set_src; 448 if (timer_dev_attr)
505 pdata->timer_ip_version = oh->class->rev; 449 pdata->timer_capability = timer_dev_attr->timer_capability;
506 450
507 /* Mark clocksource and clockevent timers as reserved */
508 if ((sys_timer_reserved >> (id - 1)) & 0x1)
509 pdata->reserved = 1;
510
511 pwrdm = omap_hwmod_get_pwrdm(oh);
512 pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
513#ifdef CONFIG_PM
514 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
515#endif
516 pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata), 451 pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
517 NULL, 0, 0); 452 NULL, 0, 0);
518 453
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 119d5a910f3a..de47f170ba50 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -32,6 +32,7 @@
32#include "twl-common.h" 32#include "twl-common.h"
33#include "pm.h" 33#include "pm.h"
34#include "voltage.h" 34#include "voltage.h"
35#include "mux.h"
35 36
36static struct i2c_board_info __initdata pmic_i2c_board_info = { 37static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .addr = 0x48, 38 .addr = 0x48,
@@ -48,6 +49,7 @@ static struct i2c_board_info __initdata omap4_i2c1_board_info[] = {
48 }, 49 },
49}; 50};
50 51
52#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
51static int twl_set_voltage(void *data, int target_uV) 53static int twl_set_voltage(void *data, int target_uV)
52{ 54{
53 struct voltagedomain *voltdm = (struct voltagedomain *)data; 55 struct voltagedomain *voltdm = (struct voltagedomain *)data;
@@ -59,6 +61,7 @@ static int twl_get_voltage(void *data)
59 struct voltagedomain *voltdm = (struct voltagedomain *)data; 61 struct voltagedomain *voltdm = (struct voltagedomain *)data;
60 return voltdm_get_voltage(voltdm); 62 return voltdm_get_voltage(voltdm);
61} 63}
64#endif
62 65
63void __init omap_pmic_init(int bus, u32 clkrate, 66void __init omap_pmic_init(int bus, u32 clkrate,
64 const char *pmic_type, int pmic_irq, 67 const char *pmic_type, int pmic_irq,
@@ -77,6 +80,7 @@ void __init omap4_pmic_init(const char *pmic_type,
77 struct twl6040_platform_data *twl6040_data, int twl6040_irq) 80 struct twl6040_platform_data *twl6040_data, int twl6040_irq)
78{ 81{
79 /* PMIC part*/ 82 /* PMIC part*/
83 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
80 strncpy(omap4_i2c1_board_info[0].type, pmic_type, 84 strncpy(omap4_i2c1_board_info[0].type, pmic_type,
81 sizeof(omap4_i2c1_board_info[0].type)); 85 sizeof(omap4_i2c1_board_info[0].type));
82 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N; 86 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
@@ -92,7 +96,7 @@ void __init omap4_pmic_init(const char *pmic_type,
92 96
93void __init omap_pmic_late_init(void) 97void __init omap_pmic_late_init(void)
94{ 98{
95 /* Init the OMAP TWL parameters (if PMIC has been registerd) */ 99 /* Init the OMAP TWL parameters (if PMIC has been registered) */
96 if (pmic_i2c_board_info.irq) 100 if (pmic_i2c_board_info.irq)
97 omap3_twl_init(); 101 omap3_twl_init();
98 if (omap4_i2c1_board_info[0].irq) 102 if (omap4_i2c1_board_info[0].irq)
@@ -211,10 +215,6 @@ static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
211void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 215void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
212 u32 pdata_flags, u32 regulators_flags) 216 u32 pdata_flags, u32 regulators_flags)
213{ 217{
214 if (!pmic_data->irq_base)
215 pmic_data->irq_base = TWL4030_IRQ_BASE;
216 if (!pmic_data->irq_end)
217 pmic_data->irq_end = TWL4030_IRQ_END;
218 if (!pmic_data->vdd1) { 218 if (!pmic_data->vdd1) {
219 omap3_vdd1.driver_data = &omap3_vdd1_drvdata; 219 omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
220 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva"); 220 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
@@ -479,11 +479,6 @@ static struct regulator_init_data omap4_v2v1_idata = {
479void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, 479void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
480 u32 pdata_flags, u32 regulators_flags) 480 u32 pdata_flags, u32 regulators_flags)
481{ 481{
482 if (!pmic_data->irq_base)
483 pmic_data->irq_base = TWL6030_IRQ_BASE;
484 if (!pmic_data->irq_end)
485 pmic_data->irq_end = TWL6030_IRQ_END;
486
487 if (!pmic_data->vdd1) { 482 if (!pmic_data->vdd1) {
488 omap4_vdd1.driver_data = &omap4_vdd1_drvdata; 483 omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
489 omap4_vdd1_drvdata.data = voltdm_lookup("mpu"); 484 omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
diff --git a/arch/arm/mach-omap2/usb-fs.c b/arch/arm/mach-omap2/usb-fs.c
deleted file mode 100644
index 1481078763b8..000000000000
--- a/arch/arm/mach-omap2/usb-fs.c
+++ /dev/null
@@ -1,359 +0,0 @@
1/*
2 * Platform level USB initialization for FS USB OTG controller on omap1 and 24xx
3 *
4 * Copyright (C) 2004 Texas Instruments, Inc.
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#include <linux/module.h>
22#include <linux/kernel.h>
23#include <linux/types.h>
24#include <linux/errno.h>
25#include <linux/init.h>
26#include <linux/platform_device.h>
27#include <linux/clk.h>
28#include <linux/err.h>
29
30#include <asm/irq.h>
31
32#include <plat/usb.h>
33#include <plat/board.h>
34
35#include "control.h"
36#include "mux.h"
37
38#define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN
39#define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO
40#define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO
41#define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN
42#define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG
43
44#if defined(CONFIG_ARCH_OMAP2)
45
46#ifdef CONFIG_USB_GADGET_OMAP
47
48static struct resource udc_resources[] = {
49 /* order is significant! */
50 { /* registers */
51 .start = UDC_BASE,
52 .end = UDC_BASE + 0xff,
53 .flags = IORESOURCE_MEM,
54 }, { /* general IRQ */
55 .start = INT_USB_IRQ_GEN,
56 .flags = IORESOURCE_IRQ,
57 }, { /* PIO IRQ */
58 .start = INT_USB_IRQ_NISO,
59 .flags = IORESOURCE_IRQ,
60 }, { /* SOF IRQ */
61 .start = INT_USB_IRQ_ISO,
62 .flags = IORESOURCE_IRQ,
63 },
64};
65
66static u64 udc_dmamask = ~(u32)0;
67
68static struct platform_device udc_device = {
69 .name = "omap_udc",
70 .id = -1,
71 .dev = {
72 .dma_mask = &udc_dmamask,
73 .coherent_dma_mask = 0xffffffff,
74 },
75 .num_resources = ARRAY_SIZE(udc_resources),
76 .resource = udc_resources,
77};
78
79static inline void udc_device_init(struct omap_usb_config *pdata)
80{
81 pdata->udc_device = &udc_device;
82}
83
84#else
85
86static inline void udc_device_init(struct omap_usb_config *pdata)
87{
88}
89
90#endif
91
92#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
93
94/* The dmamask must be set for OHCI to work */
95static u64 ohci_dmamask = ~(u32)0;
96
97static struct resource ohci_resources[] = {
98 {
99 .start = OMAP_OHCI_BASE,
100 .end = OMAP_OHCI_BASE + 0xff,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .start = INT_USB_IRQ_HGEN,
105 .flags = IORESOURCE_IRQ,
106 },
107};
108
109static struct platform_device ohci_device = {
110 .name = "ohci",
111 .id = -1,
112 .dev = {
113 .dma_mask = &ohci_dmamask,
114 .coherent_dma_mask = 0xffffffff,
115 },
116 .num_resources = ARRAY_SIZE(ohci_resources),
117 .resource = ohci_resources,
118};
119
120static inline void ohci_device_init(struct omap_usb_config *pdata)
121{
122 pdata->ohci_device = &ohci_device;
123}
124
125#else
126
127static inline void ohci_device_init(struct omap_usb_config *pdata)
128{
129}
130
131#endif
132
133#if defined(CONFIG_USB_OTG) && defined(CONFIG_ARCH_OMAP_OTG)
134
135static struct resource otg_resources[] = {
136 /* order is significant! */
137 {
138 .start = OTG_BASE,
139 .end = OTG_BASE + 0xff,
140 .flags = IORESOURCE_MEM,
141 }, {
142 .start = INT_USB_IRQ_OTG,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct platform_device otg_device = {
148 .name = "omap_otg",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(otg_resources),
151 .resource = otg_resources,
152};
153
154static inline void otg_device_init(struct omap_usb_config *pdata)
155{
156 pdata->otg_device = &otg_device;
157}
158
159#else
160
161static inline void otg_device_init(struct omap_usb_config *pdata)
162{
163}
164
165#endif
166
167static void omap2_usb_devconf_clear(u8 port, u32 mask)
168{
169 u32 r;
170
171 r = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
172 r &= ~USBTXWRMODEI(port, mask);
173 omap_ctrl_writel(r, OMAP2_CONTROL_DEVCONF0);
174}
175
176static void omap2_usb_devconf_set(u8 port, u32 mask)
177{
178 u32 r;
179
180 r = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
181 r |= USBTXWRMODEI(port, mask);
182 omap_ctrl_writel(r, OMAP2_CONTROL_DEVCONF0);
183}
184
185static void omap2_usb2_disable_5pinbitll(void)
186{
187 u32 r;
188
189 r = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
190 r &= ~(USBTXWRMODEI(2, USB_BIDIR_TLL) | USBT2TLL5PI);
191 omap_ctrl_writel(r, OMAP2_CONTROL_DEVCONF0);
192}
193
194static void omap2_usb2_enable_5pinunitll(void)
195{
196 u32 r;
197
198 r = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
199 r |= USBTXWRMODEI(2, USB_UNIDIR_TLL) | USBT2TLL5PI;
200 omap_ctrl_writel(r, OMAP2_CONTROL_DEVCONF0);
201}
202
203static u32 __init omap2_usb0_init(unsigned nwires, unsigned is_device)
204{
205 u32 syscon1 = 0;
206
207 omap2_usb_devconf_clear(0, USB_BIDIR_TLL);
208
209 if (nwires == 0)
210 return 0;
211
212 if (is_device)
213 omap_mux_init_signal("usb0_puen", 0);
214
215 omap_mux_init_signal("usb0_dat", 0);
216 omap_mux_init_signal("usb0_txen", 0);
217 omap_mux_init_signal("usb0_se0", 0);
218 if (nwires != 3)
219 omap_mux_init_signal("usb0_rcv", 0);
220
221 switch (nwires) {
222 case 3:
223 syscon1 = 2;
224 omap2_usb_devconf_set(0, USB_BIDIR);
225 break;
226 case 4:
227 syscon1 = 1;
228 omap2_usb_devconf_set(0, USB_BIDIR);
229 break;
230 case 6:
231 syscon1 = 3;
232 omap_mux_init_signal("usb0_vp", 0);
233 omap_mux_init_signal("usb0_vm", 0);
234 omap2_usb_devconf_set(0, USB_UNIDIR);
235 break;
236 default:
237 printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
238 0, nwires);
239 }
240
241 return syscon1 << 16;
242}
243
244static u32 __init omap2_usb1_init(unsigned nwires)
245{
246 u32 syscon1 = 0;
247
248 omap2_usb_devconf_clear(1, USB_BIDIR_TLL);
249
250 if (nwires == 0)
251 return 0;
252
253 /* NOTE: board-specific code must set up pin muxing for usb1,
254 * since each signal could come out on either of two balls.
255 */
256
257 switch (nwires) {
258 case 2:
259 /* NOTE: board-specific code must override this setting if
260 * this TLL link is not using DP/DM
261 */
262 syscon1 = 1;
263 omap2_usb_devconf_set(1, USB_BIDIR_TLL);
264 break;
265 case 3:
266 syscon1 = 2;
267 omap2_usb_devconf_set(1, USB_BIDIR);
268 break;
269 case 4:
270 syscon1 = 1;
271 omap2_usb_devconf_set(1, USB_BIDIR);
272 break;
273 case 6:
274 default:
275 printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
276 1, nwires);
277 }
278
279 return syscon1 << 20;
280}
281
282static u32 __init omap2_usb2_init(unsigned nwires, unsigned alt_pingroup)
283{
284 u32 syscon1 = 0;
285
286 omap2_usb2_disable_5pinbitll();
287 alt_pingroup = 0;
288
289 /* NOTE omap1 erratum: must leave USB2_UNI_R set if usb0 in use */
290 if (alt_pingroup || nwires == 0)
291 return 0;
292
293 omap_mux_init_signal("usb2_dat", 0);
294 omap_mux_init_signal("usb2_se0", 0);
295 if (nwires > 2)
296 omap_mux_init_signal("usb2_txen", 0);
297 if (nwires > 3)
298 omap_mux_init_signal("usb2_rcv", 0);
299
300 switch (nwires) {
301 case 2:
302 /* NOTE: board-specific code must override this setting if
303 * this TLL link is not using DP/DM
304 */
305 syscon1 = 1;
306 omap2_usb_devconf_set(2, USB_BIDIR_TLL);
307 break;
308 case 3:
309 syscon1 = 2;
310 omap2_usb_devconf_set(2, USB_BIDIR);
311 break;
312 case 4:
313 syscon1 = 1;
314 omap2_usb_devconf_set(2, USB_BIDIR);
315 break;
316 case 5:
317 /* NOTE: board-specific code must mux this setting depending
318 * on TLL link using DP/DM. Something must also
319 * set up OTG_SYSCON2.HMC_TLL{ATTACH,SPEED}
320 * 2420: hdq_sio.usb2_tllse0 or vlynq_rx0.usb2_tllse0
321 * 2430: hdq_sio.usb2_tllse0 or sdmmc2_dat0.usb2_tllse0
322 */
323
324 syscon1 = 3;
325 omap2_usb2_enable_5pinunitll();
326 break;
327 case 6:
328 default:
329 printk(KERN_ERR "illegal usb%d %d-wire transceiver\n",
330 2, nwires);
331 }
332
333 return syscon1 << 24;
334}
335
336void __init omap2_usbfs_init(struct omap_usb_config *pdata)
337{
338 struct clk *ick;
339
340 if (!cpu_is_omap24xx())
341 return;
342
343 ick = clk_get(NULL, "usb_l4_ick");
344 if (IS_ERR(ick))
345 return;
346
347 clk_enable(ick);
348 pdata->usb0_init = omap2_usb0_init;
349 pdata->usb1_init = omap2_usb1_init;
350 pdata->usb2_init = omap2_usb2_init;
351 udc_device_init(pdata);
352 ohci_device_init(pdata);
353 otg_device_init(pdata);
354 omap_otg_init(pdata);
355 clk_disable(ick);
356 clk_put(ick);
357}
358
359#endif
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index b19d1b43c12e..c4a576856661 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -41,12 +41,10 @@ static struct musb_hdrc_config musb_config = {
41}; 41};
42 42
43static struct musb_hdrc_platform_data musb_plat = { 43static struct musb_hdrc_platform_data musb_plat = {
44#ifdef CONFIG_USB_MUSB_OTG 44#ifdef CONFIG_USB_GADGET_MUSB_HDRC
45 .mode = MUSB_OTG, 45 .mode = MUSB_OTG,
46#elif defined(CONFIG_USB_MUSB_HDRC_HCD) 46#else
47 .mode = MUSB_HOST, 47 .mode = MUSB_HOST,
48#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
49 .mode = MUSB_PERIPHERAL,
50#endif 48#endif
51 /* .clock is set dynamically */ 49 /* .clock is set dynamically */
52 .config = &musb_config, 50 .config = &musb_config,
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index db84a46ce7fd..805bea6edf17 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -300,7 +300,7 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
300 printk(error, 3, status); 300 printk(error, 3, status);
301 return status; 301 return status;
302 } 302 }
303 tusb_resources[2].start = irq + IH_GPIO_BASE; 303 tusb_resources[2].start = gpio_to_irq(irq);
304 304
305 /* set up memory timings ... can speed them up later */ 305 /* set up memory timings ... can speed them up later */
306 if (!ps_refclk) { 306 if (!ps_refclk) {
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 16a1b092cf36..0ac2caf15941 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -16,6 +16,8 @@
16 16
17#include <linux/err.h> 17#include <linux/err.h>
18 18
19#include <plat/voltage.h>
20
19#include "vc.h" 21#include "vc.h"
20#include "vp.h" 22#include "vp.h"
21 23
@@ -91,25 +93,6 @@ struct voltagedomain {
91}; 93};
92 94
93/** 95/**
94 * struct omap_volt_data - Omap voltage specific data.
95 * @voltage_nominal: The possible voltage value in uV
96 * @sr_efuse_offs: The offset of the efuse register(from system
97 * control module base address) from where to read
98 * the n-target value for the smartreflex module.
99 * @sr_errminlimit: Error min limit value for smartreflex. This value
100 * differs at differnet opp and thus is linked
101 * with voltage.
102 * @vp_errorgain: Error gain value for the voltage processor. This
103 * field also differs according to the voltage/opp.
104 */
105struct omap_volt_data {
106 u32 volt_nominal;
107 u32 sr_efuse_offs;
108 u8 sr_errminlimit;
109 u8 vp_errgain;
110};
111
112/**
113 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. 96 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
114 * @slew_rate: PMIC slew rate (in uv/us) 97 * @slew_rate: PMIC slew rate (in uv/us)
115 * @step_size: PMIC voltage step size (in uv) 98 * @step_size: PMIC voltage step size (in uv)
@@ -156,6 +139,7 @@ int omap_voltage_late_init(void);
156 139
157extern void omap2xxx_voltagedomains_init(void); 140extern void omap2xxx_voltagedomains_init(void);
158extern void omap3xxx_voltagedomains_init(void); 141extern void omap3xxx_voltagedomains_init(void);
142extern void am33xx_voltagedomains_init(void);
159extern void omap44xx_voltagedomains_init(void); 143extern void omap44xx_voltagedomains_init(void);
160 144
161struct voltagedomain *voltdm_lookup(const char *name); 145struct voltagedomain *voltdm_lookup(const char *name);
diff --git a/arch/arm/mach-omap2/voltagedomains33xx_data.c b/arch/arm/mach-omap2/voltagedomains33xx_data.c
new file mode 100644
index 000000000000..965458dc0cb9
--- /dev/null
+++ b/arch/arm/mach-omap2/voltagedomains33xx_data.c
@@ -0,0 +1,43 @@
1/*
2 * AM33XX voltage domain data
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include "voltage.h"
20
21static struct voltagedomain am33xx_voltdm_mpu = {
22 .name = "mpu",
23};
24
25static struct voltagedomain am33xx_voltdm_core = {
26 .name = "core",
27};
28
29static struct voltagedomain am33xx_voltdm_rtc = {
30 .name = "rtc",
31};
32
33static struct voltagedomain *voltagedomains_am33xx[] __initdata = {
34 &am33xx_voltdm_mpu,
35 &am33xx_voltdm_core,
36 &am33xx_voltdm_rtc,
37 NULL,
38};
39
40void __init am33xx_voltagedomains_init(void)
41{
42 voltdm_init(voltagedomains_am33xx);
43}