aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-30 19:22:54 -0400
committerArnd Bergmann <arnd@arndb.de>2011-10-30 19:22:54 -0400
commitc6c3a3a03e6de52866bc81a32fc551733625d553 (patch)
treeb55967a9163dba315e2543d648de758b82c85fa1
parent07e87e15b969a05a7943d7ff1abc2d8da287171c (diff)
parent8aca3ab5865f8cfbde841b6daf9442cc2279ced3 (diff)
Merge branch 'omap/cleanup' into next/cleanup2
-rw-r--r--Documentation/devicetree/bindings/arm/omap/dsp.txt14
-rw-r--r--Documentation/devicetree/bindings/arm/omap/iva.txt19
-rw-r--r--Documentation/devicetree/bindings/arm/omap/l3-noc.txt19
-rw-r--r--Documentation/devicetree/bindings/arm/omap/mpu.txt27
-rw-r--r--Documentation/devicetree/bindings/arm/omap/omap.txt43
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts29
-rw-r--r--arch/arm/boot/dts/omap3.dtsi63
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts29
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts29
-rw-r--r--arch/arm/boot/dts/omap4.dtsi103
-rw-r--r--arch/arm/include/asm/device.h5
-rw-r--r--arch/arm/mach-omap1/Makefile2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c16
-rw-r--r--arch/arm/mach-omap1/board-fsample.c76
-rw-r--r--arch/arm/mach-omap1/board-generic.c16
-rw-r--r--arch/arm/mach-omap1/board-h2.c16
-rw-r--r--arch/arm/mach-omap1/board-h3.c16
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c12
-rw-r--r--arch/arm/mach-omap1/board-innovator.c36
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c34
-rw-r--r--arch/arm/mach-omap1/board-osk.c16
-rw-r--r--arch/arm/mach-omap1/board-palmte.c16
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c16
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c18
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c75
-rw-r--r--arch/arm/mach-omap1/board-sx1.c17
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c16
-rw-r--r--arch/arm/mach-omap1/devices.c3
-rw-r--r--arch/arm/mach-omap1/io.c57
-rw-r--r--arch/arm/mach-omap1/mcbsp.c45
-rw-r--r--arch/arm/mach-omap1/timer.c173
-rw-r--r--arch/arm/mach-omap2/Kconfig8
-rw-r--r--arch/arm/mach-omap2/Makefile88
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c20
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c9
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c11
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c19
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c9
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c8
-rw-r--r--arch/arm/mach-omap2/board-apollon.c17
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c13
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c9
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c19
-rw-r--r--arch/arm/mach-omap2/board-flash.c5
-rw-r--r--arch/arm/mach-omap2/board-flash.h19
-rw-r--r--arch/arm/mach-omap2/board-generic.c158
-rw-r--r--arch/arm/mach-omap2/board-h4.c24
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c13
-rw-r--r--arch/arm/mach-omap2/board-ldp.c9
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c25
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c22
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c9
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c11
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c16
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c18
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c17
-rw-r--r--arch/arm/mach-omap2/board-overo.c11
-rw-r--r--arch/arm/mach-omap2/board-rm680.c25
-rw-r--r--arch/arm/mach-omap2/board-rx51.c25
-rw-r--r--arch/arm/mach-omap2/board-ti8168evm.c10
-rw-r--r--arch/arm/mach-omap2/board-zoom.c23
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c48
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c48
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c47
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c33
-rw-r--r--arch/arm/mach-omap2/clockdomain.c149
-rw-r--r--arch/arm/mach-omap2/clockdomain.h22
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c4
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c2
-rw-r--r--arch/arm/mach-omap2/clockdomains2420_data.c154
-rw-r--r--arch/arm/mach-omap2/clockdomains2430_data.c181
-rw-r--r--arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c803
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c398
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c409
-rw-r--r--arch/arm/mach-omap2/common.c62
-rw-r--r--arch/arm/mach-omap2/control.c14
-rw-r--r--arch/arm/mach-omap2/devices.c91
-rw-r--r--arch/arm/mach-omap2/display.c17
-rw-r--r--arch/arm/mach-omap2/dma.c25
-rw-r--r--arch/arm/mach-omap2/gpio.c22
-rw-r--r--arch/arm/mach-omap2/hsmmc.c38
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c18
-rw-r--r--arch/arm/mach-omap2/id.c191
-rw-r--r--arch/arm/mach-omap2/io.c150
-rw-r--r--arch/arm/mach-omap2/io.h7
-rw-r--r--arch/arm/mach-omap2/irq.c4
-rw-r--r--arch/arm/mach-omap2/mcbsp.c120
-rw-r--r--arch/arm/mach-omap2/omap-smp.c7
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c59
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c67
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c200
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c104
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.c147
-rw-r--r--arch/arm/mach-omap2/omap_l3_noc.h224
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c91
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.h164
-rw-r--r--arch/arm/mach-omap2/omap_twl.c107
-rw-r--r--arch/arm/mach-omap2/opp.c2
-rw-r--r--arch/arm/mach-omap2/pm.c104
-rw-r--r--arch/arm/mach-omap2/pm24xx.c27
-rw-r--r--arch/arm/mach-omap2/pm34xx.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain-common.c7
-rw-r--r--arch/arm/mach-omap2/powerdomain.c110
-rw-r--r--arch/arm/mach-omap2/powerdomain.h19
-rw-r--r--arch/arm/mach-omap2/powerdomain2xxx_3xxx.c2
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c21
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_data.c48
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c97
-rw-r--r--arch/arm/mach-omap2/powerdomains44xx_data.c36
-rw-r--r--arch/arm/mach-omap2/prcm.c19
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c56
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h12
-rw-r--r--arch/arm/mach-omap2/prm44xx.c71
-rw-r--r--arch/arm/mach-omap2/prm44xx.h12
-rw-r--r--arch/arm/mach-omap2/sdrc.c13
-rw-r--r--arch/arm/mach-omap2/serial.c39
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c4
-rw-r--r--arch/arm/mach-omap2/smartreflex.c29
-rw-r--r--arch/arm/mach-omap2/sr_device.c19
-rw-r--r--arch/arm/mach-omap2/timer.c194
-rw-r--r--arch/arm/mach-omap2/usb-musb.c29
-rw-r--r--arch/arm/mach-omap2/vc.c367
-rw-r--r--arch/arm/mach-omap2/vc.h88
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c31
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c44
-rw-r--r--arch/arm/mach-omap2/voltage.c1088
-rw-r--r--arch/arm/mach-omap2/voltage.h150
-rw-r--r--arch/arm/mach-omap2/voltagedomains2xxx_data.c32
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c83
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c99
-rw-r--r--arch/arm/mach-omap2/vp.c278
-rw-r--r--arch/arm/mach-omap2/vp.h133
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c35
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c47
-rw-r--r--arch/arm/plat-omap/devices.c46
-rw-r--r--arch/arm/plat-omap/dmtimer.c713
-rw-r--r--arch/arm/plat-omap/i2c.c18
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h2
-rw-r--r--arch/arm/plat-omap/include/plat/common.h30
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h108
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h233
-rw-r--r--arch/arm/plat-omap/include/plat/io.h35
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h208
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h31
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h3
-rw-r--r--arch/arm/plat-omap/include/plat/voltage.h20
-rw-r--r--arch/arm/plat-omap/io.c10
-rw-r--r--arch/arm/plat-omap/mcbsp.c385
-rw-r--r--arch/arm/plat-omap/omap_device.c450
-rw-r--r--arch/arm/plat-omap/sram.c85
-rw-r--r--drivers/of/base.c84
-rw-r--r--include/linux/of.h18
154 files changed, 6353 insertions, 5540 deletions
diff --git a/Documentation/devicetree/bindings/arm/omap/dsp.txt b/Documentation/devicetree/bindings/arm/omap/dsp.txt
new file mode 100644
index 000000000000..d3830a32ce08
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/dsp.txt
@@ -0,0 +1,14 @@
1* TI - DSP (Digital Signal Processor)
2
3TI DSP included in OMAP SoC
4
5Required properties:
6- compatible : Should be "ti,omap3-c64" for OMAP3 & 4
7- ti,hwmods: "dsp"
8
9Examples:
10
11dsp {
12 compatible = "ti,omap3-c64";
13 ti,hwmods = "dsp";
14};
diff --git a/Documentation/devicetree/bindings/arm/omap/iva.txt b/Documentation/devicetree/bindings/arm/omap/iva.txt
new file mode 100644
index 000000000000..6d6295171358
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/iva.txt
@@ -0,0 +1,19 @@
1* TI - IVA (Imaging and Video Accelerator) subsystem
2
3The IVA contain various audio, video or imaging HW accelerator
4depending of the version.
5
6Required properties:
7- compatible : Should be:
8 - "ti,ivahd" for OMAP4
9 - "ti,iva2.2" for OMAP3
10 - "ti,iva2.1" for OMAP2430
11 - "ti,iva1" for OMAP2420
12- ti,hwmods: "iva"
13
14Examples:
15
16iva {
17 compatible = "ti,ivahd", "ti,iva";
18 ti,hwmods = "iva";
19};
diff --git a/Documentation/devicetree/bindings/arm/omap/l3-noc.txt b/Documentation/devicetree/bindings/arm/omap/l3-noc.txt
new file mode 100644
index 000000000000..6888a5efc860
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/l3-noc.txt
@@ -0,0 +1,19 @@
1* TI - L3 Network On Chip (NoC)
2
3This version is an implementation of the generic NoC IP
4provided by Arteris.
5
6Required properties:
7- compatible : Should be "ti,omap3-l3-smx" for OMAP3 family
8 Should be "ti,omap4-l3-noc" for OMAP4 family
9- ti,hwmods: "l3_main_1", ... One hwmod for each noc domain.
10
11Examples:
12
13ocp {
14 compatible = "ti,omap4-l3-noc", "simple-bus";
15 #address-cells = <1>;
16 #size-cells = <1>;
17 ranges;
18 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
19};
diff --git a/Documentation/devicetree/bindings/arm/omap/mpu.txt b/Documentation/devicetree/bindings/arm/omap/mpu.txt
new file mode 100644
index 000000000000..1a5a42ce21bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/mpu.txt
@@ -0,0 +1,27 @@
1* TI - MPU (Main Processor Unit) subsystem
2
3The MPU subsystem contain one or several ARM cores
4depending of the version.
5The MPU contain CPUs, GIC, L2 cache and a local PRCM.
6
7Required properties:
8- compatible : Should be "ti,omap3-mpu" for OMAP3
9 Should be "ti,omap4-mpu" for OMAP4
10- ti,hwmods: "mpu"
11
12Examples:
13
14- For an OMAP4 SMP system:
15
16mpu {
17 compatible = "ti,omap4-mpu";
18 ti,hwmods = "mpu";
19};
20
21
22- For an OMAP3 monocore system:
23
24mpu {
25 compatible = "ti,omap3-mpu";
26 ti,hwmods = "mpu";
27};
diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt
new file mode 100644
index 000000000000..dbdab40ed3a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -0,0 +1,43 @@
1* Texas Instruments OMAP
2
3OMAP is currently using a static file per SoC family to describe the
4IPs present in the SoC.
5On top of that an omap_device is created to extend the platform_device
6capabilities and to allow binding with one or several hwmods.
7The hwmods will contain all the information to build the device:
8adresse range, irq lines, dma lines, interconnect, PRCM register,
9clock domain, input clocks.
10For the moment just point to the existing hwmod, the next step will be
11to move data from hwmod to device-tree representation.
12
13
14Required properties:
15- compatible: Every devices present in OMAP SoC should be in the
16 form: "ti,XXX"
17- ti,hwmods: list of hwmod names (ascii strings), that comes from the OMAP
18 HW documentation, attached to a device. Must contain at least
19 one hwmod.
20
21Optional properties:
22- ti,no_idle_on_suspend: When present, it prevents the PM to idle the module
23 during suspend.
24
25
26Example:
27
28spinlock@1 {
29 compatible = "ti,omap4-spinlock";
30 ti,hwmods = "spinlock";
31};
32
33
34Boards:
35
36- OMAP3 BeagleBoard : Low cost community board
37 compatible = "ti,omap3-beagle", "ti,omap3"
38
39- OMAP4 SDP : Software Developement Board
40 compatible = "ti,omap4-sdp", "ti,omap4430"
41
42- OMAP4 PandaBoard : Low cost community board
43 compatible = "ti,omap4-panda", "ti,omap4430"
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
new file mode 100644
index 000000000000..9486be62bcdd
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap3.dtsi"
11
12/ {
13 model = "TI OMAP3 BeagleBoard";
14 compatible = "ti,omap3-beagle", "ti,omap3";
15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug earlyprintk";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x80000000 0x20000000>; /* 512 MB */
28 };
29};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
new file mode 100644
index 000000000000..d202bb5ec7ef
--- /dev/null
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -0,0 +1,63 @@
1/*
2 * Device Tree Source for OMAP3 SoC
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 compatible = "ti,omap3430", "ti,omap3";
15
16 cpus {
17 cpu@0 {
18 compatible = "arm,cortex-a8";
19 };
20 };
21
22 /*
23 * The soc node represents the soc top level view. It is uses for IPs
24 * that are not memory mapped in the MPU view or for the MPU itself.
25 */
26 soc {
27 compatible = "ti,omap-infra";
28 mpu {
29 compatible = "ti,omap3-mpu";
30 ti,hwmods = "mpu";
31 };
32
33 iva {
34 compatible = "ti,iva2.2";
35 ti,hwmods = "iva";
36
37 dsp {
38 compatible = "ti,omap3-c64";
39 };
40 };
41 };
42
43 /*
44 * XXX: Use a flat representation of the OMAP3 interconnect.
45 * The real OMAP interconnect network is quite complex.
46 * Since that will not bring real advantage to represent that in DT for
47 * the moment, just use a fake OCP bus entry to represent the whole bus
48 * hierarchy.
49 */
50 ocp {
51 compatible = "simple-bus";
52 #address-cells = <1>;
53 #size-cells = <1>;
54 ranges;
55 ti,hwmods = "l3_main";
56
57 intc: interrupt-controller@1 {
58 compatible = "ti,omap3-intc";
59 interrupt-controller;
60 #interrupt-cells = <1>;
61 };
62 };
63};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
new file mode 100644
index 000000000000..c7026578ce7d
--- /dev/null
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap4.dtsi"
11
12/ {
13 model = "TI OMAP4 PandaBoard";
14 compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x80000000 0x40000000>; /* 1 GB */
28 };
29};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
new file mode 100644
index 000000000000..066e28c90328
--- /dev/null
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap4.dtsi"
11
12/ {
13 model = "TI OMAP4 SDP board";
14 compatible = "ti,omap4-sdp", "ti,omap4430", "ti,omap4";
15
16 /*
17 * Since the initial device tree board file does not create any
18 * devices (MMC, network...), the only way to boot is to provide a
19 * ramdisk.
20 */
21 chosen {
22 bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x80000000 0x40000000>; /* 1 GB */
28 };
29};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
new file mode 100644
index 000000000000..4c61c829043a
--- /dev/null
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * Carveout for multimedia usecases
11 * It should be the last 48MB of the first 512MB memory part
12 * In theory, it should not even exist. That zone should be reserved
13 * dynamically during the .reserve callback.
14 */
15/memreserve/ 0x9d000000 0x03000000;
16
17/include/ "skeleton.dtsi"
18
19/ {
20 compatible = "ti,omap4430", "ti,omap4";
21 interrupt-parent = <&gic>;
22
23 aliases {
24 };
25
26 cpus {
27 cpu@0 {
28 compatible = "arm,cortex-a9";
29 };
30 cpu@1 {
31 compatible = "arm,cortex-a9";
32 };
33 };
34
35 /*
36 * The soc node represents the soc top level view. It is uses for IPs
37 * that are not memory mapped in the MPU view or for the MPU itself.
38 */
39 soc {
40 compatible = "ti,omap-infra";
41 mpu {
42 compatible = "ti,omap4-mpu";
43 ti,hwmods = "mpu";
44 };
45
46 dsp {
47 compatible = "ti,omap3-c64";
48 ti,hwmods = "dsp";
49 };
50
51 iva {
52 compatible = "ti,ivahd";
53 ti,hwmods = "iva";
54 };
55 };
56
57 /*
58 * XXX: Use a flat representation of the OMAP4 interconnect.
59 * The real OMAP interconnect network is quite complex.
60 *
61 * MPU -+-- MPU_PRIVATE - GIC, L2
62 * |
63 * +----------------+----------+
64 * | | |
65 * + +- EMIF - DDR |
66 * | | |
67 * | + +--------+
68 * | | |
69 * | +- L4_ABE - AESS, MCBSP, TIMERs...
70 * | |
71 * +- L3_MAIN --+- L4_CORE - IPs...
72 * |
73 * +- L4_PER - IPs...
74 * |
75 * +- L4_CFG -+- L4_WKUP - IPs...
76 * | |
77 * | +- IPs...
78 * +- IPU ----+
79 * | |
80 * +- DSP ----+
81 * | |
82 * +- DSS ----+
83 *
84 * Since that will not bring real advantage to represent that in DT for
85 * the moment, just use a fake OCP bus entry to represent the whole bus
86 * hierarchy.
87 */
88 ocp {
89 compatible = "ti,omap4-l3-noc", "simple-bus";
90 #address-cells = <1>;
91 #size-cells = <1>;
92 ranges;
93 ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
94
95 gic: interrupt-controller@48241000 {
96 compatible = "arm,cortex-a9-gic";
97 interrupt-controller;
98 #interrupt-cells = <1>;
99 reg = <0x48241000 0x1000>,
100 <0x48240100 0x0100>;
101 };
102 };
103};
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
index 9f390ce335cb..b5c9f5b1f6a3 100644
--- a/arch/arm/include/asm/device.h
+++ b/arch/arm/include/asm/device.h
@@ -12,7 +12,12 @@ struct dev_archdata {
12#endif 12#endif
13}; 13};
14 14
15struct omap_device;
16
15struct pdev_archdata { 17struct pdev_archdata {
18#ifdef CONFIG_ARCH_OMAP
19 struct omap_device *od;
20#endif
16}; 21};
17 22
18#endif 23#endif
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 5b114d1558c8..11c85cd2731a 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o 6obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o 7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
8 8
9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
10 10
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 312ea6b0409d..44277370806e 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -135,12 +135,6 @@ void ams_delta_latch2_write(u16 mask, u16 value)
135 *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg; 135 *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
136} 136}
137 137
138static void __init ams_delta_init_irq(void)
139{
140 omap1_init_common_hw();
141 omap1_init_irq();
142}
143
144static struct map_desc ams_delta_io_desc[] __initdata = { 138static struct map_desc ams_delta_io_desc[] __initdata = {
145 /* AMS_DELTA_LATCH1 */ 139 /* AMS_DELTA_LATCH1 */
146 { 140 {
@@ -379,17 +373,13 @@ static int __init ams_delta_modem_init(void)
379} 373}
380arch_initcall(ams_delta_modem_init); 374arch_initcall(ams_delta_modem_init);
381 375
382static void __init ams_delta_map_io(void)
383{
384 omap1_map_common_io();
385}
386
387MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") 376MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
388 /* Maintainer: Jonathan McDowell <noodles@earth.li> */ 377 /* Maintainer: Jonathan McDowell <noodles@earth.li> */
389 .boot_params = 0x10000100, 378 .boot_params = 0x10000100,
390 .map_io = ams_delta_map_io, 379 .map_io = omap15xx_map_io,
380 .init_early = omap1_init_early,
391 .reserve = omap_reserve, 381 .reserve = omap_reserve,
392 .init_irq = ams_delta_init_irq, 382 .init_irq = omap1_init_irq,
393 .init_machine = ams_delta_init, 383 .init_machine = ams_delta_init,
394 .timer = &omap1_timer, 384 .timer = &omap1_timer,
395MACHINE_END 385MACHINE_END
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index a6b1bea50371..b09dfe6d6e8d 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -297,6 +297,39 @@ static struct omap_board_config_kernel fsample_config[] __initdata = {
297 297
298static void __init omap_fsample_init(void) 298static void __init omap_fsample_init(void)
299{ 299{
300 /* Early, board-dependent init */
301
302 /*
303 * Hold GSM Reset until needed
304 */
305 omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
306
307 /*
308 * UARTs -> done automagically by 8250 driver
309 */
310
311 /*
312 * CSx timings, GPIO Mux ... setup
313 */
314
315 /* Flash: CS0 timings setup */
316 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
317 omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
318
319 /*
320 * Ethernet support through the debug board
321 * CS1 timings setup
322 */
323 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
324 omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
325
326 /*
327 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
328 * It is used as the Ethernet controller interrupt
329 */
330 omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
331 OMAP7XX_IO_CONF_9);
332
300 fsample_init_smc91x(); 333 fsample_init_smc91x();
301 334
302 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0) 335 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -326,12 +359,6 @@ static void __init omap_fsample_init(void)
326 omap_register_i2c_bus(1, 100, NULL, 0); 359 omap_register_i2c_bus(1, 100, NULL, 0);
327} 360}
328 361
329static void __init omap_fsample_init_irq(void)
330{
331 omap1_init_common_hw();
332 omap1_init_irq();
333}
334
335/* Only FPGA needs to be mapped here. All others are done with ioremap */ 362/* Only FPGA needs to be mapped here. All others are done with ioremap */
336static struct map_desc omap_fsample_io_desc[] __initdata = { 363static struct map_desc omap_fsample_io_desc[] __initdata = {
337 { 364 {
@@ -350,49 +377,18 @@ static struct map_desc omap_fsample_io_desc[] __initdata = {
350 377
351static void __init omap_fsample_map_io(void) 378static void __init omap_fsample_map_io(void)
352{ 379{
353 omap1_map_common_io(); 380 omap15xx_map_io();
354 iotable_init(omap_fsample_io_desc, 381 iotable_init(omap_fsample_io_desc,
355 ARRAY_SIZE(omap_fsample_io_desc)); 382 ARRAY_SIZE(omap_fsample_io_desc));
356
357 /* Early, board-dependent init */
358
359 /*
360 * Hold GSM Reset until needed
361 */
362 omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
363
364 /*
365 * UARTs -> done automagically by 8250 driver
366 */
367
368 /*
369 * CSx timings, GPIO Mux ... setup
370 */
371
372 /* Flash: CS0 timings setup */
373 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
374 omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
375
376 /*
377 * Ethernet support through the debug board
378 * CS1 timings setup
379 */
380 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
381 omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
382
383 /*
384 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
385 * It is used as the Ethernet controller interrupt
386 */
387 omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
388} 383}
389 384
390MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample") 385MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
391/* Maintainer: Brian Swetland <swetland@google.com> */ 386/* Maintainer: Brian Swetland <swetland@google.com> */
392 .boot_params = 0x10000100, 387 .boot_params = 0x10000100,
393 .map_io = omap_fsample_map_io, 388 .map_io = omap_fsample_map_io,
389 .init_early = omap1_init_early,
394 .reserve = omap_reserve, 390 .reserve = omap_reserve,
395 .init_irq = omap_fsample_init_irq, 391 .init_irq = omap1_init_irq,
396 .init_machine = omap_fsample_init, 392 .init_machine = omap_fsample_init,
397 .timer = &omap1_timer, 393 .timer = &omap1_timer,
398MACHINE_END 394MACHINE_END
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 04fc356c40fa..cc0cca7ee199 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -28,12 +28,6 @@
28#include <plat/board.h> 28#include <plat/board.h>
29#include <plat/common.h> 29#include <plat/common.h>
30 30
31static void __init omap_generic_init_irq(void)
32{
33 omap1_init_common_hw();
34 omap1_init_irq();
35}
36
37/* assume no Mini-AB port */ 31/* assume no Mini-AB port */
38 32
39#ifdef CONFIG_ARCH_OMAP15XX 33#ifdef CONFIG_ARCH_OMAP15XX
@@ -87,17 +81,13 @@ static void __init omap_generic_init(void)
87 omap_register_i2c_bus(1, 100, NULL, 0); 81 omap_register_i2c_bus(1, 100, NULL, 0);
88} 82}
89 83
90static void __init omap_generic_map_io(void)
91{
92 omap1_map_common_io();
93}
94
95MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 84MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
96 /* Maintainer: Tony Lindgren <tony@atomide.com> */ 85 /* Maintainer: Tony Lindgren <tony@atomide.com> */
97 .boot_params = 0x10000100, 86 .boot_params = 0x10000100,
98 .map_io = omap_generic_map_io, 87 .map_io = omap16xx_map_io,
88 .init_early = omap1_init_early,
99 .reserve = omap_reserve, 89 .reserve = omap_reserve,
100 .init_irq = omap_generic_init_irq, 90 .init_irq = omap1_init_irq,
101 .init_machine = omap_generic_init, 91 .init_machine = omap_generic_init,
102 .timer = &omap1_timer, 92 .timer = &omap1_timer,
103MACHINE_END 93MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index cb7fb1aa3dca..248a5b8e2865 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -373,12 +373,6 @@ static struct i2c_board_info __initdata h2_i2c_board_info[] = {
373 }, 373 },
374}; 374};
375 375
376static void __init h2_init_irq(void)
377{
378 omap1_init_common_hw();
379 omap1_init_irq();
380}
381
382static struct omap_usb_config h2_usb_config __initdata = { 376static struct omap_usb_config h2_usb_config __initdata = {
383 /* usb1 has a Mini-AB port and external isp1301 transceiver */ 377 /* usb1 has a Mini-AB port and external isp1301 transceiver */
384 .otg = 2, 378 .otg = 2,
@@ -454,17 +448,13 @@ static void __init h2_init(void)
454 h2_mmc_init(); 448 h2_mmc_init();
455} 449}
456 450
457static void __init h2_map_io(void)
458{
459 omap1_map_common_io();
460}
461
462MACHINE_START(OMAP_H2, "TI-H2") 451MACHINE_START(OMAP_H2, "TI-H2")
463 /* Maintainer: Imre Deak <imre.deak@nokia.com> */ 452 /* Maintainer: Imre Deak <imre.deak@nokia.com> */
464 .boot_params = 0x10000100, 453 .boot_params = 0x10000100,
465 .map_io = h2_map_io, 454 .map_io = omap16xx_map_io,
455 .init_early = omap1_init_early,
466 .reserve = omap_reserve, 456 .reserve = omap_reserve,
467 .init_irq = h2_init_irq, 457 .init_irq = omap1_init_irq,
468 .init_machine = h2_init, 458 .init_machine = h2_init,
469 .timer = &omap1_timer, 459 .timer = &omap1_timer,
470MACHINE_END 460MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 31f34875ffad..f28f05fe7676 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -436,23 +436,13 @@ static void __init h3_init(void)
436 h3_mmc_init(); 436 h3_mmc_init();
437} 437}
438 438
439static void __init h3_init_irq(void)
440{
441 omap1_init_common_hw();
442 omap1_init_irq();
443}
444
445static void __init h3_map_io(void)
446{
447 omap1_map_common_io();
448}
449
450MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 439MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
451 /* Maintainer: Texas Instruments, Inc. */ 440 /* Maintainer: Texas Instruments, Inc. */
452 .boot_params = 0x10000100, 441 .boot_params = 0x10000100,
453 .map_io = h3_map_io, 442 .map_io = omap16xx_map_io,
443 .init_early = omap1_init_early,
454 .reserve = omap_reserve, 444 .reserve = omap_reserve,
455 .init_irq = h3_init_irq, 445 .init_irq = omap1_init_irq,
456 .init_machine = h3_init, 446 .init_machine = h3_init,
457 .timer = &omap1_timer, 447 .timer = &omap1_timer,
458MACHINE_END 448MACHINE_END
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 36e06ea7ec65..67798dfc4f8d 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -500,7 +500,7 @@ static void __init htcherald_lcd_init(void)
500 500
501static void __init htcherald_map_io(void) 501static void __init htcherald_map_io(void)
502{ 502{
503 omap1_map_common_io(); 503 omap7xx_map_io();
504 504
505 /* 505 /*
506 * The LCD panel must be disabled and DMA turned off here, as doing 506 * The LCD panel must be disabled and DMA turned off here, as doing
@@ -601,20 +601,14 @@ static void __init htcherald_init(void)
601#endif 601#endif
602} 602}
603 603
604static void __init htcherald_init_irq(void)
605{
606 printk(KERN_INFO "htcherald_init_irq.\n");
607 omap1_init_common_hw();
608 omap1_init_irq();
609}
610
611MACHINE_START(HERALD, "HTC Herald") 604MACHINE_START(HERALD, "HTC Herald")
612 /* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */ 605 /* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
613 /* Maintainer: wing-linux.sourceforge.net */ 606 /* Maintainer: wing-linux.sourceforge.net */
614 .boot_params = 0x10000100, 607 .boot_params = 0x10000100,
615 .map_io = htcherald_map_io, 608 .map_io = htcherald_map_io,
609 .init_early = omap1_init_early,
616 .reserve = omap_reserve, 610 .reserve = omap_reserve,
617 .init_irq = htcherald_init_irq, 611 .init_irq = omap1_init_irq,
618 .init_machine = htcherald_init, 612 .init_machine = htcherald_init,
619 .timer = &omap1_timer, 613 .timer = &omap1_timer,
620MACHINE_END 614MACHINE_END
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 0b1ba462d388..3e349d0ce32c 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -289,12 +289,6 @@ static void __init innovator_init_smc91x(void)
289 } 289 }
290} 290}
291 291
292static void __init innovator_init_irq(void)
293{
294 omap1_init_common_hw();
295 omap1_init_irq();
296}
297
298#ifdef CONFIG_ARCH_OMAP15XX 292#ifdef CONFIG_ARCH_OMAP15XX
299static struct omap_usb_config innovator1510_usb_config __initdata = { 293static struct omap_usb_config innovator1510_usb_config __initdata = {
300 /* for bundled non-standard host and peripheral cables */ 294 /* for bundled non-standard host and peripheral cables */
@@ -439,30 +433,32 @@ static void __init innovator_init(void)
439 innovator_mmc_init(); 433 innovator_mmc_init();
440} 434}
441 435
436/*
437 * REVISIT: Assume 15xx for now, we don't want to do revision check
438 * until later on. The right way to fix this is to set up a different
439 * machine_id for 16xx Innovator, or use device tree.
440 */
442static void __init innovator_map_io(void) 441static void __init innovator_map_io(void)
443{ 442{
444 omap1_map_common_io(); 443 omap15xx_map_io();
445 444
446#ifdef CONFIG_ARCH_OMAP15XX 445 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
447 if (cpu_is_omap1510()) { 446 udelay(10); /* Delay needed for FPGA */
448 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); 447
449 udelay(10); /* Delay needed for FPGA */ 448 /* Dump the Innovator FPGA rev early - useful info for support. */
450 449 pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
451 /* Dump the Innovator FPGA rev early - useful info for support. */ 450 fpga_read(OMAP1510_FPGA_REV_HIGH),
452 printk("Innovator FPGA Rev %d.%d Board Rev %d\n", 451 fpga_read(OMAP1510_FPGA_REV_LOW),
453 fpga_read(OMAP1510_FPGA_REV_HIGH), 452 fpga_read(OMAP1510_FPGA_BOARD_REV));
454 fpga_read(OMAP1510_FPGA_REV_LOW),
455 fpga_read(OMAP1510_FPGA_BOARD_REV));
456 }
457#endif
458} 453}
459 454
460MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") 455MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
461 /* Maintainer: MontaVista Software, Inc. */ 456 /* Maintainer: MontaVista Software, Inc. */
462 .boot_params = 0x10000100, 457 .boot_params = 0x10000100,
463 .map_io = innovator_map_io, 458 .map_io = innovator_map_io,
459 .init_early = omap1_init_early,
464 .reserve = omap_reserve, 460 .reserve = omap_reserve,
465 .init_irq = innovator_init_irq, 461 .init_irq = omap1_init_irq,
466 .init_machine = innovator_init, 462 .init_machine = innovator_init,
467 .timer = &omap1_timer, 463 .timer = &omap1_timer,
468MACHINE_END 464MACHINE_END
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 5469ce247ffe..9b348b6ee3ee 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -39,21 +39,6 @@
39 39
40#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
41 41
42static void __init omap_nokia770_init_irq(void)
43{
44 /* On Nokia 770, the SleepX signal is masked with an
45 * MPUIO line by default. It has to be unmasked for it
46 * to become functional */
47
48 /* SleepX mask direction */
49 omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
50 /* Unmask SleepX signal */
51 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
52
53 omap1_init_common_hw();
54 omap1_init_irq();
55}
56
57static const unsigned int nokia770_keymap[] = { 42static const unsigned int nokia770_keymap[] = {
58 KEY(1, 0, GROUP_0 | KEY_UP), 43 KEY(1, 0, GROUP_0 | KEY_UP),
59 KEY(2, 0, GROUP_1 | KEY_F5), 44 KEY(2, 0, GROUP_1 | KEY_F5),
@@ -246,6 +231,15 @@ static inline void nokia770_mmc_init(void)
246 231
247static void __init omap_nokia770_init(void) 232static void __init omap_nokia770_init(void)
248{ 233{
234 /* On Nokia 770, the SleepX signal is masked with an
235 * MPUIO line by default. It has to be unmasked for it
236 * to become functional */
237
238 /* SleepX mask direction */
239 omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
240 /* Unmask SleepX signal */
241 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
242
249 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); 243 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
250 spi_register_board_info(nokia770_spi_board_info, 244 spi_register_board_info(nokia770_spi_board_info,
251 ARRAY_SIZE(nokia770_spi_board_info)); 245 ARRAY_SIZE(nokia770_spi_board_info));
@@ -258,16 +252,12 @@ static void __init omap_nokia770_init(void)
258 nokia770_mmc_init(); 252 nokia770_mmc_init();
259} 253}
260 254
261static void __init omap_nokia770_map_io(void)
262{
263 omap1_map_common_io();
264}
265
266MACHINE_START(NOKIA770, "Nokia 770") 255MACHINE_START(NOKIA770, "Nokia 770")
267 .boot_params = 0x10000100, 256 .boot_params = 0x10000100,
268 .map_io = omap_nokia770_map_io, 257 .map_io = omap16xx_map_io,
258 .init_early = omap1_init_early,
269 .reserve = omap_reserve, 259 .reserve = omap_reserve,
270 .init_irq = omap_nokia770_init_irq, 260 .init_irq = omap1_init_irq,
271 .init_machine = omap_nokia770_init, 261 .init_machine = omap_nokia770_init,
272 .timer = &omap1_timer, 262 .timer = &omap1_timer,
273MACHINE_END 263MACHINE_END
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index b08a21380772..562986e1874f 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -279,12 +279,6 @@ static void __init osk_init_cf(void)
279 irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING); 279 irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
280} 280}
281 281
282static void __init osk_init_irq(void)
283{
284 omap1_init_common_hw();
285 omap1_init_irq();
286}
287
288static struct omap_usb_config osk_usb_config __initdata = { 282static struct omap_usb_config osk_usb_config __initdata = {
289 /* has usb host connector (A) ... for development it can also 283 /* has usb host connector (A) ... for development it can also
290 * be used, with a NONSTANDARD gender-bending cable/dongle, as 284 * be used, with a NONSTANDARD gender-bending cable/dongle, as
@@ -576,17 +570,13 @@ static void __init osk_init(void)
576 osk_mistral_init(); 570 osk_mistral_init();
577} 571}
578 572
579static void __init osk_map_io(void)
580{
581 omap1_map_common_io();
582}
583
584MACHINE_START(OMAP_OSK, "TI-OSK") 573MACHINE_START(OMAP_OSK, "TI-OSK")
585 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ 574 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
586 .boot_params = 0x10000100, 575 .boot_params = 0x10000100,
587 .map_io = osk_map_io, 576 .map_io = omap16xx_map_io,
577 .init_early = omap1_init_early,
588 .reserve = omap_reserve, 578 .reserve = omap_reserve,
589 .init_irq = osk_init_irq, 579 .init_irq = omap1_init_irq,
590 .init_machine = osk_init, 580 .init_machine = osk_init,
591 .timer = &omap1_timer, 581 .timer = &omap1_timer,
592MACHINE_END 582MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 459cb6bfed55..fc9edd8595e9 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -59,12 +59,6 @@
59#define PALMTE_MMC2_GPIO OMAP_MPUIO(7) 59#define PALMTE_MMC2_GPIO OMAP_MPUIO(7)
60#define PALMTE_MMC3_GPIO OMAP_MPUIO(11) 60#define PALMTE_MMC3_GPIO OMAP_MPUIO(11)
61 61
62static void __init omap_palmte_init_irq(void)
63{
64 omap1_init_common_hw();
65 omap1_init_irq();
66}
67
68static const unsigned int palmte_keymap[] = { 62static const unsigned int palmte_keymap[] = {
69 KEY(0, 0, KEY_F1), /* Calendar */ 63 KEY(0, 0, KEY_F1), /* Calendar */
70 KEY(1, 0, KEY_F2), /* Contacts */ 64 KEY(1, 0, KEY_F2), /* Contacts */
@@ -269,16 +263,12 @@ static void __init omap_palmte_init(void)
269 omap_register_i2c_bus(1, 100, NULL, 0); 263 omap_register_i2c_bus(1, 100, NULL, 0);
270} 264}
271 265
272static void __init omap_palmte_map_io(void)
273{
274 omap1_map_common_io();
275}
276
277MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") 266MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
278 .boot_params = 0x10000100, 267 .boot_params = 0x10000100,
279 .map_io = omap_palmte_map_io, 268 .map_io = omap15xx_map_io,
269 .init_early = omap1_init_early,
280 .reserve = omap_reserve, 270 .reserve = omap_reserve,
281 .init_irq = omap_palmte_init_irq, 271 .init_irq = omap1_init_irq,
282 .init_machine = omap_palmte_init, 272 .init_machine = omap_palmte_init,
283 .timer = &omap1_timer, 273 .timer = &omap1_timer,
284MACHINE_END 274MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index b214f45f646c..5ff3def49a85 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -263,12 +263,6 @@ static struct spi_board_info __initdata palmtt_boardinfo[] = {
263 } 263 }
264}; 264};
265 265
266static void __init omap_palmtt_init_irq(void)
267{
268 omap1_init_common_hw();
269 omap1_init_irq();
270}
271
272static struct omap_usb_config palmtt_usb_config __initdata = { 266static struct omap_usb_config palmtt_usb_config __initdata = {
273 .register_dev = 1, 267 .register_dev = 1,
274 .hmc_mode = 0, 268 .hmc_mode = 0,
@@ -315,16 +309,12 @@ static void __init omap_palmtt_init(void)
315 omap_register_i2c_bus(1, 100, NULL, 0); 309 omap_register_i2c_bus(1, 100, NULL, 0);
316} 310}
317 311
318static void __init omap_palmtt_map_io(void)
319{
320 omap1_map_common_io();
321}
322
323MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T") 312MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
324 .boot_params = 0x10000100, 313 .boot_params = 0x10000100,
325 .map_io = omap_palmtt_map_io, 314 .map_io = omap15xx_map_io,
315 .init_early = omap1_init_early,
326 .reserve = omap_reserve, 316 .reserve = omap_reserve,
327 .init_irq = omap_palmtt_init_irq, 317 .init_irq = omap1_init_irq,
328 .init_machine = omap_palmtt_init, 318 .init_machine = omap_palmtt_init,
329 .timer = &omap1_timer, 319 .timer = &omap1_timer,
330MACHINE_END 320MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 9b0ea48d35fd..8e0887375f7e 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -57,13 +57,6 @@
57#define PALMZ71_SLIDER_GPIO OMAP_MPUIO(3) 57#define PALMZ71_SLIDER_GPIO OMAP_MPUIO(3)
58#define PALMZ71_MMC_IN_GPIO OMAP_MPUIO(4) 58#define PALMZ71_MMC_IN_GPIO OMAP_MPUIO(4)
59 59
60static void __init
61omap_palmz71_init_irq(void)
62{
63 omap1_init_common_hw();
64 omap1_init_irq();
65}
66
67static const unsigned int palmz71_keymap[] = { 60static const unsigned int palmz71_keymap[] = {
68 KEY(0, 0, KEY_F1), 61 KEY(0, 0, KEY_F1),
69 KEY(1, 0, KEY_F2), 62 KEY(1, 0, KEY_F2),
@@ -334,17 +327,12 @@ omap_palmz71_init(void)
334 palmz71_gpio_setup(0); 327 palmz71_gpio_setup(0);
335} 328}
336 329
337static void __init
338omap_palmz71_map_io(void)
339{
340 omap1_map_common_io();
341}
342
343MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71") 330MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
344 .boot_params = 0x10000100, 331 .boot_params = 0x10000100,
345 .map_io = omap_palmz71_map_io, 332 .map_io = omap15xx_map_io,
333 .init_early = omap1_init_early,
346 .reserve = omap_reserve, 334 .reserve = omap_reserve,
347 .init_irq = omap_palmz71_init_irq, 335 .init_irq = omap1_init_irq,
348 .init_machine = omap_palmz71_init, 336 .init_machine = omap_palmz71_init,
349 .timer = &omap1_timer, 337 .timer = &omap1_timer,
350MACHINE_END 338MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 67acd4142639..6ed649b8b8d3 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -265,6 +265,39 @@ static void __init perseus2_init_smc91x(void)
265 265
266static void __init omap_perseus2_init(void) 266static void __init omap_perseus2_init(void)
267{ 267{
268 /* Early, board-dependent init */
269
270 /*
271 * Hold GSM Reset until needed
272 */
273 omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
274
275 /*
276 * UARTs -> done automagically by 8250 driver
277 */
278
279 /*
280 * CSx timings, GPIO Mux ... setup
281 */
282
283 /* Flash: CS0 timings setup */
284 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
285 omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
286
287 /*
288 * Ethernet support through the debug board
289 * CS1 timings setup
290 */
291 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
292 omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
293
294 /*
295 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
296 * It is used as the Ethernet controller interrupt
297 */
298 omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
299 OMAP7XX_IO_CONF_9);
300
268 perseus2_init_smc91x(); 301 perseus2_init_smc91x();
269 302
270 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 303 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -294,11 +327,6 @@ static void __init omap_perseus2_init(void)
294 omap_register_i2c_bus(1, 100, NULL, 0); 327 omap_register_i2c_bus(1, 100, NULL, 0);
295} 328}
296 329
297static void __init omap_perseus2_init_irq(void)
298{
299 omap1_init_common_hw();
300 omap1_init_irq();
301}
302/* Only FPGA needs to be mapped here. All others are done with ioremap */ 330/* Only FPGA needs to be mapped here. All others are done with ioremap */
303static struct map_desc omap_perseus2_io_desc[] __initdata = { 331static struct map_desc omap_perseus2_io_desc[] __initdata = {
304 { 332 {
@@ -311,49 +339,18 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
311 339
312static void __init omap_perseus2_map_io(void) 340static void __init omap_perseus2_map_io(void)
313{ 341{
314 omap1_map_common_io(); 342 omap7xx_map_io();
315 iotable_init(omap_perseus2_io_desc, 343 iotable_init(omap_perseus2_io_desc,
316 ARRAY_SIZE(omap_perseus2_io_desc)); 344 ARRAY_SIZE(omap_perseus2_io_desc));
317
318 /* Early, board-dependent init */
319
320 /*
321 * Hold GSM Reset until needed
322 */
323 omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
324
325 /*
326 * UARTs -> done automagically by 8250 driver
327 */
328
329 /*
330 * CSx timings, GPIO Mux ... setup
331 */
332
333 /* Flash: CS0 timings setup */
334 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
335 omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
336
337 /*
338 * Ethernet support through the debug board
339 * CS1 timings setup
340 */
341 omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
342 omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
343
344 /*
345 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
346 * It is used as the Ethernet controller interrupt
347 */
348 omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
349} 345}
350 346
351MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") 347MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
352 /* Maintainer: Kevin Hilman <kjh@hilman.org> */ 348 /* Maintainer: Kevin Hilman <kjh@hilman.org> */
353 .boot_params = 0x10000100, 349 .boot_params = 0x10000100,
354 .map_io = omap_perseus2_map_io, 350 .map_io = omap_perseus2_map_io,
351 .init_early = omap1_init_early,
355 .reserve = omap_reserve, 352 .reserve = omap_reserve,
356 .init_irq = omap_perseus2_init_irq, 353 .init_irq = omap1_init_irq,
357 .init_machine = omap_perseus2_init, 354 .init_machine = omap_perseus2_init,
358 .timer = &omap1_timer, 355 .timer = &omap1_timer,
359MACHINE_END 356MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 9c3b7c52d9cf..23326e04d6b9 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -407,24 +407,13 @@ static void __init omap_sx1_init(void)
407 gpio_direction_output(11, 0); /*A_SWITCH = 0 */ 407 gpio_direction_output(11, 0); /*A_SWITCH = 0 */
408 gpio_direction_output(15, 0); /*A_USB_ON = 0 */ 408 gpio_direction_output(15, 0); /*A_USB_ON = 0 */
409} 409}
410/*----------------------------------------*/
411static void __init omap_sx1_init_irq(void)
412{
413 omap1_init_common_hw();
414 omap1_init_irq();
415}
416/*----------------------------------------*/
417
418static void __init omap_sx1_map_io(void)
419{
420 omap1_map_common_io();
421}
422 410
423MACHINE_START(SX1, "OMAP310 based Siemens SX1") 411MACHINE_START(SX1, "OMAP310 based Siemens SX1")
424 .boot_params = 0x10000100, 412 .boot_params = 0x10000100,
425 .map_io = omap_sx1_map_io, 413 .map_io = omap15xx_map_io,
414 .init_early = omap1_init_early,
426 .reserve = omap_reserve, 415 .reserve = omap_reserve,
427 .init_irq = omap_sx1_init_irq, 416 .init_irq = omap1_init_irq,
428 .init_machine = omap_sx1_init, 417 .init_machine = omap_sx1_init,
429 .timer = &omap1_timer, 418 .timer = &omap1_timer,
430MACHINE_END 419MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 036edc0ee9b6..1444ce846ab7 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -159,17 +159,6 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
159static struct omap_board_config_kernel voiceblue_config[] = { 159static struct omap_board_config_kernel voiceblue_config[] = {
160}; 160};
161 161
162static void __init voiceblue_init_irq(void)
163{
164 omap1_init_common_hw();
165 omap1_init_irq();
166}
167
168static void __init voiceblue_map_io(void)
169{
170 omap1_map_common_io();
171}
172
173#define MACHINE_PANICED 1 162#define MACHINE_PANICED 1
174#define MACHINE_REBOOTING 2 163#define MACHINE_REBOOTING 2
175#define MACHINE_REBOOT 4 164#define MACHINE_REBOOT 4
@@ -302,9 +291,10 @@ static void __init voiceblue_init(void)
302MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") 291MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
303 /* Maintainer: Ladislav Michl <michl@2n.cz> */ 292 /* Maintainer: Ladislav Michl <michl@2n.cz> */
304 .boot_params = 0x10000100, 293 .boot_params = 0x10000100,
305 .map_io = voiceblue_map_io, 294 .map_io = omap15xx_map_io,
295 .init_early = omap1_init_early,
306 .reserve = omap_reserve, 296 .reserve = omap_reserve,
307 .init_irq = voiceblue_init_irq, 297 .init_irq = omap1_init_irq,
308 .init_machine = voiceblue_init, 298 .init_machine = voiceblue_init,
309 .timer = &omap1_timer, 299 .timer = &omap1_timer,
310MACHINE_END 300MACHINE_END
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 36f26c3fa25e..38e1142ba71f 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -21,6 +21,7 @@
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <plat/common.h>
24#include <plat/tc.h> 25#include <plat/tc.h>
25#include <plat/board.h> 26#include <plat/board.h>
26#include <plat/mux.h> 27#include <plat/mux.h>
@@ -291,6 +292,8 @@ static int __init omap1_init_devices(void)
291 if (!cpu_class_is_omap1()) 292 if (!cpu_class_is_omap1())
292 return -ENODEV; 293 return -ENODEV;
293 294
295 omap_sram_init();
296
294 /* please keep these calls, and their implementations above, 297 /* please keep these calls, and their implementations above,
295 * in alphabetical order so they're easier to sort through. 298 * in alphabetical order so they're easier to sort through.
296 */ 299 */
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 870886a29594..fd9eb0984121 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -21,7 +21,6 @@
21#include "clock.h" 21#include "clock.h"
22 22
23extern void omap_check_revision(void); 23extern void omap_check_revision(void);
24extern void omap_sram_init(void);
25 24
26/* 25/*
27 * The machine specific code may provide the extra mapping besides the 26 * The machine specific code may provide the extra mapping besides the
@@ -85,50 +84,45 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
85#endif 84#endif
86 85
87/* 86/*
88 * Maps common IO regions for omap1. This should only get called from 87 * Maps common IO regions for omap1
89 * board specific init.
90 */ 88 */
91void __init omap1_map_common_io(void) 89static void __init omap1_map_common_io(void)
92{ 90{
93 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); 91 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
94 92}
95 /* Normally devicemaps_init() would flush caches and tlb after
96 * mdesc->map_io(), but we must also do it here because of the CPU
97 * revision check below.
98 */
99 local_flush_tlb_all();
100 flush_cache_all();
101
102 /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
103 * IO space mapping must be initialized before we can do that.
104 */
105 omap_check_revision();
106 93
107#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850) 94#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
108 if (cpu_is_omap7xx()) { 95void __init omap7xx_map_io(void)
109 iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc)); 96{
110 } 97 omap1_map_common_io();
98 iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
99}
111#endif 100#endif
101
112#ifdef CONFIG_ARCH_OMAP15XX 102#ifdef CONFIG_ARCH_OMAP15XX
113 if (cpu_is_omap15xx()) { 103void __init omap15xx_map_io(void)
114 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc)); 104{
115 } 105 omap1_map_common_io();
116#endif 106 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
117#if defined(CONFIG_ARCH_OMAP16XX) 107}
118 if (cpu_is_omap16xx()) {
119 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
120 }
121#endif 108#endif
122 109
123 omap_sram_init(); 110#if defined(CONFIG_ARCH_OMAP16XX)
111void __init omap16xx_map_io(void)
112{
113 omap1_map_common_io();
114 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
124} 115}
116#endif
125 117
126/* 118/*
127 * Common low-level hardware init for omap1. This should only get called from 119 * Common low-level hardware init for omap1.
128 * board specific init.
129 */ 120 */
130void __init omap1_init_common_hw(void) 121void omap1_init_early(void)
131{ 122{
123 omap_check_revision();
124 omap_ioremap_init();
125
132 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 126 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
133 * on a Posted Write in the TIPB Bridge". 127 * on a Posted Write in the TIPB Bridge".
134 */ 128 */
@@ -138,7 +132,6 @@ void __init omap1_init_common_hw(void)
138 /* Must init clocks early to assure that timer interrupt works 132 /* Must init clocks early to assure that timer interrupt works
139 */ 133 */
140 omap1_clk_init(); 134 omap1_clk_init();
141
142 omap1_mux_init(); 135 omap1_mux_init();
143} 136}
144 137
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index ab7395d84bc8..91f9abbd3250 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -31,6 +31,7 @@
31static int dsp_use; 31static int dsp_use;
32static struct clk *api_clk; 32static struct clk *api_clk;
33static struct clk *dsp_clk; 33static struct clk *dsp_clk;
34static struct platform_device **omap_mcbsp_devices;
34 35
35static void omap1_mcbsp_request(unsigned int id) 36static void omap1_mcbsp_request(unsigned int id)
36{ 37{
@@ -78,6 +79,17 @@ static struct omap_mcbsp_ops omap1_mcbsp_ops = {
78 .free = omap1_mcbsp_free, 79 .free = omap1_mcbsp_free,
79}; 80};
80 81
82#define OMAP7XX_MCBSP1_BASE 0xfffb1000
83#define OMAP7XX_MCBSP2_BASE 0xfffb1800
84
85#define OMAP1510_MCBSP1_BASE 0xe1011800
86#define OMAP1510_MCBSP2_BASE 0xfffb1000
87#define OMAP1510_MCBSP3_BASE 0xe1017000
88
89#define OMAP1610_MCBSP1_BASE 0xe1011800
90#define OMAP1610_MCBSP2_BASE 0xfffb1000
91#define OMAP1610_MCBSP3_BASE 0xe1017000
92
81#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 93#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
82struct resource omap7xx_mcbsp_res[][6] = { 94struct resource omap7xx_mcbsp_res[][6] = {
83 { 95 {
@@ -369,6 +381,39 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
369#define OMAP16XX_MCBSP_COUNT 0 381#define OMAP16XX_MCBSP_COUNT 0
370#endif 382#endif
371 383
384static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
385 struct omap_mcbsp_platform_data *config, int size)
386{
387 int i;
388
389 omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
390 GFP_KERNEL);
391 if (!omap_mcbsp_devices) {
392 printk(KERN_ERR "Could not register McBSP devices\n");
393 return;
394 }
395
396 for (i = 0; i < size; i++) {
397 struct platform_device *new_mcbsp;
398 int ret;
399
400 new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
401 if (!new_mcbsp)
402 continue;
403 platform_device_add_resources(new_mcbsp, &res[i * res_count],
404 res_count);
405 config[i].reg_size = 2;
406 config[i].reg_step = 2;
407 new_mcbsp->dev.platform_data = &config[i];
408 ret = platform_device_add(new_mcbsp);
409 if (ret) {
410 platform_device_put(new_mcbsp);
411 continue;
412 }
413 omap_mcbsp_devices[i] = new_mcbsp;
414 }
415}
416
372static int __init omap1_mcbsp_init(void) 417static int __init omap1_mcbsp_init(void)
373{ 418{
374 if (!cpu_class_is_omap1()) 419 if (!cpu_class_is_omap1())
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
new file mode 100644
index 000000000000..6e90665a7c47
--- /dev/null
+++ b/arch/arm/mach-omap1/timer.c
@@ -0,0 +1,173 @@
1/**
2 * OMAP1 Dual-Mode Timers - platform device registration
3 *
4 * Contains first level initialization routines which internally
5 * generates timer device information and registers with linux
6 * device model. It also has low level function to chnage the timer
7 * input clock source.
8 *
9 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
10 * Tarun Kanti DebBarma <tarun.kanti@ti.com>
11 * Thara Gopinath <thara@ti.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 *
17 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
18 * kind, whether express or implied; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 */
22
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/err.h>
26#include <linux/slab.h>
27#include <linux/platform_device.h>
28
29#include <mach/irqs.h>
30
31#include <plat/dmtimer.h>
32
33#define OMAP1610_GPTIMER1_BASE 0xfffb1400
34#define OMAP1610_GPTIMER2_BASE 0xfffb1c00
35#define OMAP1610_GPTIMER3_BASE 0xfffb2400
36#define OMAP1610_GPTIMER4_BASE 0xfffb2c00
37#define OMAP1610_GPTIMER5_BASE 0xfffb3400
38#define OMAP1610_GPTIMER6_BASE 0xfffb3c00
39#define OMAP1610_GPTIMER7_BASE 0xfffb7400
40#define OMAP1610_GPTIMER8_BASE 0xfffbd400
41
42#define OMAP1_DM_TIMER_COUNT 8
43
44static int omap1_dm_timer_set_src(struct platform_device *pdev,
45 int source)
46{
47 int n = (pdev->id - 1) << 1;
48 u32 l;
49
50 l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
51 l |= source << n;
52 __raw_writel(l, MOD_CONF_CTRL_1);
53
54 return 0;
55}
56
57
58int __init omap1_dm_timer_init(void)
59{
60 int i;
61 int ret;
62 struct dmtimer_platform_data *pdata;
63 struct platform_device *pdev;
64
65 if (!cpu_is_omap16xx())
66 return 0;
67
68 for (i = 1; i <= OMAP1_DM_TIMER_COUNT; i++) {
69 struct resource res[2];
70 u32 base, irq;
71
72 switch (i) {
73 case 1:
74 base = OMAP1610_GPTIMER1_BASE;
75 irq = INT_1610_GPTIMER1;
76 break;
77 case 2:
78 base = OMAP1610_GPTIMER2_BASE;
79 irq = INT_1610_GPTIMER2;
80 break;
81 case 3:
82 base = OMAP1610_GPTIMER3_BASE;
83 irq = INT_1610_GPTIMER3;
84 break;
85 case 4:
86 base = OMAP1610_GPTIMER4_BASE;
87 irq = INT_1610_GPTIMER4;
88 break;
89 case 5:
90 base = OMAP1610_GPTIMER5_BASE;
91 irq = INT_1610_GPTIMER5;
92 break;
93 case 6:
94 base = OMAP1610_GPTIMER6_BASE;
95 irq = INT_1610_GPTIMER6;
96 break;
97 case 7:
98 base = OMAP1610_GPTIMER7_BASE;
99 irq = INT_1610_GPTIMER7;
100 break;
101 case 8:
102 base = OMAP1610_GPTIMER8_BASE;
103 irq = INT_1610_GPTIMER8;
104 break;
105 default:
106 /*
107 * not supposed to reach here.
108 * this is to remove warning.
109 */
110 return -EINVAL;
111 }
112
113 pdev = platform_device_alloc("omap_timer", i);
114 if (!pdev) {
115 pr_err("%s: Failed to device alloc for dmtimer%d\n",
116 __func__, i);
117 return -ENOMEM;
118 }
119
120 memset(res, 0, 2 * sizeof(struct resource));
121 res[0].start = base;
122 res[0].end = base + 0x46;
123 res[0].flags = IORESOURCE_MEM;
124 res[1].start = irq;
125 res[1].end = irq;
126 res[1].flags = IORESOURCE_IRQ;
127 ret = platform_device_add_resources(pdev, res,
128 ARRAY_SIZE(res));
129 if (ret) {
130 dev_err(&pdev->dev, "%s: Failed to add resources.\n",
131 __func__);
132 goto err_free_pdev;
133 }
134
135 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
136 if (!pdata) {
137 dev_err(&pdev->dev, "%s: Failed to allocate pdata.\n",
138 __func__);
139 ret = -ENOMEM;
140 goto err_free_pdata;
141 }
142
143 pdata->set_timer_src = omap1_dm_timer_set_src;
144 pdata->needs_manual_reset = 1;
145
146 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
147 if (ret) {
148 dev_err(&pdev->dev, "%s: Failed to add platform data.\n",
149 __func__);
150 goto err_free_pdata;
151 }
152
153 ret = platform_device_add(pdev);
154 if (ret) {
155 dev_err(&pdev->dev, "%s: Failed to add platform device.\n",
156 __func__);
157 goto err_free_pdata;
158 }
159
160 dev_dbg(&pdev->dev, " Registered.\n");
161 }
162
163 return 0;
164
165err_free_pdata:
166 kfree(pdata);
167
168err_free_pdev:
169 platform_device_unregister(pdev);
170
171 return ret;
172}
173arch_initcall(omap1_dm_timer_init);
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 57b66d590c52..e0a318df95bc 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -106,9 +106,13 @@ comment "OMAP Board Type"
106 depends on ARCH_OMAP2PLUS 106 depends on ARCH_OMAP2PLUS
107 107
108config MACH_OMAP_GENERIC 108config MACH_OMAP_GENERIC
109 bool "Generic OMAP board" 109 bool "Generic OMAP2+ board"
110 depends on ARCH_OMAP2 110 depends on ARCH_OMAP2PLUS
111 select USE_OF
111 default y 112 default y
113 help
114 Support for generic TI OMAP2+ boards using Flattened Device Tree.
115 More information at Documentation/devicetree
112 116
113config MACH_OMAP2_TUSB6010 117config MACH_OMAP2_TUSB6010
114 bool 118 bool
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index f34336560437..512978586b2b 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -89,14 +89,13 @@ obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \
89 vp44xx_data.o 89 vp44xx_data.o
90 90
91# OMAP voltage domains 91# OMAP voltage domains
92ifeq ($(CONFIG_PM),y) 92voltagedomain-common := voltage.o vc.o vp.o
93voltagedomain-common := voltage.o 93obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common) \
94obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common) 94 voltagedomains2xxx_data.o
95obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common) \ 95obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common) \
96 voltagedomains3xxx_data.o 96 voltagedomains3xxx_data.o
97obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) \ 97obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) \
98 voltagedomains44xx_data.o 98 voltagedomains44xx_data.o
99endif
100 99
101# OMAP powerdomain framework 100# OMAP powerdomain framework
102powerdomain-common += powerdomain.o powerdomain-common.o 101powerdomain-common += powerdomain.o powerdomain-common.o
@@ -116,9 +115,12 @@ obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) \
116obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \ 115obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \
117 clockdomain2xxx_3xxx.o \ 116 clockdomain2xxx_3xxx.o \
118 clockdomains2xxx_3xxx_data.o 117 clockdomains2xxx_3xxx_data.o
118obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
119obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
119obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ 120obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \
120 clockdomain2xxx_3xxx.o \ 121 clockdomain2xxx_3xxx.o \
121 clockdomains2xxx_3xxx_data.o 122 clockdomains2xxx_3xxx_data.o \
123 clockdomains3xxx_data.o
122obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ 124obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \
123 clockdomain44xx.o \ 125 clockdomain44xx.o \
124 clockdomains44xx_data.o 126 clockdomains44xx_data.o
@@ -185,78 +187,66 @@ endif
185# Specific board support 187# Specific board support
186obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 188obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
187obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 189obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
188obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \ 190obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
189 hsmmc.o
190obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 191obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
191obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ 192obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
192 hsmmc.o 193obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
193obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o \ 194obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
194 hsmmc.o 195obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
195obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \ 196obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
196 board-flash.o \ 197obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
197 hsmmc.o 198obj-$(CONFIG_MACH_OVERO) += board-overo.o
198obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o \ 199obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
199 hsmmc.o 200obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
200obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o \ 201obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o
201 hsmmc.o
202obj-$(CONFIG_MACH_OVERO) += board-overo.o \
203 hsmmc.o
204obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o \
205 hsmmc.o
206obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \
207 hsmmc.o
208obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o \
209 hsmmc.o \
210 board-flash.o
211obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o 202obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
212obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \ 203obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \
213 sdram-nokia.o \ 204 sdram-nokia.o
214 hsmmc.o
215obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ 205obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
216 sdram-nokia.o \ 206 sdram-nokia.o \
217 board-rx51-peripherals.o \ 207 board-rx51-peripherals.o \
218 board-rx51-video.o \ 208 board-rx51-video.o
219 hsmmc.o
220obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom.o \ 209obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom.o \
221 board-zoom-peripherals.o \ 210 board-zoom-peripherals.o \
222 board-zoom-display.o \ 211 board-zoom-display.o \
223 board-flash.o \
224 hsmmc.o \
225 board-zoom-debugboard.o 212 board-zoom-debugboard.o
226obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom.o \ 213obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom.o \
227 board-zoom-peripherals.o \ 214 board-zoom-peripherals.o \
228 board-zoom-display.o \ 215 board-zoom-display.o \
229 board-flash.o \
230 hsmmc.o \
231 board-zoom-debugboard.o 216 board-zoom-debugboard.o
232obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o \ 217obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o \
233 board-zoom-peripherals.o \ 218 board-zoom-peripherals.o \
234 board-zoom-display.o \ 219 board-zoom-display.o
235 board-flash.o \ 220obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o
236 hsmmc.o
237obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
238 hsmmc.o
239obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 221obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o
240obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ 222obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o
241 hsmmc.o 223obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o
242obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
243 hsmmc.o
244obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ 224obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \
245 hsmmc.o \
246 omap_phy_internal.o 225 omap_phy_internal.o
247obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \ 226obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \
248 hsmmc.o \ 227 omap_phy_internal.o
228
229obj-$(CONFIG_MACH_PCM049) += board-omap4pcm049.o \
249 omap_phy_internal.o 230 omap_phy_internal.o
250 231
251obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o \ 232obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o \
252 omap_phy_internal.o \ 233 omap_phy_internal.o
253 234
254obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 235obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
255 236
256obj-$(CONFIG_MACH_SBC3530) += board-omap3stalker.o \ 237obj-$(CONFIG_MACH_SBC3530) += board-omap3stalker.o
257 hsmmc.o
258obj-$(CONFIG_MACH_TI8168EVM) += board-ti8168evm.o 238obj-$(CONFIG_MACH_TI8168EVM) += board-ti8168evm.o
239
259# Platform specific device init code 240# Platform specific device init code
241
242omap-flash-$(CONFIG_MTD_NAND_OMAP2) := board-flash.o
243omap-flash-$(CONFIG_MTD_ONENAND_OMAP2) := board-flash.o
244obj-y += $(omap-flash-y) $(omap-flash-m)
245
246omap-hsmmc-$(CONFIG_MMC_OMAP_HS) := hsmmc.o
247obj-y += $(omap-hsmmc-m) $(omap-hsmmc-y)
248
249
260usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o 250usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o
261obj-y += $(usbfs-m) $(usbfs-y) 251obj-y += $(usbfs-m) $(usbfs-y)
262obj-y += usb-musb.o 252obj-y += usb-musb.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 2028464cf5b9..d934169d6553 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -141,12 +141,6 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = {
141 {OMAP_TAG_LCD, &sdp2430_lcd_config}, 141 {OMAP_TAG_LCD, &sdp2430_lcd_config},
142}; 142};
143 143
144static void __init omap_2430sdp_init_early(void)
145{
146 omap2_init_common_infrastructure();
147 omap2_init_common_devices(NULL, NULL);
148}
149
150static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = { 144static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
151 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 145 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
152}; 146};
@@ -193,7 +187,8 @@ static int __init omap2430_i2c_init(void)
193{ 187{
194 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 188 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
195 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 189 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
196 omap2_pmic_init("twl4030", &sdp2430_twldata); 190 omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ,
191 &sdp2430_twldata);
197 return 0; 192 return 0;
198} 193}
199 194
@@ -235,6 +230,7 @@ static void __init omap_2430sdp_init(void)
235 230
236 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); 231 platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
237 omap_serial_init(); 232 omap_serial_init();
233 omap_sdrc_init(NULL, NULL);
238 omap2_hsmmc_init(mmc); 234 omap2_hsmmc_init(mmc);
239 omap2_usbfs_init(&sdp2430_usb_config); 235 omap2_usbfs_init(&sdp2430_usb_config);
240 236
@@ -248,18 +244,12 @@ static void __init omap_2430sdp_init(void)
248 "Secondary LCD backlight"); 244 "Secondary LCD backlight");
249} 245}
250 246
251static void __init omap_2430sdp_map_io(void)
252{
253 omap2_set_globals_243x();
254 omap243x_map_common_io();
255}
256
257MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") 247MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
258 /* Maintainer: Syed Khasim - Texas Instruments Inc */ 248 /* Maintainer: Syed Khasim - Texas Instruments Inc */
259 .boot_params = 0x80000100, 249 .boot_params = 0x80000100,
260 .reserve = omap_reserve, 250 .reserve = omap_reserve,
261 .map_io = omap_2430sdp_map_io, 251 .map_io = omap243x_map_io,
262 .init_early = omap_2430sdp_init_early, 252 .init_early = omap2430_init_early,
263 .init_irq = omap2_init_irq, 253 .init_irq = omap2_init_irq,
264 .init_machine = omap_2430sdp_init, 254 .init_machine = omap_2430sdp_init,
265 .timer = &omap2_timer, 255 .timer = &omap2_timer,
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index bd600cfb7f80..9bb48eaa4381 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -225,12 +225,6 @@ static struct omap_dss_board_info sdp3430_dss_data = {
225static struct omap_board_config_kernel sdp3430_config[] __initdata = { 225static struct omap_board_config_kernel sdp3430_config[] __initdata = {
226}; 226};
227 227
228static void __init omap_3430sdp_init_early(void)
229{
230 omap2_init_common_infrastructure();
231 omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
232}
233
234static struct omap2_hsmmc_info mmc[] = { 228static struct omap2_hsmmc_info mmc[] = {
235 { 229 {
236 .mmc = 1, 230 .mmc = 1,
@@ -719,6 +713,7 @@ static void __init omap_3430sdp_init(void)
719 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1; 713 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1;
720 omap_ads7846_init(1, gpio_pendown, 310, NULL); 714 omap_ads7846_init(1, gpio_pendown, 310, NULL);
721 board_serial_init(); 715 board_serial_init();
716 omap_sdrc_init(hyb18m512160af6_sdrc_params, NULL);
722 usb_musb_init(NULL); 717 usb_musb_init(NULL);
723 board_smc91x_init(); 718 board_smc91x_init();
724 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 719 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
@@ -732,7 +727,7 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
732 .boot_params = 0x80000100, 727 .boot_params = 0x80000100,
733 .reserve = omap_reserve, 728 .reserve = omap_reserve,
734 .map_io = omap3_map_io, 729 .map_io = omap3_map_io,
735 .init_early = omap_3430sdp_init_early, 730 .init_early = omap3430_init_early,
736 .init_irq = omap3_init_irq, 731 .init_irq = omap3_init_irq,
737 .init_machine = omap_3430sdp_init, 732 .init_machine = omap_3430sdp_init,
738 .timer = &omap3_timer, 733 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index e4f37b57a0c4..94febc85d805 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -70,13 +70,6 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
70static struct omap_board_config_kernel sdp_config[] __initdata = { 70static struct omap_board_config_kernel sdp_config[] __initdata = {
71}; 71};
72 72
73static void __init omap_sdp_init_early(void)
74{
75 omap2_init_common_infrastructure();
76 omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
77 h8mbx00u0mer0em_sdrc_params);
78}
79
80#ifdef CONFIG_OMAP_MUX 73#ifdef CONFIG_OMAP_MUX
81static struct omap_board_mux board_mux[] __initdata = { 74static struct omap_board_mux board_mux[] __initdata = {
82 { .reg_offset = OMAP_MUX_TERMINATOR }, 75 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -207,6 +200,8 @@ static void __init omap_sdp_init(void)
207 omap_board_config = sdp_config; 200 omap_board_config = sdp_config;
208 omap_board_config_size = ARRAY_SIZE(sdp_config); 201 omap_board_config_size = ARRAY_SIZE(sdp_config);
209 zoom_peripherals_init(); 202 zoom_peripherals_init();
203 omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
204 h8mbx00u0mer0em_sdrc_params);
210 zoom_display_init(); 205 zoom_display_init();
211 board_smc91x_init(); 206 board_smc91x_init();
212 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); 207 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
@@ -218,7 +213,7 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
218 .boot_params = 0x80000100, 213 .boot_params = 0x80000100,
219 .reserve = omap_reserve, 214 .reserve = omap_reserve,
220 .map_io = omap3_map_io, 215 .map_io = omap3_map_io,
221 .init_early = omap_sdp_init_early, 216 .init_early = omap3630_init_early,
222 .init_irq = omap3_init_irq, 217 .init_irq = omap3_init_irq,
223 .init_machine = omap_sdp_init, 218 .init_machine = omap_sdp_init,
224 .timer = &omap3_timer, 219 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index c7cef44c75d4..a97c29a73edd 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -129,7 +129,7 @@ static const int sdp4430_keymap[] = {
129 KEY(7, 6, KEY_OK), 129 KEY(7, 6, KEY_OK),
130 KEY(7, 7, KEY_DOWN), 130 KEY(7, 7, KEY_DOWN),
131}; 131};
132static struct omap_device_pad keypad_pads[] __initdata = { 132static struct omap_device_pad keypad_pads[] = {
133 { .name = "kpd_col1.kpd_col1", 133 { .name = "kpd_col1.kpd_col1",
134 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1, 134 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
135 }, 135 },
@@ -389,12 +389,6 @@ static struct omap_board_config_kernel sdp4430_config[] __initdata = {
389 { OMAP_TAG_LCD, &sdp4430_lcd_config }, 389 { OMAP_TAG_LCD, &sdp4430_lcd_config },
390}; 390};
391 391
392static void __init omap_4430sdp_init_early(void)
393{
394 omap2_init_common_infrastructure();
395 omap2_init_common_devices(NULL, NULL);
396}
397
398static struct omap_musb_board_data musb_board_data = { 392static struct omap_musb_board_data musb_board_data = {
399 .interface_type = MUSB_INTERFACE_UTMI, 393 .interface_type = MUSB_INTERFACE_UTMI,
400 .mode = MUSB_OTG, 394 .mode = MUSB_OTG,
@@ -809,6 +803,7 @@ static void __init omap_4430sdp_init(void)
809 omap_sfh7741prox_init(); 803 omap_sfh7741prox_init();
810 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 804 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
811 board_serial_init(); 805 board_serial_init();
806 omap_sdrc_init(NULL, NULL);
812 omap4_sdp4430_wifi_init(); 807 omap4_sdp4430_wifi_init();
813 omap4_twl6030_hsmmc_init(mmc); 808 omap4_twl6030_hsmmc_init(mmc);
814 809
@@ -830,18 +825,12 @@ static void __init omap_4430sdp_init(void)
830 omap_4430sdp_display_init(); 825 omap_4430sdp_display_init();
831} 826}
832 827
833static void __init omap_4430sdp_map_io(void)
834{
835 omap2_set_globals_443x();
836 omap44xx_map_common_io();
837}
838
839MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") 828MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
840 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ 829 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
841 .boot_params = 0x80000100, 830 .boot_params = 0x80000100,
842 .reserve = omap_reserve, 831 .reserve = omap_reserve,
843 .map_io = omap_4430sdp_map_io, 832 .map_io = omap4_map_io,
844 .init_early = omap_4430sdp_init_early, 833 .init_early = omap4430_init_early,
845 .init_irq = gic_init_irq, 834 .init_irq = gic_init_irq,
846 .init_machine = omap_4430sdp_init, 835 .init_machine = omap_4430sdp_init,
847 .timer = &omap4_timer, 836 .timer = &omap4_timer,
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 933e9353cb37..9e1b2c248328 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -47,12 +47,6 @@ static struct omap_board_mux board_mux[] __initdata = {
47}; 47};
48#endif 48#endif
49 49
50static void __init am3517_crane_init_early(void)
51{
52 omap2_init_common_infrastructure();
53 omap2_init_common_devices(NULL, NULL);
54}
55
56static struct usbhs_omap_board_data usbhs_bdata __initdata = { 50static struct usbhs_omap_board_data usbhs_bdata __initdata = {
57 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 51 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
58 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 52 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -70,6 +64,7 @@ static void __init am3517_crane_init(void)
70 64
71 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 65 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
72 omap_serial_init(); 66 omap_serial_init();
67 omap_sdrc_init(NULL, NULL);
73 68
74 omap_board_config = am3517_crane_config; 69 omap_board_config = am3517_crane_config;
75 omap_board_config_size = ARRAY_SIZE(am3517_crane_config); 70 omap_board_config_size = ARRAY_SIZE(am3517_crane_config);
@@ -101,7 +96,7 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
101 .boot_params = 0x80000100, 96 .boot_params = 0x80000100,
102 .reserve = omap_reserve, 97 .reserve = omap_reserve,
103 .map_io = omap3_map_io, 98 .map_io = omap3_map_io,
104 .init_early = am3517_crane_init_early, 99 .init_early = am35xx_init_early,
105 .init_irq = omap3_init_irq, 100 .init_irq = omap3_init_irq,
106 .init_machine = am3517_crane_init, 101 .init_machine = am3517_crane_init,
107 .timer = &omap3_timer, 102 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index f3006c304150..7d842940c252 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -362,11 +362,6 @@ static struct omap_dss_board_info am3517_evm_dss_data = {
362/* 362/*
363 * Board initialization 363 * Board initialization
364 */ 364 */
365static void __init am3517_evm_init_early(void)
366{
367 omap2_init_common_infrastructure();
368 omap2_init_common_devices(NULL, NULL);
369}
370 365
371static struct omap_musb_board_data musb_board_data = { 366static struct omap_musb_board_data musb_board_data = {
372 .interface_type = MUSB_INTERFACE_ULPI, 367 .interface_type = MUSB_INTERFACE_ULPI,
@@ -469,6 +464,7 @@ static void __init am3517_evm_init(void)
469 am3517_evm_i2c_init(); 464 am3517_evm_i2c_init();
470 omap_display_init(&am3517_evm_dss_data); 465 omap_display_init(&am3517_evm_dss_data);
471 omap_serial_init(); 466 omap_serial_init();
467 omap_sdrc_init(NULL, NULL);
472 468
473 /* Configure GPIO for EHCI port */ 469 /* Configure GPIO for EHCI port */
474 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); 470 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
@@ -493,7 +489,7 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
493 .boot_params = 0x80000100, 489 .boot_params = 0x80000100,
494 .reserve = omap_reserve, 490 .reserve = omap_reserve,
495 .map_io = omap3_map_io, 491 .map_io = omap3_map_io,
496 .init_early = am3517_evm_init_early, 492 .init_early = am35xx_init_early,
497 .init_irq = omap3_init_irq, 493 .init_irq = omap3_init_irq,
498 .init_machine = am3517_evm_init, 494 .init_machine = am3517_evm_init,
499 .timer = &omap3_timer, 495 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 70211703ff9f..852843638fa9 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -273,12 +273,6 @@ static struct omap_board_config_kernel apollon_config[] __initdata = {
273 { OMAP_TAG_LCD, &apollon_lcd_config }, 273 { OMAP_TAG_LCD, &apollon_lcd_config },
274}; 274};
275 275
276static void __init omap_apollon_init_early(void)
277{
278 omap2_init_common_infrastructure();
279 omap2_init_common_devices(NULL, NULL);
280}
281
282static struct gpio apollon_gpio_leds[] __initdata = { 276static struct gpio apollon_gpio_leds[] __initdata = {
283 { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */ 277 { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */
284 { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6 */ 278 { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6 */
@@ -340,20 +334,15 @@ static void __init omap_apollon_init(void)
340 */ 334 */
341 platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices)); 335 platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices));
342 omap_serial_init(); 336 omap_serial_init();
343} 337 omap_sdrc_init(NULL, NULL);
344
345static void __init omap_apollon_map_io(void)
346{
347 omap2_set_globals_242x();
348 omap242x_map_common_io();
349} 338}
350 339
351MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon") 340MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
352 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ 341 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
353 .boot_params = 0x80000100, 342 .boot_params = 0x80000100,
354 .reserve = omap_reserve, 343 .reserve = omap_reserve,
355 .map_io = omap_apollon_map_io, 344 .map_io = omap242x_map_io,
356 .init_early = omap_apollon_init_early, 345 .init_early = omap2420_init_early,
357 .init_irq = omap2_init_irq, 346 .init_irq = omap2_init_irq,
358 .init_machine = omap_apollon_init, 347 .init_machine = omap_apollon_init,
359 .timer = &omap2_timer, 348 .timer = &omap2_timer,
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 3af8aab435b5..e15d39bffe79 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -471,13 +471,6 @@ static void __init cm_t35_init_i2c(void)
471 omap3_pmic_init("tps65930", &cm_t35_twldata); 471 omap3_pmic_init("tps65930", &cm_t35_twldata);
472} 472}
473 473
474static void __init cm_t35_init_early(void)
475{
476 omap2_init_common_infrastructure();
477 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
478 mt46h32m32lf6_sdrc_params);
479}
480
481#ifdef CONFIG_OMAP_MUX 474#ifdef CONFIG_OMAP_MUX
482static struct omap_board_mux board_mux[] __initdata = { 475static struct omap_board_mux board_mux[] __initdata = {
483 /* nCS and IRQ for CM-T35 ethernet */ 476 /* nCS and IRQ for CM-T35 ethernet */
@@ -610,6 +603,8 @@ static void __init cm_t3x_common_init(void)
610 omap_board_config_size = ARRAY_SIZE(cm_t35_config); 603 omap_board_config_size = ARRAY_SIZE(cm_t35_config);
611 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 604 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
612 omap_serial_init(); 605 omap_serial_init();
606 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
607 mt46h32m32lf6_sdrc_params);
613 cm_t35_init_i2c(); 608 cm_t35_init_i2c();
614 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL); 609 omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL);
615 cm_t35_init_ethernet(); 610 cm_t35_init_ethernet();
@@ -637,7 +632,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
637 .boot_params = 0x80000100, 632 .boot_params = 0x80000100,
638 .reserve = omap_reserve, 633 .reserve = omap_reserve,
639 .map_io = omap3_map_io, 634 .map_io = omap3_map_io,
640 .init_early = cm_t35_init_early, 635 .init_early = omap35xx_init_early,
641 .init_irq = omap3_init_irq, 636 .init_irq = omap3_init_irq,
642 .init_machine = cm_t35_init, 637 .init_machine = cm_t35_init,
643 .timer = &omap3_timer, 638 .timer = &omap3_timer,
@@ -647,7 +642,7 @@ MACHINE_START(CM_T3730, "Compulab CM-T3730")
647 .boot_params = 0x80000100, 642 .boot_params = 0x80000100,
648 .reserve = omap_reserve, 643 .reserve = omap_reserve,
649 .map_io = omap3_map_io, 644 .map_io = omap3_map_io,
650 .init_early = cm_t35_init_early, 645 .init_early = omap3630_init_early,
651 .init_irq = omap3_init_irq, 646 .init_irq = omap3_init_irq,
652 .init_machine = cm_t3730_init, 647 .init_machine = cm_t3730_init,
653 .timer = &omap3_timer, 648 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 05c72f4c1b57..867bf671719c 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -251,12 +251,6 @@ static inline void cm_t3517_init_nand(void) {}
251static struct omap_board_config_kernel cm_t3517_config[] __initdata = { 251static struct omap_board_config_kernel cm_t3517_config[] __initdata = {
252}; 252};
253 253
254static void __init cm_t3517_init_early(void)
255{
256 omap2_init_common_infrastructure();
257 omap2_init_common_devices(NULL, NULL);
258}
259
260#ifdef CONFIG_OMAP_MUX 254#ifdef CONFIG_OMAP_MUX
261static struct omap_board_mux board_mux[] __initdata = { 255static struct omap_board_mux board_mux[] __initdata = {
262 /* GPIO186 - Green LED */ 256 /* GPIO186 - Green LED */
@@ -289,6 +283,7 @@ static void __init cm_t3517_init(void)
289{ 283{
290 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 284 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
291 omap_serial_init(); 285 omap_serial_init();
286 omap_sdrc_init(NULL, NULL);
292 omap_board_config = cm_t3517_config; 287 omap_board_config = cm_t3517_config;
293 omap_board_config_size = ARRAY_SIZE(cm_t3517_config); 288 omap_board_config_size = ARRAY_SIZE(cm_t3517_config);
294 cm_t3517_init_leds(); 289 cm_t3517_init_leds();
@@ -302,7 +297,7 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
302 .boot_params = 0x80000100, 297 .boot_params = 0x80000100,
303 .reserve = omap_reserve, 298 .reserve = omap_reserve,
304 .map_io = omap3_map_io, 299 .map_io = omap3_map_io,
305 .init_early = cm_t3517_init_early, 300 .init_early = am35xx_init_early,
306 .init_irq = omap3_init_irq, 301 .init_irq = omap3_init_irq,
307 .init_machine = cm_t3517_init, 302 .init_machine = cm_t3517_init,
308 .timer = &omap3_timer, 303 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index b6002ec31c6a..059b74dd9289 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -397,19 +397,6 @@ static struct platform_device keys_gpio = {
397 }, 397 },
398}; 398};
399 399
400
401static void __init devkit8000_init_early(void)
402{
403 omap2_init_common_infrastructure();
404 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
405 mt46h32m32lf6_sdrc_params);
406}
407
408static void __init devkit8000_init_irq(void)
409{
410 omap3_init_irq();
411}
412
413#define OMAP_DM9000_BASE 0x2c000000 400#define OMAP_DM9000_BASE 0x2c000000
414 401
415static struct resource omap_dm9000_resources[] = { 402static struct resource omap_dm9000_resources[] = {
@@ -645,6 +632,8 @@ static void __init devkit8000_init(void)
645{ 632{
646 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 633 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
647 omap_serial_init(); 634 omap_serial_init();
635 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
636 mt46h32m32lf6_sdrc_params);
648 637
649 omap_dm9000_init(); 638 omap_dm9000_init();
650 639
@@ -670,8 +659,8 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
670 .boot_params = 0x80000100, 659 .boot_params = 0x80000100,
671 .reserve = omap_reserve, 660 .reserve = omap_reserve,
672 .map_io = omap3_map_io, 661 .map_io = omap3_map_io,
673 .init_early = devkit8000_init_early, 662 .init_early = omap35xx_init_early,
674 .init_irq = devkit8000_init_irq, 663 .init_irq = omap3_init_irq,
675 .init_machine = devkit8000_init, 664 .init_machine = devkit8000_init,
676 .timer = &omap3_secure_timer, 665 .timer = &omap3_secure_timer,
677MACHINE_END 666MACHINE_END
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index aa1b0cbe19d2..30a6f527510c 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -148,11 +148,6 @@ __init board_nand_init(struct mtd_partition *nand_parts,
148 board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs; 148 board_nand_data.gpmc_irq = OMAP_GPMC_IRQ_BASE + cs;
149 gpmc_nand_init(&board_nand_data); 149 gpmc_nand_init(&board_nand_data);
150} 150}
151#else
152void
153__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, int nand_type)
154{
155}
156#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 151#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
157 152
158/** 153/**
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index c240a3f8d163..d25503a98417 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -24,7 +24,26 @@ struct flash_partitions {
24 int nr_parts; 24 int nr_parts;
25}; 25};
26 26
27#if defined(CONFIG_MTD_NAND_OMAP2) || \
28 defined(CONFIG_MTD_NAND_OMAP2_MODULE) || \
29 defined(CONFIG_MTD_ONENAND_OMAP2) || \
30 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
27extern void board_flash_init(struct flash_partitions [], 31extern void board_flash_init(struct flash_partitions [],
28 char chip_sel[][GPMC_CS_NUM], int nand_type); 32 char chip_sel[][GPMC_CS_NUM], int nand_type);
33#else
34static inline void board_flash_init(struct flash_partitions part[],
35 char chip_sel[][GPMC_CS_NUM], int nand_type)
36{
37}
38#endif
39
40#if defined(CONFIG_MTD_NAND_OMAP2) || \
41 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
29extern void board_nand_init(struct mtd_partition *nand_parts, 42extern void board_nand_init(struct mtd_partition *nand_parts,
30 u8 nr_parts, u8 cs, int nand_type); 43 u8 nr_parts, u8 cs, int nand_type);
44#else
45static inline void board_nand_init(struct mtd_partition *nand_parts,
46 u8 nr_parts, u8 cs, int nand_type)
47{
48}
49#endif
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 54db41a84a9b..d9ccb9d98e15 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -1,76 +1,154 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/board-generic.c
3 *
4 * Copyright (C) 2005 Nokia Corporation 2 * Copyright (C) 2005 Nokia Corporation
5 * Author: Paul Mundt <paul.mundt@nokia.com> 3 * Author: Paul Mundt <paul.mundt@nokia.com>
6 * 4 *
7 * Modified from mach-omap/omap1/board-generic.c 5 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 * 6 *
9 * Code for generic OMAP2 board. Should work on many OMAP2 systems where 7 * Modified from the original mach-omap/omap2/board-generic.c did by Paul
10 * the bootloader passes the board-specific data to the kernel. 8 * to support the OMAP2+ device tree boards with an unique board file.
11 * Do not put any board specific code to this file; create a new machine
12 * type if you need custom low-level initializations.
13 * 9 *
14 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
17 */ 13 */
18 14
19#include <linux/kernel.h> 15#include <linux/io.h>
20#include <linux/init.h> 16#include <linux/of_platform.h>
21#include <linux/device.h> 17#include <linux/irqdomain.h>
18#include <linux/i2c/twl.h>
22 19
23#include <mach/hardware.h> 20#include <mach/hardware.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27 22
28#include <mach/gpio.h>
29#include <plat/usb.h>
30#include <plat/board.h> 23#include <plat/board.h>
31#include <plat/common.h> 24#include <plat/common.h>
25#include <mach/omap4-common.h>
26#include "common-board-devices.h"
27
28/*
29 * XXX: Still needed to boot until the i2c & twl driver is adapted to
30 * device-tree
31 */
32static struct twl4030_platform_data sdp4430_twldata = {
33 .irq_base = TWL6030_IRQ_BASE,
34 .irq_end = TWL6030_IRQ_END,
35};
32 36
33static struct omap_board_config_kernel generic_config[] = { 37static void __init omap4_i2c_init(void)
38{
39 omap4_pmic_init("twl6030", &sdp4430_twldata);
40}
41
42static struct twl4030_platform_data beagle_twldata = {
43 .irq_base = TWL4030_IRQ_BASE,
44 .irq_end = TWL4030_IRQ_END,
34}; 45};
35 46
36static void __init omap_generic_init_early(void) 47static void __init omap3_i2c_init(void)
37{ 48{
38 omap2_init_common_infrastructure(); 49 omap3_pmic_init("twl4030", &beagle_twldata);
39 omap2_init_common_devices(NULL, NULL);
40} 50}
41 51
52static struct of_device_id omap_dt_match_table[] __initdata = {
53 { .compatible = "simple-bus", },
54 { .compatible = "ti,omap-infra", },
55 { }
56};
57
58static struct of_device_id intc_match[] __initdata = {
59 { .compatible = "ti,omap3-intc", },
60 { .compatible = "arm,cortex-a9-gic", },
61 { }
62};
63
42static void __init omap_generic_init(void) 64static void __init omap_generic_init(void)
43{ 65{
66 struct device_node *node = of_find_matching_node(NULL, intc_match);
67 if (node)
68 irq_domain_add_simple(node, 0);
69
44 omap_serial_init(); 70 omap_serial_init();
45 omap_board_config = generic_config; 71 omap_sdrc_init(NULL, NULL);
46 omap_board_config_size = ARRAY_SIZE(generic_config); 72
73 of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
47} 74}
48 75
49static void __init omap_generic_map_io(void) 76static void __init omap4_init(void)
50{ 77{
51 if (cpu_is_omap242x()) { 78 omap4_i2c_init();
52 omap2_set_globals_242x(); 79 omap_generic_init();
53 omap242x_map_common_io();
54 } else if (cpu_is_omap243x()) {
55 omap2_set_globals_243x();
56 omap243x_map_common_io();
57 } else if (cpu_is_omap34xx()) {
58 omap2_set_globals_3xxx();
59 omap34xx_map_common_io();
60 } else if (cpu_is_omap44xx()) {
61 omap2_set_globals_443x();
62 omap44xx_map_common_io();
63 }
64} 80}
65 81
66/* XXX This machine entry name should be updated */ 82static void __init omap3_init(void)
67MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 83{
68 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 84 omap3_i2c_init();
69 .boot_params = 0x80000100, 85 omap_generic_init();
86}
87
88#if defined(CONFIG_SOC_OMAP2420)
89static const char *omap242x_boards_compat[] __initdata = {
90 "ti,omap2420",
91 NULL,
92};
93
94DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
70 .reserve = omap_reserve, 95 .reserve = omap_reserve,
71 .map_io = omap_generic_map_io, 96 .map_io = omap242x_map_io,
72 .init_early = omap_generic_init_early, 97 .init_early = omap2420_init_early,
73 .init_irq = omap2_init_irq, 98 .init_irq = omap2_init_irq,
74 .init_machine = omap_generic_init, 99 .init_machine = omap_generic_init,
75 .timer = &omap2_timer, 100 .timer = &omap2_timer,
101 .dt_compat = omap242x_boards_compat,
102MACHINE_END
103#endif
104
105#if defined(CONFIG_SOC_OMAP2430)
106static const char *omap243x_boards_compat[] __initdata = {
107 "ti,omap2430",
108 NULL,
109};
110
111DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
112 .reserve = omap_reserve,
113 .map_io = omap243x_map_io,
114 .init_early = omap2430_init_early,
115 .init_irq = omap2_init_irq,
116 .init_machine = omap_generic_init,
117 .timer = &omap2_timer,
118 .dt_compat = omap243x_boards_compat,
119MACHINE_END
120#endif
121
122#if defined(CONFIG_ARCH_OMAP3)
123static const char *omap3_boards_compat[] __initdata = {
124 "ti,omap3",
125 NULL,
126};
127
128DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
129 .reserve = omap_reserve,
130 .map_io = omap3_map_io,
131 .init_early = omap3430_init_early,
132 .init_irq = omap3_init_irq,
133 .init_machine = omap3_init,
134 .timer = &omap3_timer,
135 .dt_compat = omap3_boards_compat,
136MACHINE_END
137#endif
138
139#if defined(CONFIG_ARCH_OMAP4)
140static const char *omap4_boards_compat[] __initdata = {
141 "ti,omap4",
142 NULL,
143};
144
145DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
146 .reserve = omap_reserve,
147 .map_io = omap4_map_io,
148 .init_early = omap4430_init_early,
149 .init_irq = gic_init_irq,
150 .init_machine = omap4_init,
151 .timer = &omap4_timer,
152 .dt_compat = omap4_boards_compat,
76MACHINE_END 153MACHINE_END
154#endif
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 45de2b319ec9..8486142dcae7 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -290,17 +290,6 @@ static struct omap_board_config_kernel h4_config[] __initdata = {
290 { OMAP_TAG_LCD, &h4_lcd_config }, 290 { OMAP_TAG_LCD, &h4_lcd_config },
291}; 291};
292 292
293static void __init omap_h4_init_early(void)
294{
295 omap2_init_common_infrastructure();
296 omap2_init_common_devices(NULL, NULL);
297}
298
299static void __init omap_h4_init_irq(void)
300{
301 omap2_init_irq();
302}
303
304static struct at24_platform_data m24c01 = { 293static struct at24_platform_data m24c01 = {
305 .byte_len = SZ_1K / 8, 294 .byte_len = SZ_1K / 8,
306 .page_size = 16, 295 .page_size = 16,
@@ -371,22 +360,17 @@ static void __init omap_h4_init(void)
371 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices)); 360 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
372 omap2_usbfs_init(&h4_usb_config); 361 omap2_usbfs_init(&h4_usb_config);
373 omap_serial_init(); 362 omap_serial_init();
363 omap_sdrc_init(NULL, NULL);
374 h4_init_flash(); 364 h4_init_flash();
375} 365}
376 366
377static void __init omap_h4_map_io(void)
378{
379 omap2_set_globals_242x();
380 omap242x_map_common_io();
381}
382
383MACHINE_START(OMAP_H4, "OMAP2420 H4 board") 367MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
384 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 368 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
385 .boot_params = 0x80000100, 369 .boot_params = 0x80000100,
386 .reserve = omap_reserve, 370 .reserve = omap_reserve,
387 .map_io = omap_h4_map_io, 371 .map_io = omap242x_map_io,
388 .init_early = omap_h4_init_early, 372 .init_early = omap2420_init_early,
389 .init_irq = omap_h4_init_irq, 373 .init_irq = omap2_init_irq,
390 .init_machine = omap_h4_init, 374 .init_machine = omap_h4_init,
391 .timer = &omap2_timer, 375 .timer = &omap2_timer,
392MACHINE_END 376MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 35be778caf1b..7b66338e451b 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -491,13 +491,6 @@ static struct platform_device *igep_devices[] __initdata = {
491 &igep_vwlan_device, 491 &igep_vwlan_device,
492}; 492};
493 493
494static void __init igep_init_early(void)
495{
496 omap2_init_common_infrastructure();
497 omap2_init_common_devices(m65kxxxxam_sdrc_params,
498 m65kxxxxam_sdrc_params);
499}
500
501static int igep2_keymap[] = { 494static int igep2_keymap[] = {
502 KEY(0, 0, KEY_LEFT), 495 KEY(0, 0, KEY_LEFT),
503 KEY(0, 1, KEY_RIGHT), 496 KEY(0, 1, KEY_RIGHT),
@@ -650,6 +643,8 @@ static void __init igep_init(void)
650 igep_i2c_init(); 643 igep_i2c_init();
651 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); 644 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
652 omap_serial_init(); 645 omap_serial_init();
646 omap_sdrc_init(m65kxxxxam_sdrc_params,
647 m65kxxxxam_sdrc_params);
653 usb_musb_init(NULL); 648 usb_musb_init(NULL);
654 649
655 igep_flash_init(); 650 igep_flash_init();
@@ -675,7 +670,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
675 .boot_params = 0x80000100, 670 .boot_params = 0x80000100,
676 .reserve = omap_reserve, 671 .reserve = omap_reserve,
677 .map_io = omap3_map_io, 672 .map_io = omap3_map_io,
678 .init_early = igep_init_early, 673 .init_early = omap35xx_init_early,
679 .init_irq = omap3_init_irq, 674 .init_irq = omap3_init_irq,
680 .init_machine = igep_init, 675 .init_machine = igep_init,
681 .timer = &omap3_timer, 676 .timer = &omap3_timer,
@@ -685,7 +680,7 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
685 .boot_params = 0x80000100, 680 .boot_params = 0x80000100,
686 .reserve = omap_reserve, 681 .reserve = omap_reserve,
687 .map_io = omap3_map_io, 682 .map_io = omap3_map_io,
688 .init_early = igep_init_early, 683 .init_early = omap35xx_init_early,
689 .init_irq = omap3_init_irq, 684 .init_irq = omap3_init_irq,
690 .init_machine = igep_init, 685 .init_machine = igep_init,
691 .timer = &omap3_timer, 686 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 218764c9377e..401b9449f722 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -193,12 +193,6 @@ static struct omap_board_config_kernel ldp_config[] __initdata = {
193 { OMAP_TAG_LCD, &ldp_lcd_config }, 193 { OMAP_TAG_LCD, &ldp_lcd_config },
194}; 194};
195 195
196static void __init omap_ldp_init_early(void)
197{
198 omap2_init_common_infrastructure();
199 omap2_init_common_devices(NULL, NULL);
200}
201
202static struct twl4030_gpio_platform_data ldp_gpio_data = { 196static struct twl4030_gpio_platform_data ldp_gpio_data = {
203 .gpio_base = OMAP_MAX_GPIO_LINES, 197 .gpio_base = OMAP_MAX_GPIO_LINES,
204 .irq_base = TWL4030_GPIO_IRQ_BASE, 198 .irq_base = TWL4030_GPIO_IRQ_BASE,
@@ -325,6 +319,7 @@ static void __init omap_ldp_init(void)
325 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); 319 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
326 omap_ads7846_init(1, 54, 310, NULL); 320 omap_ads7846_init(1, 54, 310, NULL);
327 omap_serial_init(); 321 omap_serial_init();
322 omap_sdrc_init(NULL, NULL);
328 usb_musb_init(NULL); 323 usb_musb_init(NULL);
329 board_nand_init(ldp_nand_partitions, 324 board_nand_init(ldp_nand_partitions,
330 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 325 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
@@ -336,7 +331,7 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
336 .boot_params = 0x80000100, 331 .boot_params = 0x80000100,
337 .reserve = omap_reserve, 332 .reserve = omap_reserve,
338 .map_io = omap3_map_io, 333 .map_io = omap3_map_io,
339 .init_early = omap_ldp_init_early, 334 .init_early = omap3430_init_early,
340 .init_irq = omap3_init_irq, 335 .init_irq = omap3_init_irq,
341 .init_machine = omap_ldp_init, 336 .init_machine = omap_ldp_init,
342 .timer = &omap3_timer, 337 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index e11f0c5d608a..d1f4a0292c42 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -616,18 +616,6 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
616 }, 616 },
617}; 617};
618 618
619static void __init n8x0_map_io(void)
620{
621 omap2_set_globals_242x();
622 omap242x_map_common_io();
623}
624
625static void __init n8x0_init_early(void)
626{
627 omap2_init_common_infrastructure();
628 omap2_init_common_devices(NULL, NULL);
629}
630
631#ifdef CONFIG_OMAP_MUX 619#ifdef CONFIG_OMAP_MUX
632static struct omap_board_mux board_mux[] __initdata = { 620static struct omap_board_mux board_mux[] __initdata = {
633 /* I2S codec port pins for McBSP block */ 621 /* I2S codec port pins for McBSP block */
@@ -689,6 +677,7 @@ static void __init n8x0_init_machine(void)
689 i2c_register_board_info(2, n810_i2c_board_info_2, 677 i2c_register_board_info(2, n810_i2c_board_info_2,
690 ARRAY_SIZE(n810_i2c_board_info_2)); 678 ARRAY_SIZE(n810_i2c_board_info_2));
691 board_serial_init(); 679 board_serial_init();
680 omap_sdrc_init(NULL, NULL);
692 gpmc_onenand_init(board_onenand_data); 681 gpmc_onenand_init(board_onenand_data);
693 n8x0_mmc_init(); 682 n8x0_mmc_init();
694 n8x0_usb_init(); 683 n8x0_usb_init();
@@ -697,8 +686,8 @@ static void __init n8x0_init_machine(void)
697MACHINE_START(NOKIA_N800, "Nokia N800") 686MACHINE_START(NOKIA_N800, "Nokia N800")
698 .boot_params = 0x80000100, 687 .boot_params = 0x80000100,
699 .reserve = omap_reserve, 688 .reserve = omap_reserve,
700 .map_io = n8x0_map_io, 689 .map_io = omap242x_map_io,
701 .init_early = n8x0_init_early, 690 .init_early = omap2420_init_early,
702 .init_irq = omap2_init_irq, 691 .init_irq = omap2_init_irq,
703 .init_machine = n8x0_init_machine, 692 .init_machine = n8x0_init_machine,
704 .timer = &omap2_timer, 693 .timer = &omap2_timer,
@@ -707,8 +696,8 @@ MACHINE_END
707MACHINE_START(NOKIA_N810, "Nokia N810") 696MACHINE_START(NOKIA_N810, "Nokia N810")
708 .boot_params = 0x80000100, 697 .boot_params = 0x80000100,
709 .reserve = omap_reserve, 698 .reserve = omap_reserve,
710 .map_io = n8x0_map_io, 699 .map_io = omap242x_map_io,
711 .init_early = n8x0_init_early, 700 .init_early = omap2420_init_early,
712 .init_irq = omap2_init_irq, 701 .init_irq = omap2_init_irq,
713 .init_machine = n8x0_init_machine, 702 .init_machine = n8x0_init_machine,
714 .timer = &omap2_timer, 703 .timer = &omap2_timer,
@@ -717,8 +706,8 @@ MACHINE_END
717MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 706MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
718 .boot_params = 0x80000100, 707 .boot_params = 0x80000100,
719 .reserve = omap_reserve, 708 .reserve = omap_reserve,
720 .map_io = n8x0_map_io, 709 .map_io = omap242x_map_io,
721 .init_early = n8x0_init_early, 710 .init_early = omap2420_init_early,
722 .init_irq = omap2_init_irq, 711 .init_irq = omap2_init_irq,
723 .init_machine = n8x0_init_machine, 712 .init_machine = n8x0_init_machine,
724 .timer = &omap2_timer, 713 .timer = &omap2_timer,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3ae16b4e3f52..4c25742ebf6d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -444,18 +444,6 @@ static struct platform_device keys_gpio = {
444 }, 444 },
445}; 445};
446 446
447static void __init omap3_beagle_init_early(void)
448{
449 omap2_init_common_infrastructure();
450 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
451 mt46h32m32lf6_sdrc_params);
452}
453
454static void __init omap3_beagle_init_irq(void)
455{
456 omap3_init_irq();
457}
458
459static struct platform_device *omap3_beagle_devices[] __initdata = { 447static struct platform_device *omap3_beagle_devices[] __initdata = {
460 &leds_gpio, 448 &leds_gpio,
461 &keys_gpio, 449 &keys_gpio,
@@ -493,8 +481,8 @@ static void __init beagle_opp_init(void)
493 if (cpu_is_omap3630()) { 481 if (cpu_is_omap3630()) {
494 struct device *mpu_dev, *iva_dev; 482 struct device *mpu_dev, *iva_dev;
495 483
496 mpu_dev = omap2_get_mpuss_device(); 484 mpu_dev = omap_device_get_by_hwmod_name("mpu");
497 iva_dev = omap2_get_iva_device(); 485 iva_dev = omap_device_get_by_hwmod_name("iva");
498 486
499 if (!mpu_dev || !iva_dev) { 487 if (!mpu_dev || !iva_dev) {
500 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", 488 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
@@ -534,6 +522,8 @@ static void __init omap3_beagle_init(void)
534 ARRAY_SIZE(omap3_beagle_devices)); 522 ARRAY_SIZE(omap3_beagle_devices));
535 omap_display_init(&beagle_dss_data); 523 omap_display_init(&beagle_dss_data);
536 omap_serial_init(); 524 omap_serial_init();
525 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
526 mt46h32m32lf6_sdrc_params);
537 527
538 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 528 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
539 /* REVISIT leave DVI powered down until it's needed ... */ 529 /* REVISIT leave DVI powered down until it's needed ... */
@@ -560,8 +550,8 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
560 .boot_params = 0x80000100, 550 .boot_params = 0x80000100,
561 .reserve = omap_reserve, 551 .reserve = omap_reserve,
562 .map_io = omap3_map_io, 552 .map_io = omap3_map_io,
563 .init_early = omap3_beagle_init_early, 553 .init_early = omap3_init_early,
564 .init_irq = omap3_beagle_init_irq, 554 .init_irq = omap3_init_irq,
565 .init_machine = omap3_beagle_init, 555 .init_machine = omap3_beagle_init,
566 .timer = &omap3_secure_timer, 556 .timer = &omap3_secure_timer,
567MACHINE_END 557MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index c452b3f3331a..a1184b347aeb 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -520,12 +520,6 @@ static int __init omap3_evm_i2c_init(void)
520static struct omap_board_config_kernel omap3_evm_config[] __initdata = { 520static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
521}; 521};
522 522
523static void __init omap3_evm_init_early(void)
524{
525 omap2_init_common_infrastructure();
526 omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
527}
528
529static struct usbhs_omap_board_data usbhs_bdata __initdata = { 523static struct usbhs_omap_board_data usbhs_bdata __initdata = {
530 524
531 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 525 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -640,6 +634,7 @@ static void __init omap3_evm_init(void)
640 omap_display_init(&omap3_evm_dss_data); 634 omap_display_init(&omap3_evm_dss_data);
641 635
642 omap_serial_init(); 636 omap_serial_init();
637 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
643 638
644 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ 639 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
645 usb_nop_xceiv_register(); 640 usb_nop_xceiv_register();
@@ -684,7 +679,7 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
684 .boot_params = 0x80000100, 679 .boot_params = 0x80000100,
685 .reserve = omap_reserve, 680 .reserve = omap_reserve,
686 .map_io = omap3_map_io, 681 .map_io = omap3_map_io,
687 .init_early = omap3_evm_init_early, 682 .init_early = omap35xx_init_early,
688 .init_irq = omap3_init_irq, 683 .init_irq = omap3_init_irq,
689 .init_machine = omap3_evm_init, 684 .init_machine = omap3_evm_init,
690 .timer = &omap3_timer, 685 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 703aeb5b8fd4..3a1dd84faca0 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -182,12 +182,6 @@ static inline void __init board_smsc911x_init(void)
182 gpmc_smsc911x_init(&board_smsc911x_data); 182 gpmc_smsc911x_init(&board_smsc911x_data);
183} 183}
184 184
185static void __init omap3logic_init_early(void)
186{
187 omap2_init_common_infrastructure();
188 omap2_init_common_devices(NULL, NULL);
189}
190
191#ifdef CONFIG_OMAP_MUX 185#ifdef CONFIG_OMAP_MUX
192static struct omap_board_mux board_mux[] __initdata = { 186static struct omap_board_mux board_mux[] __initdata = {
193 { .reg_offset = OMAP_MUX_TERMINATOR }, 187 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -200,6 +194,7 @@ static void __init omap3logic_init(void)
200 omap3torpedo_fix_pbias_voltage(); 194 omap3torpedo_fix_pbias_voltage();
201 omap3logic_i2c_init(); 195 omap3logic_i2c_init();
202 omap_serial_init(); 196 omap_serial_init();
197 omap_sdrc_init(NULL, NULL);
203 board_mmc_init(); 198 board_mmc_init();
204 board_smsc911x_init(); 199 board_smsc911x_init();
205 200
@@ -211,7 +206,7 @@ static void __init omap3logic_init(void)
211MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board") 206MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
212 .boot_params = 0x80000100, 207 .boot_params = 0x80000100,
213 .map_io = omap3_map_io, 208 .map_io = omap3_map_io,
214 .init_early = omap3logic_init_early, 209 .init_early = omap35xx_init_early,
215 .init_irq = omap3_init_irq, 210 .init_irq = omap3_init_irq,
216 .init_machine = omap3logic_init, 211 .init_machine = omap3logic_init,
217 .timer = &omap3_timer, 212 .timer = &omap3_timer,
@@ -220,7 +215,7 @@ MACHINE_END
220MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") 215MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
221 .boot_params = 0x80000100, 216 .boot_params = 0x80000100,
222 .map_io = omap3_map_io, 217 .map_io = omap3_map_io,
223 .init_early = omap3logic_init_early, 218 .init_early = omap35xx_init_early,
224 .init_irq = omap3_init_irq, 219 .init_irq = omap3_init_irq,
225 .init_machine = omap3logic_init, 220 .init_machine = omap3logic_init,
226 .timer = &omap3_timer, 221 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 080d7bd6795e..e46bf5249559 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -525,13 +525,6 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
525 } 525 }
526}; 526};
527 527
528static void __init omap3pandora_init_early(void)
529{
530 omap2_init_common_infrastructure();
531 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
532 mt46h32m32lf6_sdrc_params);
533}
534
535static void __init pandora_wl1251_init(void) 528static void __init pandora_wl1251_init(void)
536{ 529{
537 struct wl12xx_platform_data pandora_wl1251_pdata; 530 struct wl12xx_platform_data pandora_wl1251_pdata;
@@ -593,6 +586,8 @@ static void __init omap3pandora_init(void)
593 ARRAY_SIZE(omap3pandora_devices)); 586 ARRAY_SIZE(omap3pandora_devices));
594 omap_display_init(&pandora_dss_data); 587 omap_display_init(&pandora_dss_data);
595 omap_serial_init(); 588 omap_serial_init();
589 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
590 mt46h32m32lf6_sdrc_params);
596 spi_register_board_info(omap3pandora_spi_board_info, 591 spi_register_board_info(omap3pandora_spi_board_info,
597 ARRAY_SIZE(omap3pandora_spi_board_info)); 592 ARRAY_SIZE(omap3pandora_spi_board_info));
598 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 593 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
@@ -609,7 +604,7 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
609 .boot_params = 0x80000100, 604 .boot_params = 0x80000100,
610 .reserve = omap_reserve, 605 .reserve = omap_reserve,
611 .map_io = omap3_map_io, 606 .map_io = omap3_map_io,
612 .init_early = omap3pandora_init_early, 607 .init_early = omap35xx_init_early,
613 .init_irq = omap3_init_irq, 608 .init_irq = omap3_init_irq,
614 .init_machine = omap3pandora_init, 609 .init_machine = omap3pandora_init,
615 .timer = &omap3_timer, 610 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 8e104980ea26..fa58a0f1584a 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -428,17 +428,6 @@ static int __init omap3_stalker_i2c_init(void)
428static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { 428static struct omap_board_config_kernel omap3_stalker_config[] __initdata = {
429}; 429};
430 430
431static void __init omap3_stalker_init_early(void)
432{
433 omap2_init_common_infrastructure();
434 omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
435}
436
437static void __init omap3_stalker_init_irq(void)
438{
439 omap3_init_irq();
440}
441
442static struct platform_device *omap3_stalker_devices[] __initdata = { 431static struct platform_device *omap3_stalker_devices[] __initdata = {
443 &keys_gpio, 432 &keys_gpio,
444}; 433};
@@ -478,6 +467,7 @@ static void __init omap3_stalker_init(void)
478 omap_display_init(&omap3_stalker_dss_data); 467 omap_display_init(&omap3_stalker_dss_data);
479 468
480 omap_serial_init(); 469 omap_serial_init();
470 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
481 usb_musb_init(NULL); 471 usb_musb_init(NULL);
482 usbhs_init(&usbhs_bdata); 472 usbhs_init(&usbhs_bdata);
483 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); 473 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
@@ -496,8 +486,8 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
496 /* Maintainer: Jason Lam -lzg@ema-tech.com */ 486 /* Maintainer: Jason Lam -lzg@ema-tech.com */
497 .boot_params = 0x80000100, 487 .boot_params = 0x80000100,
498 .map_io = omap3_map_io, 488 .map_io = omap3_map_io,
499 .init_early = omap3_stalker_init_early, 489 .init_early = omap35xx_init_early,
500 .init_irq = omap3_stalker_init_irq, 490 .init_irq = omap3_init_irq,
501 .init_machine = omap3_stalker_init, 491 .init_machine = omap3_stalker_init,
502 .timer = &omap3_secure_timer, 492 .timer = &omap3_secure_timer,
503MACHINE_END 493MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 852ea0464057..05488fbc20d5 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -326,18 +326,6 @@ static struct omap_board_mux board_mux[] __initdata = {
326}; 326};
327#endif 327#endif
328 328
329static void __init omap3_touchbook_init_early(void)
330{
331 omap2_init_common_infrastructure();
332 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
333 mt46h32m32lf6_sdrc_params);
334}
335
336static void __init omap3_touchbook_init_irq(void)
337{
338 omap3_init_irq();
339}
340
341static struct platform_device *omap3_touchbook_devices[] __initdata = { 329static struct platform_device *omap3_touchbook_devices[] __initdata = {
342 &omap3_touchbook_lcd_device, 330 &omap3_touchbook_lcd_device,
343 &leds_gpio, 331 &leds_gpio,
@@ -385,6 +373,8 @@ static void __init omap3_touchbook_init(void)
385 platform_add_devices(omap3_touchbook_devices, 373 platform_add_devices(omap3_touchbook_devices,
386 ARRAY_SIZE(omap3_touchbook_devices)); 374 ARRAY_SIZE(omap3_touchbook_devices));
387 omap_serial_init(); 375 omap_serial_init();
376 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
377 mt46h32m32lf6_sdrc_params);
388 378
389 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 379 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
390 /* REVISIT leave DVI powered down until it's needed ... */ 380 /* REVISIT leave DVI powered down until it's needed ... */
@@ -407,8 +397,8 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
407 .boot_params = 0x80000100, 397 .boot_params = 0x80000100,
408 .reserve = omap_reserve, 398 .reserve = omap_reserve,
409 .map_io = omap3_map_io, 399 .map_io = omap3_map_io,
410 .init_early = omap3_touchbook_init_early, 400 .init_early = omap3430_init_early,
411 .init_irq = omap3_touchbook_init_irq, 401 .init_irq = omap3_init_irq,
412 .init_machine = omap3_touchbook_init, 402 .init_machine = omap3_touchbook_init,
413 .timer = &omap3_secure_timer, 403 .timer = &omap3_secure_timer,
414MACHINE_END 404MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 9aaa96057666..e26929049a4d 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -95,12 +95,6 @@ static struct platform_device *panda_devices[] __initdata = {
95 &wl1271_device, 95 &wl1271_device,
96}; 96};
97 97
98static void __init omap4_panda_init_early(void)
99{
100 omap2_init_common_infrastructure();
101 omap2_init_common_devices(NULL, NULL);
102}
103
104static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 98static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
105 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 99 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
106 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 100 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
@@ -569,24 +563,19 @@ static void __init omap4_panda_init(void)
569 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); 563 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
570 platform_device_register(&omap_vwlan_device); 564 platform_device_register(&omap_vwlan_device);
571 board_serial_init(); 565 board_serial_init();
566 omap_sdrc_init(NULL, NULL);
572 omap4_twl6030_hsmmc_init(mmc); 567 omap4_twl6030_hsmmc_init(mmc);
573 omap4_ehci_init(); 568 omap4_ehci_init();
574 usb_musb_init(&musb_board_data); 569 usb_musb_init(&musb_board_data);
575 omap4_panda_display_init(); 570 omap4_panda_display_init();
576} 571}
577 572
578static void __init omap4_panda_map_io(void)
579{
580 omap2_set_globals_443x();
581 omap44xx_map_common_io();
582}
583
584MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board") 573MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
585 /* Maintainer: David Anders - Texas Instruments Inc */ 574 /* Maintainer: David Anders - Texas Instruments Inc */
586 .boot_params = 0x80000100, 575 .boot_params = 0x80000100,
587 .reserve = omap_reserve, 576 .reserve = omap_reserve,
588 .map_io = omap4_panda_map_io, 577 .map_io = omap4_map_io,
589 .init_early = omap4_panda_init_early, 578 .init_early = omap4430_init_early,
590 .init_irq = gic_init_irq, 579 .init_irq = gic_init_irq,
591 .init_machine = omap4_panda_init, 580 .init_machine = omap4_panda_init,
592 .timer = &omap4_timer, 581 .timer = &omap4_timer,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index f949a9954d76..7228ae50802d 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -478,13 +478,6 @@ static int __init overo_spi_init(void)
478 return 0; 478 return 0;
479} 479}
480 480
481static void __init overo_init_early(void)
482{
483 omap2_init_common_infrastructure();
484 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
485 mt46h32m32lf6_sdrc_params);
486}
487
488static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 481static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
489 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 482 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
490 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 483 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
@@ -514,6 +507,8 @@ static void __init overo_init(void)
514 overo_i2c_init(); 507 overo_i2c_init();
515 omap_display_init(&overo_dss_data); 508 omap_display_init(&overo_dss_data);
516 omap_serial_init(); 509 omap_serial_init();
510 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
511 mt46h32m32lf6_sdrc_params);
517 omap_nand_flash_init(0, overo_nand_partitions, 512 omap_nand_flash_init(0, overo_nand_partitions,
518 ARRAY_SIZE(overo_nand_partitions)); 513 ARRAY_SIZE(overo_nand_partitions));
519 usb_musb_init(NULL); 514 usb_musb_init(NULL);
@@ -564,7 +559,7 @@ MACHINE_START(OVERO, "Gumstix Overo")
564 .boot_params = 0x80000100, 559 .boot_params = 0x80000100,
565 .reserve = omap_reserve, 560 .reserve = omap_reserve,
566 .map_io = omap3_map_io, 561 .map_io = omap3_map_io,
567 .init_early = overo_init_early, 562 .init_early = omap35xx_init_early,
568 .init_irq = omap3_init_irq, 563 .init_irq = omap3_init_irq,
569 .init_machine = overo_init, 564 .init_machine = overo_init,
570 .timer = &omap3_timer, 565 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 7dfed24ee12e..a98db616e0d4 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -123,15 +123,6 @@ static void __init rm680_peripherals_init(void)
123 omap2_hsmmc_init(mmc); 123 omap2_hsmmc_init(mmc);
124} 124}
125 125
126static void __init rm680_init_early(void)
127{
128 struct omap_sdrc_params *sdrc_params;
129
130 omap2_init_common_infrastructure();
131 sdrc_params = nokia_get_sdram_timings();
132 omap2_init_common_devices(sdrc_params, sdrc_params);
133}
134
135#ifdef CONFIG_OMAP_MUX 126#ifdef CONFIG_OMAP_MUX
136static struct omap_board_mux board_mux[] __initdata = { 127static struct omap_board_mux board_mux[] __initdata = {
137 { .reg_offset = OMAP_MUX_TERMINATOR }, 128 { .reg_offset = OMAP_MUX_TERMINATOR },
@@ -140,23 +131,23 @@ static struct omap_board_mux board_mux[] __initdata = {
140 131
141static void __init rm680_init(void) 132static void __init rm680_init(void)
142{ 133{
134 struct omap_sdrc_params *sdrc_params;
135
143 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 136 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
144 omap_serial_init(); 137 omap_serial_init();
138
139 sdrc_params = nokia_get_sdram_timings();
140 omap_sdrc_init(sdrc_params, sdrc_params);
141
145 usb_musb_init(NULL); 142 usb_musb_init(NULL);
146 rm680_peripherals_init(); 143 rm680_peripherals_init();
147} 144}
148 145
149static void __init rm680_map_io(void)
150{
151 omap2_set_globals_3xxx();
152 omap34xx_map_common_io();
153}
154
155MACHINE_START(NOKIA_RM680, "Nokia RM-680 board") 146MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
156 .boot_params = 0x80000100, 147 .boot_params = 0x80000100,
157 .reserve = omap_reserve, 148 .reserve = omap_reserve,
158 .map_io = rm680_map_io, 149 .map_io = omap3_map_io,
159 .init_early = rm680_init_early, 150 .init_early = omap3630_init_early,
160 .init_irq = omap3_init_irq, 151 .init_irq = omap3_init_irq,
161 .init_machine = rm680_init, 152 .init_machine = rm680_init,
162 .timer = &omap3_timer, 153 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 5ea142f9bc97..8677a06aa4a7 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -102,15 +102,6 @@ static struct omap_board_config_kernel rx51_config[] = {
102 { OMAP_TAG_LCD, &rx51_lcd_config }, 102 { OMAP_TAG_LCD, &rx51_lcd_config },
103}; 103};
104 104
105static void __init rx51_init_early(void)
106{
107 struct omap_sdrc_params *sdrc_params;
108
109 omap2_init_common_infrastructure();
110 sdrc_params = nokia_get_sdram_timings();
111 omap2_init_common_devices(sdrc_params, sdrc_params);
112}
113
114extern void __init rx51_peripherals_init(void); 105extern void __init rx51_peripherals_init(void);
115 106
116#ifdef CONFIG_OMAP_MUX 107#ifdef CONFIG_OMAP_MUX
@@ -127,11 +118,17 @@ static struct omap_musb_board_data musb_board_data = {
127 118
128static void __init rx51_init(void) 119static void __init rx51_init(void)
129{ 120{
121 struct omap_sdrc_params *sdrc_params;
122
130 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 123 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
131 omap_board_config = rx51_config; 124 omap_board_config = rx51_config;
132 omap_board_config_size = ARRAY_SIZE(rx51_config); 125 omap_board_config_size = ARRAY_SIZE(rx51_config);
133 omap3_pm_init_cpuidle(rx51_cpuidle_params); 126 omap3_pm_init_cpuidle(rx51_cpuidle_params);
134 omap_serial_init(); 127 omap_serial_init();
128
129 sdrc_params = nokia_get_sdram_timings();
130 omap_sdrc_init(sdrc_params, sdrc_params);
131
135 usb_musb_init(&musb_board_data); 132 usb_musb_init(&musb_board_data);
136 rx51_peripherals_init(); 133 rx51_peripherals_init();
137 134
@@ -142,12 +139,6 @@ static void __init rx51_init(void)
142 platform_device_register(&leds_gpio); 139 platform_device_register(&leds_gpio);
143} 140}
144 141
145static void __init rx51_map_io(void)
146{
147 omap2_set_globals_3xxx();
148 omap34xx_map_common_io();
149}
150
151static void __init rx51_reserve(void) 142static void __init rx51_reserve(void)
152{ 143{
153 rx51_video_mem_init(); 144 rx51_video_mem_init();
@@ -158,8 +149,8 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
158 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ 149 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
159 .boot_params = 0x80000100, 150 .boot_params = 0x80000100,
160 .reserve = rx51_reserve, 151 .reserve = rx51_reserve,
161 .map_io = rx51_map_io, 152 .map_io = omap3_map_io,
162 .init_early = rx51_init_early, 153 .init_early = omap3430_init_early,
163 .init_irq = omap3_init_irq, 154 .init_irq = omap3_init_irq,
164 .init_machine = rx51_init, 155 .init_machine = rx51_init,
165 .timer = &omap3_timer, 156 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index a85d5b0b11da..b0a16d2f2388 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -27,22 +27,16 @@
27static struct omap_board_config_kernel ti8168_evm_config[] __initdata = { 27static struct omap_board_config_kernel ti8168_evm_config[] __initdata = {
28}; 28};
29 29
30static void __init ti8168_init_early(void)
31{
32 omap2_init_common_infrastructure();
33 omap2_init_common_devices(NULL, NULL);
34}
35
36static void __init ti8168_evm_init(void) 30static void __init ti8168_evm_init(void)
37{ 31{
38 omap_serial_init(); 32 omap_serial_init();
33 omap_sdrc_init(NULL, NULL);
39 omap_board_config = ti8168_evm_config; 34 omap_board_config = ti8168_evm_config;
40 omap_board_config_size = ARRAY_SIZE(ti8168_evm_config); 35 omap_board_config_size = ARRAY_SIZE(ti8168_evm_config);
41} 36}
42 37
43static void __init ti8168_evm_map_io(void) 38static void __init ti8168_evm_map_io(void)
44{ 39{
45 omap2_set_globals_ti816x();
46 omapti816x_map_common_io(); 40 omapti816x_map_common_io();
47} 41}
48 42
@@ -50,7 +44,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
50 /* Maintainer: Texas Instruments */ 44 /* Maintainer: Texas Instruments */
51 .boot_params = 0x80000100, 45 .boot_params = 0x80000100,
52 .map_io = ti8168_evm_map_io, 46 .map_io = ti8168_evm_map_io,
53 .init_early = ti8168_init_early, 47 .init_early = ti816x_init_early,
54 .init_irq = ti816x_init_irq, 48 .init_irq = ti816x_init_irq,
55 .timer = &omap3_timer, 49 .timer = &omap3_timer,
56 .init_machine = ti8168_evm_init, 50 .init_machine = ti8168_evm_init,
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 8a98c3c303fc..d56c79661038 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -34,17 +34,6 @@
34 34
35#define ZOOM3_EHCI_RESET_GPIO 64 35#define ZOOM3_EHCI_RESET_GPIO 64
36 36
37static void __init omap_zoom_init_early(void)
38{
39 omap2_init_common_infrastructure();
40 if (machine_is_omap_zoom2())
41 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
42 mt46h32m32lf6_sdrc_params);
43 else if (machine_is_omap_zoom3())
44 omap2_init_common_devices(h8mbx00u0mer0em_sdrc_params,
45 h8mbx00u0mer0em_sdrc_params);
46}
47
48#ifdef CONFIG_OMAP_MUX 37#ifdef CONFIG_OMAP_MUX
49static struct omap_board_mux board_mux[] __initdata = { 38static struct omap_board_mux board_mux[] __initdata = {
50 /* WLAN IRQ - GPIO 162 */ 39 /* WLAN IRQ - GPIO 162 */
@@ -129,6 +118,14 @@ static void __init omap_zoom_init(void)
129 ZOOM_NAND_CS, NAND_BUSWIDTH_16); 118 ZOOM_NAND_CS, NAND_BUSWIDTH_16);
130 zoom_debugboard_init(); 119 zoom_debugboard_init();
131 zoom_peripherals_init(); 120 zoom_peripherals_init();
121
122 if (machine_is_omap_zoom2())
123 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
124 mt46h32m32lf6_sdrc_params);
125 else if (machine_is_omap_zoom3())
126 omap_sdrc_init(h8mbx00u0mer0em_sdrc_params,
127 h8mbx00u0mer0em_sdrc_params);
128
132 zoom_display_init(); 129 zoom_display_init();
133} 130}
134 131
@@ -136,7 +133,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
136 .boot_params = 0x80000100, 133 .boot_params = 0x80000100,
137 .reserve = omap_reserve, 134 .reserve = omap_reserve,
138 .map_io = omap3_map_io, 135 .map_io = omap3_map_io,
139 .init_early = omap_zoom_init_early, 136 .init_early = omap3430_init_early,
140 .init_irq = omap3_init_irq, 137 .init_irq = omap3_init_irq,
141 .init_machine = omap_zoom_init, 138 .init_machine = omap_zoom_init,
142 .timer = &omap3_timer, 139 .timer = &omap3_timer,
@@ -146,7 +143,7 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
146 .boot_params = 0x80000100, 143 .boot_params = 0x80000100,
147 .reserve = omap_reserve, 144 .reserve = omap_reserve,
148 .map_io = omap3_map_io, 145 .map_io = omap3_map_io,
149 .init_early = omap_zoom_init_early, 146 .init_early = omap3630_init_early,
150 .init_irq = omap3_init_irq, 147 .init_irq = omap3_init_irq,
151 .init_machine = omap_zoom_init, 148 .init_machine = omap_zoom_init,
152 .timer = &omap3_timer, 149 .timer = &omap3_timer,
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index debc040872f1..14a6277dd184 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1898,6 +1898,54 @@ static struct omap_clk omap2420_clks[] = {
1898 CLK(NULL, "pka_ick", &pka_ick, CK_242X), 1898 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1899 CLK(NULL, "usb_fck", &usb_fck, CK_242X), 1899 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1900 CLK("musb-hdrc", "fck", &osc_ck, CK_242X), 1900 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1901 CLK("omap_timer.1", "fck", &gpt1_fck, CK_242X),
1902 CLK("omap_timer.2", "fck", &gpt2_fck, CK_242X),
1903 CLK("omap_timer.3", "fck", &gpt3_fck, CK_242X),
1904 CLK("omap_timer.4", "fck", &gpt4_fck, CK_242X),
1905 CLK("omap_timer.5", "fck", &gpt5_fck, CK_242X),
1906 CLK("omap_timer.6", "fck", &gpt6_fck, CK_242X),
1907 CLK("omap_timer.7", "fck", &gpt7_fck, CK_242X),
1908 CLK("omap_timer.8", "fck", &gpt8_fck, CK_242X),
1909 CLK("omap_timer.9", "fck", &gpt9_fck, CK_242X),
1910 CLK("omap_timer.10", "fck", &gpt10_fck, CK_242X),
1911 CLK("omap_timer.11", "fck", &gpt11_fck, CK_242X),
1912 CLK("omap_timer.12", "fck", &gpt12_fck, CK_242X),
1913 CLK("omap_timer.1", "32k_ck", &func_32k_ck, CK_243X),
1914 CLK("omap_timer.2", "32k_ck", &func_32k_ck, CK_243X),
1915 CLK("omap_timer.3", "32k_ck", &func_32k_ck, CK_243X),
1916 CLK("omap_timer.4", "32k_ck", &func_32k_ck, CK_243X),
1917 CLK("omap_timer.5", "32k_ck", &func_32k_ck, CK_243X),
1918 CLK("omap_timer.6", "32k_ck", &func_32k_ck, CK_243X),
1919 CLK("omap_timer.7", "32k_ck", &func_32k_ck, CK_243X),
1920 CLK("omap_timer.8", "32k_ck", &func_32k_ck, CK_243X),
1921 CLK("omap_timer.9", "32k_ck", &func_32k_ck, CK_243X),
1922 CLK("omap_timer.10", "32k_ck", &func_32k_ck, CK_243X),
1923 CLK("omap_timer.11", "32k_ck", &func_32k_ck, CK_243X),
1924 CLK("omap_timer.12", "32k_ck", &func_32k_ck, CK_243X),
1925 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_243X),
1926 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_243X),
1927 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_243X),
1928 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_243X),
1929 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_243X),
1930 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_243X),
1931 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_243X),
1932 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_243X),
1933 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_243X),
1934 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_243X),
1935 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_243X),
1936 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_243X),
1937 CLK("omap_timer.1", "alt_ck", &alt_ck, CK_243X),
1938 CLK("omap_timer.2", "alt_ck", &alt_ck, CK_243X),
1939 CLK("omap_timer.3", "alt_ck", &alt_ck, CK_243X),
1940 CLK("omap_timer.4", "alt_ck", &alt_ck, CK_243X),
1941 CLK("omap_timer.5", "alt_ck", &alt_ck, CK_243X),
1942 CLK("omap_timer.6", "alt_ck", &alt_ck, CK_243X),
1943 CLK("omap_timer.7", "alt_ck", &alt_ck, CK_243X),
1944 CLK("omap_timer.8", "alt_ck", &alt_ck, CK_243X),
1945 CLK("omap_timer.9", "alt_ck", &alt_ck, CK_243X),
1946 CLK("omap_timer.10", "alt_ck", &alt_ck, CK_243X),
1947 CLK("omap_timer.11", "alt_ck", &alt_ck, CK_243X),
1948 CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X),
1901}; 1949};
1902 1950
1903/* 1951/*
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 96a942e42db1..ea6717cfa3c8 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1998,6 +1998,54 @@ static struct omap_clk omap2430_clks[] = {
1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X), 1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
1999 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X), 1999 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2000 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X), 2000 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2001 CLK("omap_timer.1", "fck", &gpt1_fck, CK_243X),
2002 CLK("omap_timer.2", "fck", &gpt2_fck, CK_243X),
2003 CLK("omap_timer.3", "fck", &gpt3_fck, CK_243X),
2004 CLK("omap_timer.4", "fck", &gpt4_fck, CK_243X),
2005 CLK("omap_timer.5", "fck", &gpt5_fck, CK_243X),
2006 CLK("omap_timer.6", "fck", &gpt6_fck, CK_243X),
2007 CLK("omap_timer.7", "fck", &gpt7_fck, CK_243X),
2008 CLK("omap_timer.8", "fck", &gpt8_fck, CK_243X),
2009 CLK("omap_timer.9", "fck", &gpt9_fck, CK_243X),
2010 CLK("omap_timer.10", "fck", &gpt10_fck, CK_243X),
2011 CLK("omap_timer.11", "fck", &gpt11_fck, CK_243X),
2012 CLK("omap_timer.12", "fck", &gpt12_fck, CK_243X),
2013 CLK("omap_timer.1", "32k_ck", &func_32k_ck, CK_243X),
2014 CLK("omap_timer.2", "32k_ck", &func_32k_ck, CK_243X),
2015 CLK("omap_timer.3", "32k_ck", &func_32k_ck, CK_243X),
2016 CLK("omap_timer.4", "32k_ck", &func_32k_ck, CK_243X),
2017 CLK("omap_timer.5", "32k_ck", &func_32k_ck, CK_243X),
2018 CLK("omap_timer.6", "32k_ck", &func_32k_ck, CK_243X),
2019 CLK("omap_timer.7", "32k_ck", &func_32k_ck, CK_243X),
2020 CLK("omap_timer.8", "32k_ck", &func_32k_ck, CK_243X),
2021 CLK("omap_timer.9", "32k_ck", &func_32k_ck, CK_243X),
2022 CLK("omap_timer.10", "32k_ck", &func_32k_ck, CK_243X),
2023 CLK("omap_timer.11", "32k_ck", &func_32k_ck, CK_243X),
2024 CLK("omap_timer.12", "32k_ck", &func_32k_ck, CK_243X),
2025 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_243X),
2026 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_243X),
2027 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_243X),
2028 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_243X),
2029 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_243X),
2030 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_243X),
2031 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_243X),
2032 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_243X),
2033 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_243X),
2034 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_243X),
2035 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_243X),
2036 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_243X),
2037 CLK("omap_timer.1", "alt_ck", &alt_ck, CK_243X),
2038 CLK("omap_timer.2", "alt_ck", &alt_ck, CK_243X),
2039 CLK("omap_timer.3", "alt_ck", &alt_ck, CK_243X),
2040 CLK("omap_timer.4", "alt_ck", &alt_ck, CK_243X),
2041 CLK("omap_timer.5", "alt_ck", &alt_ck, CK_243X),
2042 CLK("omap_timer.6", "alt_ck", &alt_ck, CK_243X),
2043 CLK("omap_timer.7", "alt_ck", &alt_ck, CK_243X),
2044 CLK("omap_timer.8", "alt_ck", &alt_ck, CK_243X),
2045 CLK("omap_timer.9", "alt_ck", &alt_ck, CK_243X),
2046 CLK("omap_timer.10", "alt_ck", &alt_ck, CK_243X),
2047 CLK("omap_timer.11", "alt_ck", &alt_ck, CK_243X),
2048 CLK("omap_timer.12", "alt_ck", &alt_ck, CK_243X),
2001}; 2049};
2002 2050
2003/* 2051/*
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index b9b844683147..65dd363163bc 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3464,6 +3464,42 @@ static struct omap_clk omap3xxx_clks[] = {
3464 CLK("musb-am35x", "fck", &hsotgusb_fck_am35xx, CK_AM35XX), 3464 CLK("musb-am35x", "fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3465 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX), 3465 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3466 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX), 3466 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3467 CLK("omap_timer.1", "fck", &gpt1_fck, CK_3XXX),
3468 CLK("omap_timer.2", "fck", &gpt2_fck, CK_3XXX),
3469 CLK("omap_timer.3", "fck", &gpt3_fck, CK_3XXX),
3470 CLK("omap_timer.4", "fck", &gpt4_fck, CK_3XXX),
3471 CLK("omap_timer.5", "fck", &gpt5_fck, CK_3XXX),
3472 CLK("omap_timer.6", "fck", &gpt6_fck, CK_3XXX),
3473 CLK("omap_timer.7", "fck", &gpt7_fck, CK_3XXX),
3474 CLK("omap_timer.8", "fck", &gpt8_fck, CK_3XXX),
3475 CLK("omap_timer.9", "fck", &gpt9_fck, CK_3XXX),
3476 CLK("omap_timer.10", "fck", &gpt10_fck, CK_3XXX),
3477 CLK("omap_timer.11", "fck", &gpt11_fck, CK_3XXX),
3478 CLK("omap_timer.12", "fck", &gpt12_fck, CK_3XXX),
3479 CLK("omap_timer.1", "32k_ck", &omap_32k_fck, CK_3XXX),
3480 CLK("omap_timer.2", "32k_ck", &omap_32k_fck, CK_3XXX),
3481 CLK("omap_timer.3", "32k_ck", &omap_32k_fck, CK_3XXX),
3482 CLK("omap_timer.4", "32k_ck", &omap_32k_fck, CK_3XXX),
3483 CLK("omap_timer.5", "32k_ck", &omap_32k_fck, CK_3XXX),
3484 CLK("omap_timer.6", "32k_ck", &omap_32k_fck, CK_3XXX),
3485 CLK("omap_timer.7", "32k_ck", &omap_32k_fck, CK_3XXX),
3486 CLK("omap_timer.8", "32k_ck", &omap_32k_fck, CK_3XXX),
3487 CLK("omap_timer.9", "32k_ck", &omap_32k_fck, CK_3XXX),
3488 CLK("omap_timer.10", "32k_ck", &omap_32k_fck, CK_3XXX),
3489 CLK("omap_timer.11", "32k_ck", &omap_32k_fck, CK_3XXX),
3490 CLK("omap_timer.12", "32k_ck", &omap_32k_fck, CK_3XXX),
3491 CLK("omap_timer.1", "sys_ck", &sys_ck, CK_3XXX),
3492 CLK("omap_timer.2", "sys_ck", &sys_ck, CK_3XXX),
3493 CLK("omap_timer.3", "sys_ck", &sys_ck, CK_3XXX),
3494 CLK("omap_timer.4", "sys_ck", &sys_ck, CK_3XXX),
3495 CLK("omap_timer.5", "sys_ck", &sys_ck, CK_3XXX),
3496 CLK("omap_timer.6", "sys_ck", &sys_ck, CK_3XXX),
3497 CLK("omap_timer.7", "sys_ck", &sys_ck, CK_3XXX),
3498 CLK("omap_timer.8", "sys_ck", &sys_ck, CK_3XXX),
3499 CLK("omap_timer.9", "sys_ck", &sys_ck, CK_3XXX),
3500 CLK("omap_timer.10", "sys_ck", &sys_ck, CK_3XXX),
3501 CLK("omap_timer.11", "sys_ck", &sys_ck, CK_3XXX),
3502 CLK("omap_timer.12", "sys_ck", &sys_ck, CK_3XXX),
3467}; 3503};
3468 3504
3469 3505
@@ -3472,7 +3508,16 @@ int __init omap3xxx_clk_init(void)
3472 struct omap_clk *c; 3508 struct omap_clk *c;
3473 u32 cpu_clkflg = 0; 3509 u32 cpu_clkflg = 0;
3474 3510
3475 if (cpu_is_omap3517()) { 3511 /*
3512 * 3505 must be tested before 3517, since 3517 returns true
3513 * for both AM3517 chips and AM3517 family chips, which
3514 * includes 3505. Unfortunately there's no obvious family
3515 * test for 3517/3505 :-(
3516 */
3517 if (cpu_is_omap3505()) {
3518 cpu_mask = RATE_IN_34XX;
3519 cpu_clkflg = CK_3505;
3520 } else if (cpu_is_omap3517()) {
3476 cpu_mask = RATE_IN_34XX; 3521 cpu_mask = RATE_IN_34XX;
3477 cpu_clkflg = CK_3517; 3522 cpu_clkflg = CK_3517;
3478 } else if (cpu_is_omap3505()) { 3523 } else if (cpu_is_omap3505()) {
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index c0b6fbda3408..946bf04a956d 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3363,6 +3363,39 @@ static struct omap_clk omap44xx_clks[] = {
3363 CLK("usbhs-omap.0", "usbhost_ick", &dummy_ck, CK_443X), 3363 CLK("usbhs-omap.0", "usbhost_ick", &dummy_ck, CK_443X),
3364 CLK("usbhs-omap.0", "usbtll_fck", &dummy_ck, CK_443X), 3364 CLK("usbhs-omap.0", "usbtll_fck", &dummy_ck, CK_443X),
3365 CLK("omap_wdt", "ick", &dummy_ck, CK_443X), 3365 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3366 CLK("omap_timer.1", "fck", &timer1_fck, CK_443X),
3367 CLK("omap_timer.2", "fck", &timer2_fck, CK_443X),
3368 CLK("omap_timer.3", "fck", &timer3_fck, CK_443X),
3369 CLK("omap_timer.4", "fck", &timer4_fck, CK_443X),
3370 CLK("omap_timer.5", "fck", &timer5_fck, CK_443X),
3371 CLK("omap_timer.6", "fck", &timer6_fck, CK_443X),
3372 CLK("omap_timer.7", "fck", &timer7_fck, CK_443X),
3373 CLK("omap_timer.8", "fck", &timer8_fck, CK_443X),
3374 CLK("omap_timer.9", "fck", &timer9_fck, CK_443X),
3375 CLK("omap_timer.10", "fck", &timer10_fck, CK_443X),
3376 CLK("omap_timer.11", "fck", &timer11_fck, CK_443X),
3377 CLK("omap_timer.1", "32k_ck", &sys_32k_ck, CK_443X),
3378 CLK("omap_timer.2", "32k_ck", &sys_32k_ck, CK_443X),
3379 CLK("omap_timer.3", "32k_ck", &sys_32k_ck, CK_443X),
3380 CLK("omap_timer.4", "32k_ck", &sys_32k_ck, CK_443X),
3381 CLK("omap_timer.5", "32k_ck", &sys_32k_ck, CK_443X),
3382 CLK("omap_timer.6", "32k_ck", &sys_32k_ck, CK_443X),
3383 CLK("omap_timer.7", "32k_ck", &sys_32k_ck, CK_443X),
3384 CLK("omap_timer.8", "32k_ck", &sys_32k_ck, CK_443X),
3385 CLK("omap_timer.9", "32k_ck", &sys_32k_ck, CK_443X),
3386 CLK("omap_timer.10", "32k_ck", &sys_32k_ck, CK_443X),
3387 CLK("omap_timer.11", "32k_ck", &sys_32k_ck, CK_443X),
3388 CLK("omap_timer.1", "sys_ck", &sys_clkin_ck, CK_443X),
3389 CLK("omap_timer.2", "sys_ck", &sys_clkin_ck, CK_443X),
3390 CLK("omap_timer.3", "sys_ck", &sys_clkin_ck, CK_443X),
3391 CLK("omap_timer.4", "sys_ck", &sys_clkin_ck, CK_443X),
3392 CLK("omap_timer.9", "sys_ck", &sys_clkin_ck, CK_443X),
3393 CLK("omap_timer.10", "sys_ck", &sys_clkin_ck, CK_443X),
3394 CLK("omap_timer.11", "sys_ck", &sys_clkin_ck, CK_443X),
3395 CLK("omap_timer.5", "sys_ck", &syc_clk_div_ck, CK_443X),
3396 CLK("omap_timer.6", "sys_ck", &syc_clk_div_ck, CK_443X),
3397 CLK("omap_timer.7", "sys_ck", &syc_clk_div_ck, CK_443X),
3398 CLK("omap_timer.8", "sys_ck", &syc_clk_div_ck, CK_443X),
3366}; 3399};
3367 3400
3368int __init omap4xxx_clk_init(void) 3401int __init omap4xxx_clk_init(void)
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 8f0890685d7b..8480ee4344ea 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -73,9 +73,6 @@ static int _clkdm_register(struct clockdomain *clkdm)
73 if (!clkdm || !clkdm->name) 73 if (!clkdm || !clkdm->name)
74 return -EINVAL; 74 return -EINVAL;
75 75
76 if (!omap_chip_is(clkdm->omap_chip))
77 return -EINVAL;
78
79 pwrdm = pwrdm_lookup(clkdm->pwrdm.name); 76 pwrdm = pwrdm_lookup(clkdm->pwrdm.name);
80 if (!pwrdm) { 77 if (!pwrdm) {
81 pr_err("clockdomain: %s: powerdomain %s does not exist\n", 78 pr_err("clockdomain: %s: powerdomain %s does not exist\n",
@@ -105,13 +102,10 @@ static struct clkdm_dep *_clkdm_deps_lookup(struct clockdomain *clkdm,
105{ 102{
106 struct clkdm_dep *cd; 103 struct clkdm_dep *cd;
107 104
108 if (!clkdm || !deps || !omap_chip_is(clkdm->omap_chip)) 105 if (!clkdm || !deps)
109 return ERR_PTR(-EINVAL); 106 return ERR_PTR(-EINVAL);
110 107
111 for (cd = deps; cd->clkdm_name; cd++) { 108 for (cd = deps; cd->clkdm_name; cd++) {
112 if (!omap_chip_is(cd->omap_chip))
113 continue;
114
115 if (!cd->clkdm && cd->clkdm_name) 109 if (!cd->clkdm && cd->clkdm_name)
116 cd->clkdm = _clkdm_lookup(cd->clkdm_name); 110 cd->clkdm = _clkdm_lookup(cd->clkdm_name);
117 111
@@ -148,9 +142,6 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
148 if (!autodep) 142 if (!autodep)
149 return; 143 return;
150 144
151 if (!omap_chip_is(autodep->omap_chip))
152 return;
153
154 clkdm = clkdm_lookup(autodep->clkdm.name); 145 clkdm = clkdm_lookup(autodep->clkdm.name);
155 if (!clkdm) { 146 if (!clkdm) {
156 pr_err("clockdomain: autodeps: clockdomain %s does not exist\n", 147 pr_err("clockdomain: autodeps: clockdomain %s does not exist\n",
@@ -182,9 +173,6 @@ void _clkdm_add_autodeps(struct clockdomain *clkdm)
182 if (IS_ERR(autodep->clkdm.ptr)) 173 if (IS_ERR(autodep->clkdm.ptr))
183 continue; 174 continue;
184 175
185 if (!omap_chip_is(autodep->omap_chip))
186 continue;
187
188 pr_debug("clockdomain: adding %s sleepdep/wkdep for " 176 pr_debug("clockdomain: adding %s sleepdep/wkdep for "
189 "clkdm %s\n", autodep->clkdm.ptr->name, 177 "clkdm %s\n", autodep->clkdm.ptr->name,
190 clkdm->name); 178 clkdm->name);
@@ -216,9 +204,6 @@ void _clkdm_del_autodeps(struct clockdomain *clkdm)
216 if (IS_ERR(autodep->clkdm.ptr)) 204 if (IS_ERR(autodep->clkdm.ptr))
217 continue; 205 continue;
218 206
219 if (!omap_chip_is(autodep->omap_chip))
220 continue;
221
222 pr_debug("clockdomain: removing %s sleepdep/wkdep for " 207 pr_debug("clockdomain: removing %s sleepdep/wkdep for "
223 "clkdm %s\n", autodep->clkdm.ptr->name, 208 "clkdm %s\n", autodep->clkdm.ptr->name,
224 clkdm->name); 209 clkdm->name);
@@ -243,8 +228,6 @@ static void _resolve_clkdm_deps(struct clockdomain *clkdm,
243 struct clkdm_dep *cd; 228 struct clkdm_dep *cd;
244 229
245 for (cd = clkdm_deps; cd && cd->clkdm_name; cd++) { 230 for (cd = clkdm_deps; cd && cd->clkdm_name; cd++) {
246 if (!omap_chip_is(cd->omap_chip))
247 continue;
248 if (cd->clkdm) 231 if (cd->clkdm)
249 continue; 232 continue;
250 cd->clkdm = _clkdm_lookup(cd->clkdm_name); 233 cd->clkdm = _clkdm_lookup(cd->clkdm_name);
@@ -257,43 +240,113 @@ static void _resolve_clkdm_deps(struct clockdomain *clkdm,
257/* Public functions */ 240/* Public functions */
258 241
259/** 242/**
260 * clkdm_init - set up the clockdomain layer 243 * clkdm_register_platform_funcs - register clockdomain implementation fns
261 * @clkdms: optional pointer to an array of clockdomains to register 244 * @co: func pointers for arch specific implementations
262 * @init_autodeps: optional pointer to an array of autodeps to register 245 *
263 * @custom_funcs: func pointers for arch specific implementations 246 * Register the list of function pointers used to implement the
264 * 247 * clockdomain functions on different OMAP SoCs. Should be called
265 * Set up internal state. If a pointer to an array of clockdomains 248 * before any other clkdm_register*() function. Returns -EINVAL if
266 * @clkdms was supplied, loop through the list of clockdomains, 249 * @co is null, -EEXIST if platform functions have already been
267 * register all that are available on the current platform. Similarly, 250 * registered, or 0 upon success.
268 * if a pointer to an array of clockdomain autodependencies 251 */
269 * @init_autodeps was provided, register those. No return value. 252int clkdm_register_platform_funcs(struct clkdm_ops *co)
253{
254 if (!co)
255 return -EINVAL;
256
257 if (arch_clkdm)
258 return -EEXIST;
259
260 arch_clkdm = co;
261
262 return 0;
263};
264
265/**
266 * clkdm_register_clkdms - register SoC clockdomains
267 * @cs: pointer to an array of struct clockdomain to register
268 *
269 * Register the clockdomains available on a particular OMAP SoC. Must
270 * be called after clkdm_register_platform_funcs(). May be called
271 * multiple times. Returns -EACCES if called before
272 * clkdm_register_platform_funcs(); -EINVAL if the argument @cs is
273 * null; or 0 upon success.
270 */ 274 */
271void clkdm_init(struct clockdomain **clkdms, 275int clkdm_register_clkdms(struct clockdomain **cs)
272 struct clkdm_autodep *init_autodeps,
273 struct clkdm_ops *custom_funcs)
274{ 276{
275 struct clockdomain **c = NULL; 277 struct clockdomain **c = NULL;
276 struct clockdomain *clkdm;
277 struct clkdm_autodep *autodep = NULL;
278 278
279 if (!custom_funcs) 279 if (!arch_clkdm)
280 WARN(1, "No custom clkdm functions registered\n"); 280 return -EACCES;
281 else 281
282 arch_clkdm = custom_funcs; 282 if (!cs)
283 return -EINVAL;
284
285 for (c = cs; *c; c++)
286 _clkdm_register(*c);
287
288 return 0;
289}
290
291/**
292 * clkdm_register_autodeps - register autodeps (if required)
293 * @ia: pointer to a static array of struct clkdm_autodep to register
294 *
295 * Register clockdomain "automatic dependencies." These are
296 * clockdomain wakeup and sleep dependencies that are automatically
297 * added whenever the first clock inside a clockdomain is enabled, and
298 * removed whenever the last clock inside a clockdomain is disabled.
299 * These are currently only used on OMAP3 devices, and are deprecated,
300 * since they waste energy. However, until the OMAP2/3 IP block
301 * enable/disable sequence can be converted to match the OMAP4
302 * sequence, they are needed.
303 *
304 * Must be called only after all of the SoC clockdomains are
305 * registered, since the function will resolve autodep clockdomain
306 * names into clockdomain pointers.
307 *
308 * The struct clkdm_autodep @ia array must be static, as this function
309 * does not copy the array elements.
310 *
311 * Returns -EACCES if called before any clockdomains have been
312 * registered, -EINVAL if called with a null @ia argument, -EEXIST if
313 * autodeps have already been registered, or 0 upon success.
314 */
315int clkdm_register_autodeps(struct clkdm_autodep *ia)
316{
317 struct clkdm_autodep *a = NULL;
283 318
284 if (clkdms) 319 if (list_empty(&clkdm_list))
285 for (c = clkdms; *c; c++) 320 return -EACCES;
286 _clkdm_register(*c); 321
322 if (!ia)
323 return -EINVAL;
287 324
288 autodeps = init_autodeps;
289 if (autodeps) 325 if (autodeps)
290 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) 326 return -EEXIST;
291 _autodep_lookup(autodep); 327
328 autodeps = ia;
329 for (a = autodeps; a->clkdm.ptr; a++)
330 _autodep_lookup(a);
331
332 return 0;
333}
334
335/**
336 * clkdm_complete_init - set up the clockdomain layer
337 *
338 * Put all clockdomains into software-supervised mode; PM code should
339 * later enable hardware-supervised mode as appropriate. Must be
340 * called after clkdm_register_clkdms(). Returns -EACCES if called
341 * before clkdm_register_clkdms(), or 0 upon success.
342 */
343int clkdm_complete_init(void)
344{
345 struct clockdomain *clkdm;
346
347 if (list_empty(&clkdm_list))
348 return -EACCES;
292 349
293 /*
294 * Put all clockdomains into software-supervised mode; PM code
295 * should later enable hardware-supervised mode as appropriate
296 */
297 list_for_each_entry(clkdm, &clkdm_list, node) { 350 list_for_each_entry(clkdm, &clkdm_list, node) {
298 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) 351 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
299 clkdm_wakeup(clkdm); 352 clkdm_wakeup(clkdm);
@@ -306,6 +359,8 @@ void clkdm_init(struct clockdomain **clkdms,
306 _resolve_clkdm_deps(clkdm, clkdm->sleepdep_srcs); 359 _resolve_clkdm_deps(clkdm, clkdm->sleepdep_srcs);
307 clkdm_clear_all_sleepdeps(clkdm); 360 clkdm_clear_all_sleepdeps(clkdm);
308 } 361 }
362
363 return 0;
309} 364}
310 365
311/** 366/**
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 1e50c88b8a07..f7b58609bad8 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -45,7 +45,6 @@
45/** 45/**
46 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode 46 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
47 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only 47 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
48 * @omap_chip: OMAP chip types that this autodep is valid on
49 * 48 *
50 * A clockdomain that should have wkdeps and sleepdeps added when a 49 * A clockdomain that should have wkdeps and sleepdeps added when a
51 * clockdomain should stay active in hwsup mode; and conversely, 50 * clockdomain should stay active in hwsup mode; and conversely,
@@ -60,14 +59,12 @@ struct clkdm_autodep {
60 const char *name; 59 const char *name;
61 struct clockdomain *ptr; 60 struct clockdomain *ptr;
62 } clkdm; 61 } clkdm;
63 const struct omap_chip_id omap_chip;
64}; 62};
65 63
66/** 64/**
67 * struct clkdm_dep - encode dependencies between clockdomains 65 * struct clkdm_dep - encode dependencies between clockdomains
68 * @clkdm_name: clockdomain name 66 * @clkdm_name: clockdomain name
69 * @clkdm: pointer to the struct clockdomain of @clkdm_name 67 * @clkdm: pointer to the struct clockdomain of @clkdm_name
70 * @omap_chip: OMAP chip types that this dependency is valid on
71 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake 68 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
72 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle 69 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
73 * 70 *
@@ -81,7 +78,6 @@ struct clkdm_dep {
81 struct clockdomain *clkdm; 78 struct clockdomain *clkdm;
82 atomic_t wkdep_usecount; 79 atomic_t wkdep_usecount;
83 atomic_t sleepdep_usecount; 80 atomic_t sleepdep_usecount;
84 const struct omap_chip_id omap_chip;
85}; 81};
86 82
87/* Possible flags for struct clockdomain._flags */ 83/* Possible flags for struct clockdomain._flags */
@@ -101,7 +97,6 @@ struct clkdm_dep {
101 * @clkdm_offs: (OMAP4 only) CM clockdomain register offset 97 * @clkdm_offs: (OMAP4 only) CM clockdomain register offset
102 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up 98 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
103 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact 99 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
104 * @omap_chip: OMAP chip types that this clockdomain is valid on
105 * @usecount: Usecount tracking 100 * @usecount: Usecount tracking
106 * @node: list_head to link all clockdomains together 101 * @node: list_head to link all clockdomains together
107 * 102 *
@@ -126,7 +121,6 @@ struct clockdomain {
126 const u16 clkdm_offs; 121 const u16 clkdm_offs;
127 struct clkdm_dep *wkdep_srcs; 122 struct clkdm_dep *wkdep_srcs;
128 struct clkdm_dep *sleepdep_srcs; 123 struct clkdm_dep *sleepdep_srcs;
129 const struct omap_chip_id omap_chip;
130 atomic_t usecount; 124 atomic_t usecount;
131 struct list_head node; 125 struct list_head node;
132 spinlock_t lock; 126 spinlock_t lock;
@@ -166,8 +160,11 @@ struct clkdm_ops {
166 int (*clkdm_clk_disable)(struct clockdomain *clkdm); 160 int (*clkdm_clk_disable)(struct clockdomain *clkdm);
167}; 161};
168 162
169void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps, 163int clkdm_register_platform_funcs(struct clkdm_ops *co);
170 struct clkdm_ops *custom_funcs); 164int clkdm_register_autodeps(struct clkdm_autodep *ia);
165int clkdm_register_clkdms(struct clockdomain **c);
166int clkdm_complete_init(void);
167
171struct clockdomain *clkdm_lookup(const char *name); 168struct clockdomain *clkdm_lookup(const char *name);
172 169
173int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), 170int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
@@ -195,7 +192,8 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
195int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh); 192int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
196int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh); 193int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
197 194
198extern void __init omap2xxx_clockdomains_init(void); 195extern void __init omap242x_clockdomains_init(void);
196extern void __init omap243x_clockdomains_init(void);
199extern void __init omap3xxx_clockdomains_init(void); 197extern void __init omap3xxx_clockdomains_init(void);
200extern void __init omap44xx_clockdomains_init(void); 198extern void __init omap44xx_clockdomains_init(void);
201extern void _clkdm_add_autodeps(struct clockdomain *clkdm); 199extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
@@ -205,4 +203,10 @@ extern struct clkdm_ops omap2_clkdm_operations;
205extern struct clkdm_ops omap3_clkdm_operations; 203extern struct clkdm_ops omap3_clkdm_operations;
206extern struct clkdm_ops omap4_clkdm_operations; 204extern struct clkdm_ops omap4_clkdm_operations;
207 205
206extern struct clkdm_dep gfx_24xx_wkdeps[];
207extern struct clkdm_dep dsp_24xx_wkdeps[];
208extern struct clockdomain wkup_common_clkdm;
209extern struct clockdomain prm_common_clkdm;
210extern struct clockdomain cm_common_clkdm;
211
208#endif 212#endif
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index f740edb111f4..a0d68dbecfa3 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -52,8 +52,6 @@ static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
52 u32 mask = 0; 52 u32 mask = 0;
53 53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { 54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!omap_chip_is(cd->omap_chip))
56 continue;
57 if (!cd->clkdm) 55 if (!cd->clkdm)
58 continue; /* only happens if data is erroneous */ 56 continue; /* only happens if data is erroneous */
59 57
@@ -98,8 +96,6 @@ static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
98 u32 mask = 0; 96 u32 mask = 0;
99 97
100 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) { 98 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
101 if (!omap_chip_is(cd->omap_chip))
102 continue;
103 if (!cd->clkdm) 99 if (!cd->clkdm)
104 continue; /* only happens if data is erroneous */ 100 continue; /* only happens if data is erroneous */
105 101
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
index b43706aa08bd..935c7f03dab9 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -52,8 +52,6 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
52 u32 mask = 0; 52 u32 mask = 0;
53 53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { 54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!omap_chip_is(cd->omap_chip))
56 continue;
57 if (!cd->clkdm) 55 if (!cd->clkdm)
58 continue; /* only happens if data is erroneous */ 56 continue; /* only happens if data is erroneous */
59 57
diff --git a/arch/arm/mach-omap2/clockdomains2420_data.c b/arch/arm/mach-omap2/clockdomains2420_data.c
new file mode 100644
index 000000000000..0ab8e46d5b2b
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains2420_data.c
@@ -0,0 +1,154 @@
1/*
2 * OMAP2420 clockdomains
3 *
4 * Copyright (C) 2008-2011 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Paul Walmsley, Jouni Högander
8 *
9 * This file contains clockdomains and clockdomain wakeup dependencies
10 * for OMAP2420 chips. Some notes:
11 *
12 * A useful validation rule for struct clockdomain: Any clockdomain
13 * referenced by a wkdep_srcs must have a dep_bit assigned. So
14 * wkdep_srcs are really just software-controllable dependencies.
15 * Non-software-controllable dependencies do exist, but they are not
16 * encoded below (yet).
17 *
18 * 24xx does not support programmable sleep dependencies (SLEEPDEP)
19 *
20 * The overly-specific dep_bit names are due to a bit name collision
21 * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
22 * value are the same for all powerdomains: 2
23 *
24 * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
25 * sanity check?
26 * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
27 */
28
29/*
30 * To-Do List
31 * -> Port the Sleep/Wakeup dependencies for the domains
32 * from the Power domain framework
33 */
34
35#include <linux/kernel.h>
36#include <linux/io.h>
37
38#include "clockdomain.h"
39#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h"
41#include "cm-regbits-24xx.h"
42#include "prm-regbits-24xx.h"
43
44/*
45 * Clockdomain dependencies for wkdeps
46 *
47 * XXX Hardware dependencies (e.g., dependencies that cannot be
48 * changed in software) are not included here yet, but should be.
49 */
50
51/* Wakeup dependency source arrays */
52
53/* 2420-specific possible wakeup dependencies */
54
55/* 2420 PM_WKDEP_MPU: CORE, DSP, WKUP */
56static struct clkdm_dep mpu_2420_wkdeps[] = {
57 { .clkdm_name = "core_l3_clkdm" },
58 { .clkdm_name = "core_l4_clkdm" },
59 { .clkdm_name = "dsp_clkdm" },
60 { .clkdm_name = "wkup_clkdm" },
61 { NULL },
62};
63
64/* 2420 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP */
65static struct clkdm_dep core_2420_wkdeps[] = {
66 { .clkdm_name = "dsp_clkdm" },
67 { .clkdm_name = "gfx_clkdm" },
68 { .clkdm_name = "mpu_clkdm" },
69 { .clkdm_name = "wkup_clkdm" },
70 { NULL },
71};
72
73/*
74 * 2420-only clockdomains
75 */
76
77static struct clockdomain mpu_2420_clkdm = {
78 .name = "mpu_clkdm",
79 .pwrdm = { .name = "mpu_pwrdm" },
80 .flags = CLKDM_CAN_HWSUP,
81 .wkdep_srcs = mpu_2420_wkdeps,
82 .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
83};
84
85static struct clockdomain iva1_2420_clkdm = {
86 .name = "iva1_clkdm",
87 .pwrdm = { .name = "dsp_pwrdm" },
88 .flags = CLKDM_CAN_HWSUP_SWSUP,
89 .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
90 .wkdep_srcs = dsp_24xx_wkdeps,
91 .clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
92};
93
94static struct clockdomain dsp_2420_clkdm = {
95 .name = "dsp_clkdm",
96 .pwrdm = { .name = "dsp_pwrdm" },
97 .flags = CLKDM_CAN_HWSUP_SWSUP,
98 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
99};
100
101static struct clockdomain gfx_2420_clkdm = {
102 .name = "gfx_clkdm",
103 .pwrdm = { .name = "gfx_pwrdm" },
104 .flags = CLKDM_CAN_HWSUP_SWSUP,
105 .wkdep_srcs = gfx_24xx_wkdeps,
106 .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
107};
108
109static struct clockdomain core_l3_2420_clkdm = {
110 .name = "core_l3_clkdm",
111 .pwrdm = { .name = "core_pwrdm" },
112 .flags = CLKDM_CAN_HWSUP,
113 .wkdep_srcs = core_2420_wkdeps,
114 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
115};
116
117static struct clockdomain core_l4_2420_clkdm = {
118 .name = "core_l4_clkdm",
119 .pwrdm = { .name = "core_pwrdm" },
120 .flags = CLKDM_CAN_HWSUP,
121 .wkdep_srcs = core_2420_wkdeps,
122 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
123};
124
125static struct clockdomain dss_2420_clkdm = {
126 .name = "dss_clkdm",
127 .pwrdm = { .name = "core_pwrdm" },
128 .flags = CLKDM_CAN_HWSUP,
129 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
130};
131
132static struct clockdomain *clockdomains_omap242x[] __initdata = {
133 &wkup_common_clkdm,
134 &cm_common_clkdm,
135 &prm_common_clkdm,
136 &mpu_2420_clkdm,
137 &iva1_2420_clkdm,
138 &dsp_2420_clkdm,
139 &gfx_2420_clkdm,
140 &core_l3_2420_clkdm,
141 &core_l4_2420_clkdm,
142 &dss_2420_clkdm,
143 NULL,
144};
145
146void __init omap242x_clockdomains_init(void)
147{
148 if (!cpu_is_omap242x())
149 return;
150
151 clkdm_register_platform_funcs(&omap2_clkdm_operations);
152 clkdm_register_clkdms(clockdomains_omap242x);
153 clkdm_complete_init();
154}
diff --git a/arch/arm/mach-omap2/clockdomains2430_data.c b/arch/arm/mach-omap2/clockdomains2430_data.c
new file mode 100644
index 000000000000..3645ed044890
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains2430_data.c
@@ -0,0 +1,181 @@
1/*
2 * OMAP2xxx clockdomains
3 *
4 * Copyright (C) 2008-2009 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Paul Walmsley, Jouni Högander
8 *
9 * This file contains clockdomains and clockdomain wakeup dependencies
10 * for OMAP2xxx chips. Some notes:
11 *
12 * A useful validation rule for struct clockdomain: Any clockdomain
13 * referenced by a wkdep_srcs must have a dep_bit assigned. So
14 * wkdep_srcs are really just software-controllable dependencies.
15 * Non-software-controllable dependencies do exist, but they are not
16 * encoded below (yet).
17 *
18 * 24xx does not support programmable sleep dependencies (SLEEPDEP)
19 *
20 * The overly-specific dep_bit names are due to a bit name collision
21 * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
22 * value are the same for all powerdomains: 2
23 *
24 * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
25 * sanity check?
26 * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
27 */
28
29/*
30 * To-Do List
31 * -> Port the Sleep/Wakeup dependencies for the domains
32 * from the Power domain framework
33 */
34
35#include <linux/kernel.h>
36#include <linux/io.h>
37
38#include "clockdomain.h"
39#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h"
41#include "cm-regbits-24xx.h"
42#include "prm-regbits-24xx.h"
43
44/*
45 * Clockdomain dependencies for wkdeps
46 *
47 * XXX Hardware dependencies (e.g., dependencies that cannot be
48 * changed in software) are not included here yet, but should be.
49 */
50
51/* Wakeup dependency source arrays */
52
53/* 2430-specific possible wakeup dependencies */
54
55/* 2430 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP, MDM */
56static struct clkdm_dep core_2430_wkdeps[] = {
57 { .clkdm_name = "dsp_clkdm" },
58 { .clkdm_name = "gfx_clkdm" },
59 { .clkdm_name = "mpu_clkdm" },
60 { .clkdm_name = "wkup_clkdm" },
61 { .clkdm_name = "mdm_clkdm" },
62 { NULL },
63};
64
65/* 2430 PM_WKDEP_MPU: CORE, DSP, WKUP, MDM */
66static struct clkdm_dep mpu_2430_wkdeps[] = {
67 { .clkdm_name = "core_l3_clkdm" },
68 { .clkdm_name = "core_l4_clkdm" },
69 { .clkdm_name = "dsp_clkdm" },
70 { .clkdm_name = "wkup_clkdm" },
71 { .clkdm_name = "mdm_clkdm" },
72 { NULL },
73};
74
75/* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */
76static struct clkdm_dep mdm_2430_wkdeps[] = {
77 { .clkdm_name = "core_l3_clkdm" },
78 { .clkdm_name = "core_l4_clkdm" },
79 { .clkdm_name = "mpu_clkdm" },
80 { .clkdm_name = "wkup_clkdm" },
81 { NULL },
82};
83
84/*
85 * 2430-only clockdomains
86 */
87
88static struct clockdomain mpu_2430_clkdm = {
89 .name = "mpu_clkdm",
90 .pwrdm = { .name = "mpu_pwrdm" },
91 .flags = CLKDM_CAN_HWSUP_SWSUP,
92 .wkdep_srcs = mpu_2430_wkdeps,
93 .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
94};
95
96/* Another case of bit name collisions between several registers: EN_MDM */
97static struct clockdomain mdm_clkdm = {
98 .name = "mdm_clkdm",
99 .pwrdm = { .name = "mdm_pwrdm" },
100 .flags = CLKDM_CAN_HWSUP_SWSUP,
101 .dep_bit = OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
102 .wkdep_srcs = mdm_2430_wkdeps,
103 .clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
104};
105
106static struct clockdomain dsp_2430_clkdm = {
107 .name = "dsp_clkdm",
108 .pwrdm = { .name = "dsp_pwrdm" },
109 .flags = CLKDM_CAN_HWSUP_SWSUP,
110 .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
111 .wkdep_srcs = dsp_24xx_wkdeps,
112 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
113};
114
115static struct clockdomain gfx_2430_clkdm = {
116 .name = "gfx_clkdm",
117 .pwrdm = { .name = "gfx_pwrdm" },
118 .flags = CLKDM_CAN_HWSUP_SWSUP,
119 .wkdep_srcs = gfx_24xx_wkdeps,
120 .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
121};
122
123/*
124 * XXX add usecounting for clkdm dependencies, otherwise the presence
125 * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
126 * could cause trouble
127 */
128static struct clockdomain core_l3_2430_clkdm = {
129 .name = "core_l3_clkdm",
130 .pwrdm = { .name = "core_pwrdm" },
131 .flags = CLKDM_CAN_HWSUP,
132 .dep_bit = OMAP24XX_EN_CORE_SHIFT,
133 .wkdep_srcs = core_2430_wkdeps,
134 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
135};
136
137/*
138 * XXX add usecounting for clkdm dependencies, otherwise the presence
139 * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
140 * could cause trouble
141 */
142static struct clockdomain core_l4_2430_clkdm = {
143 .name = "core_l4_clkdm",
144 .pwrdm = { .name = "core_pwrdm" },
145 .flags = CLKDM_CAN_HWSUP,
146 .dep_bit = OMAP24XX_EN_CORE_SHIFT,
147 .wkdep_srcs = core_2430_wkdeps,
148 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
149};
150
151static struct clockdomain dss_2430_clkdm = {
152 .name = "dss_clkdm",
153 .pwrdm = { .name = "core_pwrdm" },
154 .flags = CLKDM_CAN_HWSUP,
155 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
156};
157
158static struct clockdomain *clockdomains_omap243x[] __initdata = {
159 &wkup_common_clkdm,
160 &cm_common_clkdm,
161 &prm_common_clkdm,
162 &mpu_2430_clkdm,
163 &mdm_clkdm,
164 &dsp_2430_clkdm,
165 &gfx_2430_clkdm,
166 &core_l3_2430_clkdm,
167 &core_l4_2430_clkdm,
168 &dss_2430_clkdm,
169 NULL,
170};
171
172void __init omap243x_clockdomains_init(void)
173{
174 if (!cpu_is_omap243x())
175 return;
176
177 clkdm_register_platform_funcs(&omap2_clkdm_operations);
178 clkdm_register_clkdms(clockdomains_omap243x);
179 clkdm_complete_init();
180}
181
diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index 13bde95b6790..0a6a04897d89 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 clockdomains 2 * OMAP2/3 clockdomain common data
3 * 3 *
4 * Copyright (C) 2008-2009 Texas Instruments, Inc. 4 * Copyright (C) 2008-2011 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
@@ -51,374 +51,28 @@
51 * changed in software) are not included here yet, but should be. 51 * changed in software) are not included here yet, but should be.
52 */ 52 */
53 53
54/* OMAP2/3-common wakeup dependencies */
55
56/*
57 * 2420/2430 PM_WKDEP_GFX: CORE, MPU, WKUP
58 * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
59 * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
60 * These can share data since they will never be present simultaneously
61 * on the same device.
62 */
63static struct clkdm_dep gfx_sgx_wkdeps[] = {
64 {
65 .clkdm_name = "core_l3_clkdm",
66 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
67 },
68 {
69 .clkdm_name = "core_l4_clkdm",
70 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
71 },
72 {
73 .clkdm_name = "iva2_clkdm",
74 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
75 },
76 {
77 .clkdm_name = "mpu_clkdm",
78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
79 CHIP_IS_OMAP3430)
80 },
81 {
82 .clkdm_name = "wkup_clkdm",
83 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
84 CHIP_IS_OMAP3430)
85 },
86 { NULL },
87};
88
89
90/* 24XX-specific possible dependencies */
91
92#ifdef CONFIG_ARCH_OMAP2
93
94/* Wakeup dependency source arrays */ 54/* Wakeup dependency source arrays */
95 55
96/* 2420/2430 PM_WKDEP_DSP: CORE, MPU, WKUP */ 56/* 2xxx-specific possible dependencies */
97static struct clkdm_dep dsp_24xx_wkdeps[] = {
98 {
99 .clkdm_name = "core_l3_clkdm",
100 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
101 },
102 {
103 .clkdm_name = "core_l4_clkdm",
104 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
105 },
106 {
107 .clkdm_name = "mpu_clkdm",
108 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
109 },
110 {
111 .clkdm_name = "wkup_clkdm",
112 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
113 },
114 { NULL },
115};
116
117/*
118 * 2420 PM_WKDEP_MPU: CORE, DSP, WKUP
119 * 2430 adds MDM
120 */
121static struct clkdm_dep mpu_24xx_wkdeps[] = {
122 {
123 .clkdm_name = "core_l3_clkdm",
124 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
125 },
126 {
127 .clkdm_name = "core_l4_clkdm",
128 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
129 },
130 {
131 .clkdm_name = "dsp_clkdm",
132 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
133 },
134 {
135 .clkdm_name = "wkup_clkdm",
136 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
137 },
138 {
139 .clkdm_name = "mdm_clkdm",
140 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
141 },
142 { NULL },
143};
144
145/*
146 * 2420 PM_WKDEP_CORE: DSP, GFX, MPU, WKUP
147 * 2430 adds MDM
148 */
149static struct clkdm_dep core_24xx_wkdeps[] = {
150 {
151 .clkdm_name = "dsp_clkdm",
152 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
153 },
154 {
155 .clkdm_name = "gfx_clkdm",
156 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
157 },
158 {
159 .clkdm_name = "mpu_clkdm",
160 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
161 },
162 {
163 .clkdm_name = "wkup_clkdm",
164 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
165 },
166 {
167 .clkdm_name = "mdm_clkdm",
168 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
169 },
170 { NULL },
171};
172
173#endif /* CONFIG_ARCH_OMAP2 */
174
175/* 2430-specific possible wakeup dependencies */
176 57
177#ifdef CONFIG_SOC_OMAP2430 58/* 2xxx PM_WKDEP_GFX: CORE, MPU, WKUP */
178 59struct clkdm_dep gfx_24xx_wkdeps[] = {
179/* 2430 PM_WKDEP_MDM: CORE, MPU, WKUP */ 60 { .clkdm_name = "core_l3_clkdm" },
180static struct clkdm_dep mdm_2430_wkdeps[] = { 61 { .clkdm_name = "core_l4_clkdm" },
181 { 62 { .clkdm_name = "mpu_clkdm" },
182 .clkdm_name = "core_l3_clkdm", 63 { .clkdm_name = "wkup_clkdm" },
183 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
184 },
185 {
186 .clkdm_name = "core_l4_clkdm",
187 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
188 },
189 {
190 .clkdm_name = "mpu_clkdm",
191 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
192 },
193 {
194 .clkdm_name = "wkup_clkdm",
195 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX)
196 },
197 { NULL },
198};
199
200#endif /* CONFIG_SOC_OMAP2430 */
201
202
203/* OMAP3-specific possible dependencies */
204
205#ifdef CONFIG_ARCH_OMAP3
206
207/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
208static struct clkdm_dep per_wkdeps[] = {
209 {
210 .clkdm_name = "core_l3_clkdm",
211 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
212 },
213 {
214 .clkdm_name = "core_l4_clkdm",
215 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
216 },
217 {
218 .clkdm_name = "iva2_clkdm",
219 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
220 },
221 {
222 .clkdm_name = "mpu_clkdm",
223 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
224 },
225 {
226 .clkdm_name = "wkup_clkdm",
227 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
228 },
229 { NULL },
230};
231
232/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
233static struct clkdm_dep usbhost_wkdeps[] = {
234 {
235 .clkdm_name = "core_l3_clkdm",
236 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
237 },
238 {
239 .clkdm_name = "core_l4_clkdm",
240 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
241 },
242 {
243 .clkdm_name = "iva2_clkdm",
244 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
245 },
246 {
247 .clkdm_name = "mpu_clkdm",
248 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
249 },
250 {
251 .clkdm_name = "wkup_clkdm",
252 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
253 },
254 { NULL }, 64 { NULL },
255}; 65};
256 66
257/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */ 67/* 2xxx PM_WKDEP_DSP: CORE, MPU, WKUP */
258static struct clkdm_dep mpu_3xxx_wkdeps[] = { 68struct clkdm_dep dsp_24xx_wkdeps[] = {
259 { 69 { .clkdm_name = "core_l3_clkdm" },
260 .clkdm_name = "core_l3_clkdm", 70 { .clkdm_name = "core_l4_clkdm" },
261 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) 71 { .clkdm_name = "mpu_clkdm" },
262 }, 72 { .clkdm_name = "wkup_clkdm" },
263 {
264 .clkdm_name = "core_l4_clkdm",
265 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
266 },
267 {
268 .clkdm_name = "iva2_clkdm",
269 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
270 },
271 {
272 .clkdm_name = "dss_clkdm",
273 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
274 },
275 {
276 .clkdm_name = "per_clkdm",
277 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
278 },
279 { NULL }, 73 { NULL },
280}; 74};
281 75
282/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
283static struct clkdm_dep iva2_wkdeps[] = {
284 {
285 .clkdm_name = "core_l3_clkdm",
286 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
287 },
288 {
289 .clkdm_name = "core_l4_clkdm",
290 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
291 },
292 {
293 .clkdm_name = "mpu_clkdm",
294 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
295 },
296 {
297 .clkdm_name = "wkup_clkdm",
298 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
299 },
300 {
301 .clkdm_name = "dss_clkdm",
302 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
303 },
304 {
305 .clkdm_name = "per_clkdm",
306 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
307 },
308 { NULL },
309};
310
311
312/* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
313static struct clkdm_dep cam_wkdeps[] = {
314 {
315 .clkdm_name = "iva2_clkdm",
316 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
317 },
318 {
319 .clkdm_name = "mpu_clkdm",
320 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
321 },
322 {
323 .clkdm_name = "wkup_clkdm",
324 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
325 },
326 { NULL },
327};
328
329/* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
330static struct clkdm_dep dss_wkdeps[] = {
331 {
332 .clkdm_name = "iva2_clkdm",
333 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
334 },
335 {
336 .clkdm_name = "mpu_clkdm",
337 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
338 },
339 {
340 .clkdm_name = "wkup_clkdm",
341 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
342 },
343 { NULL },
344};
345
346/* 3430: PM_WKDEP_NEON: MPU */
347static struct clkdm_dep neon_wkdeps[] = {
348 {
349 .clkdm_name = "mpu_clkdm",
350 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
351 },
352 { NULL },
353};
354
355
356/* Sleep dependency source arrays for OMAP3-specific clkdms */
357
358/* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
359static struct clkdm_dep dss_sleepdeps[] = {
360 {
361 .clkdm_name = "mpu_clkdm",
362 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
363 },
364 {
365 .clkdm_name = "iva2_clkdm",
366 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
367 },
368 { NULL },
369};
370
371/* 3430: CM_SLEEPDEP_PER: MPU, IVA */
372static struct clkdm_dep per_sleepdeps[] = {
373 {
374 .clkdm_name = "mpu_clkdm",
375 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
376 },
377 {
378 .clkdm_name = "iva2_clkdm",
379 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
380 },
381 { NULL },
382};
383
384/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
385static struct clkdm_dep usbhost_sleepdeps[] = {
386 {
387 .clkdm_name = "mpu_clkdm",
388 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
389 },
390 {
391 .clkdm_name = "iva2_clkdm",
392 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
393 },
394 { NULL },
395};
396
397/* 3430: CM_SLEEPDEP_CAM: MPU */
398static struct clkdm_dep cam_sleepdeps[] = {
399 {
400 .clkdm_name = "mpu_clkdm",
401 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
402 },
403 { NULL },
404};
405
406/*
407 * 3430ES1: CM_SLEEPDEP_GFX: MPU
408 * 3430ES2: CM_SLEEPDEP_SGX: MPU
409 * These can share data since they will never be present simultaneously
410 * on the same device.
411 */
412static struct clkdm_dep gfx_sgx_sleepdeps[] = {
413 {
414 .clkdm_name = "mpu_clkdm",
415 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
416 },
417 { NULL },
418};
419
420#endif /* CONFIG_ARCH_OMAP3 */
421
422 76
423/* 77/*
424 * OMAP2/3-common clockdomains 78 * OMAP2/3-common clockdomains
@@ -430,439 +84,18 @@ static struct clkdm_dep gfx_sgx_sleepdeps[] = {
430 */ 84 */
431 85
432/* This is an implicit clockdomain - it is never defined as such in TRM */ 86/* This is an implicit clockdomain - it is never defined as such in TRM */
433static struct clockdomain wkup_clkdm = { 87struct clockdomain wkup_common_clkdm = {
434 .name = "wkup_clkdm", 88 .name = "wkup_clkdm",
435 .pwrdm = { .name = "wkup_pwrdm" }, 89 .pwrdm = { .name = "wkup_pwrdm" },
436 .dep_bit = OMAP_EN_WKUP_SHIFT, 90 .dep_bit = OMAP_EN_WKUP_SHIFT,
437 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
438}; 91};
439 92
440static struct clockdomain prm_clkdm = { 93struct clockdomain prm_common_clkdm = {
441 .name = "prm_clkdm", 94 .name = "prm_clkdm",
442 .pwrdm = { .name = "wkup_pwrdm" }, 95 .pwrdm = { .name = "wkup_pwrdm" },
443 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
444}; 96};
445 97
446static struct clockdomain cm_clkdm = { 98struct clockdomain cm_common_clkdm = {
447 .name = "cm_clkdm", 99 .name = "cm_clkdm",
448 .pwrdm = { .name = "core_pwrdm" }, 100 .pwrdm = { .name = "core_pwrdm" },
449 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
450}; 101};
451
452/*
453 * 2420-only clockdomains
454 */
455
456#if defined(CONFIG_SOC_OMAP2420)
457
458static struct clockdomain mpu_2420_clkdm = {
459 .name = "mpu_clkdm",
460 .pwrdm = { .name = "mpu_pwrdm" },
461 .flags = CLKDM_CAN_HWSUP,
462 .wkdep_srcs = mpu_24xx_wkdeps,
463 .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
464 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
465};
466
467static struct clockdomain iva1_2420_clkdm = {
468 .name = "iva1_clkdm",
469 .pwrdm = { .name = "dsp_pwrdm" },
470 .flags = CLKDM_CAN_HWSUP_SWSUP,
471 .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
472 .wkdep_srcs = dsp_24xx_wkdeps,
473 .clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
474 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
475};
476
477static struct clockdomain dsp_2420_clkdm = {
478 .name = "dsp_clkdm",
479 .pwrdm = { .name = "dsp_pwrdm" },
480 .flags = CLKDM_CAN_HWSUP_SWSUP,
481 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
482 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
483};
484
485static struct clockdomain gfx_2420_clkdm = {
486 .name = "gfx_clkdm",
487 .pwrdm = { .name = "gfx_pwrdm" },
488 .flags = CLKDM_CAN_HWSUP_SWSUP,
489 .wkdep_srcs = gfx_sgx_wkdeps,
490 .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
491 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
492};
493
494static struct clockdomain core_l3_2420_clkdm = {
495 .name = "core_l3_clkdm",
496 .pwrdm = { .name = "core_pwrdm" },
497 .flags = CLKDM_CAN_HWSUP,
498 .wkdep_srcs = core_24xx_wkdeps,
499 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
500 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
501};
502
503static struct clockdomain core_l4_2420_clkdm = {
504 .name = "core_l4_clkdm",
505 .pwrdm = { .name = "core_pwrdm" },
506 .flags = CLKDM_CAN_HWSUP,
507 .wkdep_srcs = core_24xx_wkdeps,
508 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
509 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
510};
511
512static struct clockdomain dss_2420_clkdm = {
513 .name = "dss_clkdm",
514 .pwrdm = { .name = "core_pwrdm" },
515 .flags = CLKDM_CAN_HWSUP,
516 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
517 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
518};
519
520#endif /* CONFIG_SOC_OMAP2420 */
521
522
523/*
524 * 2430-only clockdomains
525 */
526
527#if defined(CONFIG_SOC_OMAP2430)
528
529static struct clockdomain mpu_2430_clkdm = {
530 .name = "mpu_clkdm",
531 .pwrdm = { .name = "mpu_pwrdm" },
532 .flags = CLKDM_CAN_HWSUP_SWSUP,
533 .wkdep_srcs = mpu_24xx_wkdeps,
534 .clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
535 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
536};
537
538/* Another case of bit name collisions between several registers: EN_MDM */
539static struct clockdomain mdm_clkdm = {
540 .name = "mdm_clkdm",
541 .pwrdm = { .name = "mdm_pwrdm" },
542 .flags = CLKDM_CAN_HWSUP_SWSUP,
543 .dep_bit = OMAP2430_PM_WKDEP_MPU_EN_MDM_SHIFT,
544 .wkdep_srcs = mdm_2430_wkdeps,
545 .clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
546 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
547};
548
549static struct clockdomain dsp_2430_clkdm = {
550 .name = "dsp_clkdm",
551 .pwrdm = { .name = "dsp_pwrdm" },
552 .flags = CLKDM_CAN_HWSUP_SWSUP,
553 .dep_bit = OMAP24XX_PM_WKDEP_MPU_EN_DSP_SHIFT,
554 .wkdep_srcs = dsp_24xx_wkdeps,
555 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
556 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
557};
558
559static struct clockdomain gfx_2430_clkdm = {
560 .name = "gfx_clkdm",
561 .pwrdm = { .name = "gfx_pwrdm" },
562 .flags = CLKDM_CAN_HWSUP_SWSUP,
563 .wkdep_srcs = gfx_sgx_wkdeps,
564 .clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
565 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
566};
567
568/*
569 * XXX add usecounting for clkdm dependencies, otherwise the presence
570 * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
571 * could cause trouble
572 */
573static struct clockdomain core_l3_2430_clkdm = {
574 .name = "core_l3_clkdm",
575 .pwrdm = { .name = "core_pwrdm" },
576 .flags = CLKDM_CAN_HWSUP,
577 .dep_bit = OMAP24XX_EN_CORE_SHIFT,
578 .wkdep_srcs = core_24xx_wkdeps,
579 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
580 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
581};
582
583/*
584 * XXX add usecounting for clkdm dependencies, otherwise the presence
585 * of a single dep bit for core_l3_24xx_clkdm and core_l4_24xx_clkdm
586 * could cause trouble
587 */
588static struct clockdomain core_l4_2430_clkdm = {
589 .name = "core_l4_clkdm",
590 .pwrdm = { .name = "core_pwrdm" },
591 .flags = CLKDM_CAN_HWSUP,
592 .dep_bit = OMAP24XX_EN_CORE_SHIFT,
593 .wkdep_srcs = core_24xx_wkdeps,
594 .clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
595 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
596};
597
598static struct clockdomain dss_2430_clkdm = {
599 .name = "dss_clkdm",
600 .pwrdm = { .name = "core_pwrdm" },
601 .flags = CLKDM_CAN_HWSUP,
602 .clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
603 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
604};
605
606#endif /* CONFIG_SOC_OMAP2430 */
607
608
609/*
610 * OMAP3 clockdomains
611 */
612
613#if defined(CONFIG_ARCH_OMAP3)
614
615static struct clockdomain mpu_3xxx_clkdm = {
616 .name = "mpu_clkdm",
617 .pwrdm = { .name = "mpu_pwrdm" },
618 .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
619 .dep_bit = OMAP3430_EN_MPU_SHIFT,
620 .wkdep_srcs = mpu_3xxx_wkdeps,
621 .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
622 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
623};
624
625static struct clockdomain neon_clkdm = {
626 .name = "neon_clkdm",
627 .pwrdm = { .name = "neon_pwrdm" },
628 .flags = CLKDM_CAN_HWSUP_SWSUP,
629 .wkdep_srcs = neon_wkdeps,
630 .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
631 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
632};
633
634static struct clockdomain iva2_clkdm = {
635 .name = "iva2_clkdm",
636 .pwrdm = { .name = "iva2_pwrdm" },
637 .flags = CLKDM_CAN_HWSUP_SWSUP,
638 .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
639 .wkdep_srcs = iva2_wkdeps,
640 .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
641 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
642};
643
644static struct clockdomain gfx_3430es1_clkdm = {
645 .name = "gfx_clkdm",
646 .pwrdm = { .name = "gfx_pwrdm" },
647 .flags = CLKDM_CAN_HWSUP_SWSUP,
648 .wkdep_srcs = gfx_sgx_wkdeps,
649 .sleepdep_srcs = gfx_sgx_sleepdeps,
650 .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
651 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
652};
653
654static struct clockdomain sgx_clkdm = {
655 .name = "sgx_clkdm",
656 .pwrdm = { .name = "sgx_pwrdm" },
657 .flags = CLKDM_CAN_HWSUP_SWSUP,
658 .wkdep_srcs = gfx_sgx_wkdeps,
659 .sleepdep_srcs = gfx_sgx_sleepdeps,
660 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
661 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
662};
663
664/*
665 * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
666 * then that information was removed from the 34xx ES2+ TRM. It is
667 * unclear whether the core is still there, but the clockdomain logic
668 * is there, and must be programmed to an appropriate state if the
669 * CORE clockdomain is to become inactive.
670 */
671static struct clockdomain d2d_clkdm = {
672 .name = "d2d_clkdm",
673 .pwrdm = { .name = "core_pwrdm" },
674 .flags = CLKDM_CAN_HWSUP_SWSUP,
675 .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
676 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
677};
678
679/*
680 * XXX add usecounting for clkdm dependencies, otherwise the presence
681 * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
682 * could cause trouble
683 */
684static struct clockdomain core_l3_3xxx_clkdm = {
685 .name = "core_l3_clkdm",
686 .pwrdm = { .name = "core_pwrdm" },
687 .flags = CLKDM_CAN_HWSUP,
688 .dep_bit = OMAP3430_EN_CORE_SHIFT,
689 .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
690 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
691};
692
693/*
694 * XXX add usecounting for clkdm dependencies, otherwise the presence
695 * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
696 * could cause trouble
697 */
698static struct clockdomain core_l4_3xxx_clkdm = {
699 .name = "core_l4_clkdm",
700 .pwrdm = { .name = "core_pwrdm" },
701 .flags = CLKDM_CAN_HWSUP,
702 .dep_bit = OMAP3430_EN_CORE_SHIFT,
703 .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
704 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
705};
706
707/* Another case of bit name collisions between several registers: EN_DSS */
708static struct clockdomain dss_3xxx_clkdm = {
709 .name = "dss_clkdm",
710 .pwrdm = { .name = "dss_pwrdm" },
711 .flags = CLKDM_CAN_HWSUP_SWSUP,
712 .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
713 .wkdep_srcs = dss_wkdeps,
714 .sleepdep_srcs = dss_sleepdeps,
715 .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
716 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
717};
718
719static struct clockdomain cam_clkdm = {
720 .name = "cam_clkdm",
721 .pwrdm = { .name = "cam_pwrdm" },
722 .flags = CLKDM_CAN_HWSUP_SWSUP,
723 .wkdep_srcs = cam_wkdeps,
724 .sleepdep_srcs = cam_sleepdeps,
725 .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
726 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
727};
728
729static struct clockdomain usbhost_clkdm = {
730 .name = "usbhost_clkdm",
731 .pwrdm = { .name = "usbhost_pwrdm" },
732 .flags = CLKDM_CAN_HWSUP_SWSUP,
733 .wkdep_srcs = usbhost_wkdeps,
734 .sleepdep_srcs = usbhost_sleepdeps,
735 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
736 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
737};
738
739static struct clockdomain per_clkdm = {
740 .name = "per_clkdm",
741 .pwrdm = { .name = "per_pwrdm" },
742 .flags = CLKDM_CAN_HWSUP_SWSUP,
743 .dep_bit = OMAP3430_EN_PER_SHIFT,
744 .wkdep_srcs = per_wkdeps,
745 .sleepdep_srcs = per_sleepdeps,
746 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
747 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
748};
749
750/*
751 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
752 * switched of even if sdti is in use
753 */
754static struct clockdomain emu_clkdm = {
755 .name = "emu_clkdm",
756 .pwrdm = { .name = "emu_pwrdm" },
757 .flags = /* CLKDM_CAN_ENABLE_AUTO | */CLKDM_CAN_SWSUP,
758 .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
759 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
760};
761
762static struct clockdomain dpll1_clkdm = {
763 .name = "dpll1_clkdm",
764 .pwrdm = { .name = "dpll1_pwrdm" },
765 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
766};
767
768static struct clockdomain dpll2_clkdm = {
769 .name = "dpll2_clkdm",
770 .pwrdm = { .name = "dpll2_pwrdm" },
771 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
772};
773
774static struct clockdomain dpll3_clkdm = {
775 .name = "dpll3_clkdm",
776 .pwrdm = { .name = "dpll3_pwrdm" },
777 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
778};
779
780static struct clockdomain dpll4_clkdm = {
781 .name = "dpll4_clkdm",
782 .pwrdm = { .name = "dpll4_pwrdm" },
783 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
784};
785
786static struct clockdomain dpll5_clkdm = {
787 .name = "dpll5_clkdm",
788 .pwrdm = { .name = "dpll5_pwrdm" },
789 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
790};
791
792#endif /* CONFIG_ARCH_OMAP3 */
793
794/*
795 * Clockdomain hwsup dependencies (OMAP3 only)
796 */
797
798static struct clkdm_autodep clkdm_autodeps[] = {
799 {
800 .clkdm = { .name = "mpu_clkdm" },
801 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
802 },
803 {
804 .clkdm = { .name = "iva2_clkdm" },
805 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
806 },
807 {
808 .clkdm = { .name = NULL },
809 }
810};
811
812static struct clockdomain *clockdomains_omap2[] __initdata = {
813 &wkup_clkdm,
814 &cm_clkdm,
815 &prm_clkdm,
816
817#ifdef CONFIG_SOC_OMAP2420
818 &mpu_2420_clkdm,
819 &iva1_2420_clkdm,
820 &dsp_2420_clkdm,
821 &gfx_2420_clkdm,
822 &core_l3_2420_clkdm,
823 &core_l4_2420_clkdm,
824 &dss_2420_clkdm,
825#endif
826
827#ifdef CONFIG_SOC_OMAP2430
828 &mpu_2430_clkdm,
829 &mdm_clkdm,
830 &dsp_2430_clkdm,
831 &gfx_2430_clkdm,
832 &core_l3_2430_clkdm,
833 &core_l4_2430_clkdm,
834 &dss_2430_clkdm,
835#endif
836
837#ifdef CONFIG_ARCH_OMAP3
838 &mpu_3xxx_clkdm,
839 &neon_clkdm,
840 &iva2_clkdm,
841 &gfx_3430es1_clkdm,
842 &sgx_clkdm,
843 &d2d_clkdm,
844 &core_l3_3xxx_clkdm,
845 &core_l4_3xxx_clkdm,
846 &dss_3xxx_clkdm,
847 &cam_clkdm,
848 &usbhost_clkdm,
849 &per_clkdm,
850 &emu_clkdm,
851 &dpll1_clkdm,
852 &dpll2_clkdm,
853 &dpll3_clkdm,
854 &dpll4_clkdm,
855 &dpll5_clkdm,
856#endif
857 NULL,
858};
859
860void __init omap2xxx_clockdomains_init(void)
861{
862 clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap2_clkdm_operations);
863}
864
865void __init omap3xxx_clockdomains_init(void)
866{
867 clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap3_clkdm_operations);
868}
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
new file mode 100644
index 000000000000..b84e138d99c8
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -0,0 +1,398 @@
1/*
2 * OMAP3xxx clockdomains
3 *
4 * Copyright (C) 2008-2011 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Paul Walmsley, Jouni Högander
8 *
9 * This file contains clockdomains and clockdomain wakeup/sleep
10 * dependencies for the OMAP3xxx chips. Some notes:
11 *
12 * A useful validation rule for struct clockdomain: Any clockdomain
13 * referenced by a wkdep_srcs or sleepdep_srcs array must have a
14 * dep_bit assigned. So wkdep_srcs/sleepdep_srcs are really just
15 * software-controllable dependencies. Non-software-controllable
16 * dependencies do exist, but they are not encoded below (yet).
17 *
18 * The overly-specific dep_bit names are due to a bit name collision
19 * with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
20 * value are the same for all powerdomains: 2
21 *
22 * XXX should dep_bit be a mask, so we can test to see if it is 0 as a
23 * sanity check?
24 * XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
25 */
26
27/*
28 * To-Do List
29 * -> Port the Sleep/Wakeup dependencies for the domains
30 * from the Power domain framework
31 */
32
33#include <linux/kernel.h>
34#include <linux/io.h>
35
36#include "clockdomain.h"
37#include "prm2xxx_3xxx.h"
38#include "cm2xxx_3xxx.h"
39#include "cm-regbits-34xx.h"
40#include "prm-regbits-34xx.h"
41
42/*
43 * Clockdomain dependencies for wkdeps/sleepdeps
44 *
45 * XXX Hardware dependencies (e.g., dependencies that cannot be
46 * changed in software) are not included here yet, but should be.
47 */
48
49/* OMAP3-specific possible dependencies */
50
51/*
52 * 3430ES1 PM_WKDEP_GFX: adds IVA2, removes CORE
53 * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
54 */
55static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
56 { .clkdm_name = "iva2_clkdm", },
57 { .clkdm_name = "mpu_clkdm", },
58 { .clkdm_name = "wkup_clkdm", },
59 { NULL },
60};
61
62/* 3430: PM_WKDEP_PER: CORE, IVA2, MPU, WKUP */
63static struct clkdm_dep per_wkdeps[] = {
64 { .clkdm_name = "core_l3_clkdm" },
65 { .clkdm_name = "core_l4_clkdm" },
66 { .clkdm_name = "iva2_clkdm" },
67 { .clkdm_name = "mpu_clkdm" },
68 { .clkdm_name = "wkup_clkdm" },
69 { NULL },
70};
71
72/* 3430ES2: PM_WKDEP_USBHOST: CORE, IVA2, MPU, WKUP */
73static struct clkdm_dep usbhost_wkdeps[] = {
74 { .clkdm_name = "core_l3_clkdm" },
75 { .clkdm_name = "core_l4_clkdm" },
76 { .clkdm_name = "iva2_clkdm" },
77 { .clkdm_name = "mpu_clkdm" },
78 { .clkdm_name = "wkup_clkdm" },
79 { NULL },
80};
81
82/* 3430 PM_WKDEP_MPU: CORE, IVA2, DSS, PER */
83static struct clkdm_dep mpu_3xxx_wkdeps[] = {
84 { .clkdm_name = "core_l3_clkdm" },
85 { .clkdm_name = "core_l4_clkdm" },
86 { .clkdm_name = "iva2_clkdm" },
87 { .clkdm_name = "dss_clkdm" },
88 { .clkdm_name = "per_clkdm" },
89 { NULL },
90};
91
92/* 3430 PM_WKDEP_IVA2: CORE, MPU, WKUP, DSS, PER */
93static struct clkdm_dep iva2_wkdeps[] = {
94 { .clkdm_name = "core_l3_clkdm" },
95 { .clkdm_name = "core_l4_clkdm" },
96 { .clkdm_name = "mpu_clkdm" },
97 { .clkdm_name = "wkup_clkdm" },
98 { .clkdm_name = "dss_clkdm" },
99 { .clkdm_name = "per_clkdm" },
100 { NULL },
101};
102
103/* 3430 PM_WKDEP_CAM: IVA2, MPU, WKUP */
104static struct clkdm_dep cam_wkdeps[] = {
105 { .clkdm_name = "iva2_clkdm" },
106 { .clkdm_name = "mpu_clkdm" },
107 { .clkdm_name = "wkup_clkdm" },
108 { NULL },
109};
110
111/* 3430 PM_WKDEP_DSS: IVA2, MPU, WKUP */
112static struct clkdm_dep dss_wkdeps[] = {
113 { .clkdm_name = "iva2_clkdm" },
114 { .clkdm_name = "mpu_clkdm" },
115 { .clkdm_name = "wkup_clkdm" },
116 { NULL },
117};
118
119/* 3430: PM_WKDEP_NEON: MPU */
120static struct clkdm_dep neon_wkdeps[] = {
121 { .clkdm_name = "mpu_clkdm" },
122 { NULL },
123};
124
125/* Sleep dependency source arrays for OMAP3-specific clkdms */
126
127/* 3430: CM_SLEEPDEP_DSS: MPU, IVA */
128static struct clkdm_dep dss_sleepdeps[] = {
129 { .clkdm_name = "mpu_clkdm" },
130 { .clkdm_name = "iva2_clkdm" },
131 { NULL },
132};
133
134/* 3430: CM_SLEEPDEP_PER: MPU, IVA */
135static struct clkdm_dep per_sleepdeps[] = {
136 { .clkdm_name = "mpu_clkdm" },
137 { .clkdm_name = "iva2_clkdm" },
138 { NULL },
139};
140
141/* 3430ES2: CM_SLEEPDEP_USBHOST: MPU, IVA */
142static struct clkdm_dep usbhost_sleepdeps[] = {
143 { .clkdm_name = "mpu_clkdm" },
144 { .clkdm_name = "iva2_clkdm" },
145 { NULL },
146};
147
148/* 3430: CM_SLEEPDEP_CAM: MPU */
149static struct clkdm_dep cam_sleepdeps[] = {
150 { .clkdm_name = "mpu_clkdm" },
151 { NULL },
152};
153
154/*
155 * 3430ES1: CM_SLEEPDEP_GFX: MPU
156 * 3430ES2: CM_SLEEPDEP_SGX: MPU
157 * These can share data since they will never be present simultaneously
158 * on the same device.
159 */
160static struct clkdm_dep gfx_sgx_sleepdeps[] = {
161 { .clkdm_name = "mpu_clkdm" },
162 { NULL },
163};
164
165/*
166 * OMAP3 clockdomains
167 */
168
169static struct clockdomain mpu_3xxx_clkdm = {
170 .name = "mpu_clkdm",
171 .pwrdm = { .name = "mpu_pwrdm" },
172 .flags = CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
173 .dep_bit = OMAP3430_EN_MPU_SHIFT,
174 .wkdep_srcs = mpu_3xxx_wkdeps,
175 .clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
176};
177
178static struct clockdomain neon_clkdm = {
179 .name = "neon_clkdm",
180 .pwrdm = { .name = "neon_pwrdm" },
181 .flags = CLKDM_CAN_HWSUP_SWSUP,
182 .wkdep_srcs = neon_wkdeps,
183 .clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
184};
185
186static struct clockdomain iva2_clkdm = {
187 .name = "iva2_clkdm",
188 .pwrdm = { .name = "iva2_pwrdm" },
189 .flags = CLKDM_CAN_HWSUP_SWSUP,
190 .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_IVA2_SHIFT,
191 .wkdep_srcs = iva2_wkdeps,
192 .clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
193};
194
195static struct clockdomain gfx_3430es1_clkdm = {
196 .name = "gfx_clkdm",
197 .pwrdm = { .name = "gfx_pwrdm" },
198 .flags = CLKDM_CAN_HWSUP_SWSUP,
199 .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
200 .sleepdep_srcs = gfx_sgx_sleepdeps,
201 .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
202};
203
204static struct clockdomain sgx_clkdm = {
205 .name = "sgx_clkdm",
206 .pwrdm = { .name = "sgx_pwrdm" },
207 .flags = CLKDM_CAN_HWSUP_SWSUP,
208 .wkdep_srcs = gfx_sgx_3xxx_wkdeps,
209 .sleepdep_srcs = gfx_sgx_sleepdeps,
210 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
211};
212
213/*
214 * 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
216 * unclear whether the core is still there, but the clockdomain logic
217 * is there, and must be programmed to an appropriate state if the
218 * CORE clockdomain is to become inactive.
219 */
220static struct clockdomain d2d_clkdm = {
221 .name = "d2d_clkdm",
222 .pwrdm = { .name = "core_pwrdm" },
223 .flags = CLKDM_CAN_HWSUP_SWSUP,
224 .clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
225};
226
227/*
228 * XXX add usecounting for clkdm dependencies, otherwise the presence
229 * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
230 * could cause trouble
231 */
232static struct clockdomain core_l3_3xxx_clkdm = {
233 .name = "core_l3_clkdm",
234 .pwrdm = { .name = "core_pwrdm" },
235 .flags = CLKDM_CAN_HWSUP,
236 .dep_bit = OMAP3430_EN_CORE_SHIFT,
237 .clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
238};
239
240/*
241 * XXX add usecounting for clkdm dependencies, otherwise the presence
242 * of a single dep bit for core_l3_3xxx_clkdm and core_l4_3xxx_clkdm
243 * could cause trouble
244 */
245static struct clockdomain core_l4_3xxx_clkdm = {
246 .name = "core_l4_clkdm",
247 .pwrdm = { .name = "core_pwrdm" },
248 .flags = CLKDM_CAN_HWSUP,
249 .dep_bit = OMAP3430_EN_CORE_SHIFT,
250 .clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
251};
252
253/* Another case of bit name collisions between several registers: EN_DSS */
254static struct clockdomain dss_3xxx_clkdm = {
255 .name = "dss_clkdm",
256 .pwrdm = { .name = "dss_pwrdm" },
257 .flags = CLKDM_CAN_HWSUP_SWSUP,
258 .dep_bit = OMAP3430_PM_WKDEP_MPU_EN_DSS_SHIFT,
259 .wkdep_srcs = dss_wkdeps,
260 .sleepdep_srcs = dss_sleepdeps,
261 .clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
262};
263
264static struct clockdomain cam_clkdm = {
265 .name = "cam_clkdm",
266 .pwrdm = { .name = "cam_pwrdm" },
267 .flags = CLKDM_CAN_HWSUP_SWSUP,
268 .wkdep_srcs = cam_wkdeps,
269 .sleepdep_srcs = cam_sleepdeps,
270 .clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
271};
272
273static struct clockdomain usbhost_clkdm = {
274 .name = "usbhost_clkdm",
275 .pwrdm = { .name = "usbhost_pwrdm" },
276 .flags = CLKDM_CAN_HWSUP_SWSUP,
277 .wkdep_srcs = usbhost_wkdeps,
278 .sleepdep_srcs = usbhost_sleepdeps,
279 .clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
280};
281
282static struct clockdomain per_clkdm = {
283 .name = "per_clkdm",
284 .pwrdm = { .name = "per_pwrdm" },
285 .flags = CLKDM_CAN_HWSUP_SWSUP,
286 .dep_bit = OMAP3430_EN_PER_SHIFT,
287 .wkdep_srcs = per_wkdeps,
288 .sleepdep_srcs = per_sleepdeps,
289 .clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
290};
291
292/*
293 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
294 * switched of even if sdti is in use
295 */
296static struct clockdomain emu_clkdm = {
297 .name = "emu_clkdm",
298 .pwrdm = { .name = "emu_pwrdm" },
299 .flags = /* CLKDM_CAN_ENABLE_AUTO | */CLKDM_CAN_SWSUP,
300 .clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
301};
302
303static struct clockdomain dpll1_clkdm = {
304 .name = "dpll1_clkdm",
305 .pwrdm = { .name = "dpll1_pwrdm" },
306};
307
308static struct clockdomain dpll2_clkdm = {
309 .name = "dpll2_clkdm",
310 .pwrdm = { .name = "dpll2_pwrdm" },
311};
312
313static struct clockdomain dpll3_clkdm = {
314 .name = "dpll3_clkdm",
315 .pwrdm = { .name = "dpll3_pwrdm" },
316};
317
318static struct clockdomain dpll4_clkdm = {
319 .name = "dpll4_clkdm",
320 .pwrdm = { .name = "dpll4_pwrdm" },
321};
322
323static struct clockdomain dpll5_clkdm = {
324 .name = "dpll5_clkdm",
325 .pwrdm = { .name = "dpll5_pwrdm" },
326};
327
328/*
329 * Clockdomain hwsup dependencies
330 */
331
332static struct clkdm_autodep clkdm_autodeps[] = {
333 {
334 .clkdm = { .name = "mpu_clkdm" },
335 },
336 {
337 .clkdm = { .name = "iva2_clkdm" },
338 },
339 {
340 .clkdm = { .name = NULL },
341 }
342};
343
344/*
345 *
346 */
347
348static struct clockdomain *clockdomains_omap3430_common[] __initdata = {
349 &wkup_common_clkdm,
350 &cm_common_clkdm,
351 &prm_common_clkdm,
352 &mpu_3xxx_clkdm,
353 &neon_clkdm,
354 &iva2_clkdm,
355 &d2d_clkdm,
356 &core_l3_3xxx_clkdm,
357 &core_l4_3xxx_clkdm,
358 &dss_3xxx_clkdm,
359 &cam_clkdm,
360 &per_clkdm,
361 &emu_clkdm,
362 &dpll1_clkdm,
363 &dpll2_clkdm,
364 &dpll3_clkdm,
365 &dpll4_clkdm,
366 NULL
367};
368
369static struct clockdomain *clockdomains_omap3430es1[] __initdata = {
370 &gfx_3430es1_clkdm,
371 NULL,
372};
373
374static struct clockdomain *clockdomains_omap3430es2plus[] __initdata = {
375 &sgx_clkdm,
376 &dpll5_clkdm,
377 &usbhost_clkdm,
378 NULL,
379};
380
381void __init omap3xxx_clockdomains_init(void)
382{
383 struct clockdomain **sc;
384
385 if (!cpu_is_omap34xx())
386 return;
387
388 clkdm_register_platform_funcs(&omap3_clkdm_operations);
389 clkdm_register_clkdms(clockdomains_omap3430_common);
390
391 sc = (omap_rev() == OMAP3430_REV_ES1_0) ? clockdomains_omap3430es1 :
392 clockdomains_omap3430es2plus;
393
394 clkdm_register_clkdms(sc);
395
396 clkdm_register_autodeps(clkdm_autodeps);
397 clkdm_complete_init();
398}
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index dccc651fa0d0..9299ac291d28 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -34,350 +34,122 @@
34/* Static Dependencies for OMAP4 Clock Domains */ 34/* Static Dependencies for OMAP4 Clock Domains */
35 35
36static struct clkdm_dep d2d_wkup_sleep_deps[] = { 36static struct clkdm_dep d2d_wkup_sleep_deps[] = {
37 { 37 { .clkdm_name = "abe_clkdm" },
38 .clkdm_name = "abe_clkdm", 38 { .clkdm_name = "ivahd_clkdm" },
39 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 39 { .clkdm_name = "l3_1_clkdm" },
40 }, 40 { .clkdm_name = "l3_2_clkdm" },
41 { 41 { .clkdm_name = "l3_emif_clkdm" },
42 .clkdm_name = "ivahd_clkdm", 42 { .clkdm_name = "l3_init_clkdm" },
43 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 43 { .clkdm_name = "l4_cfg_clkdm" },
44 }, 44 { .clkdm_name = "l4_per_clkdm" },
45 {
46 .clkdm_name = "l3_1_clkdm",
47 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
48 },
49 {
50 .clkdm_name = "l3_2_clkdm",
51 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
52 },
53 {
54 .clkdm_name = "l3_emif_clkdm",
55 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
56 },
57 {
58 .clkdm_name = "l3_init_clkdm",
59 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
60 },
61 {
62 .clkdm_name = "l4_cfg_clkdm",
63 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
64 },
65 {
66 .clkdm_name = "l4_per_clkdm",
67 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
68 },
69 { NULL }, 45 { NULL },
70}; 46};
71 47
72static struct clkdm_dep ducati_wkup_sleep_deps[] = { 48static struct clkdm_dep ducati_wkup_sleep_deps[] = {
73 { 49 { .clkdm_name = "abe_clkdm" },
74 .clkdm_name = "abe_clkdm", 50 { .clkdm_name = "ivahd_clkdm" },
75 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 51 { .clkdm_name = "l3_1_clkdm" },
76 }, 52 { .clkdm_name = "l3_2_clkdm" },
77 { 53 { .clkdm_name = "l3_dss_clkdm" },
78 .clkdm_name = "ivahd_clkdm", 54 { .clkdm_name = "l3_emif_clkdm" },
79 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 55 { .clkdm_name = "l3_gfx_clkdm" },
80 }, 56 { .clkdm_name = "l3_init_clkdm" },
81 { 57 { .clkdm_name = "l4_cfg_clkdm" },
82 .clkdm_name = "l3_1_clkdm", 58 { .clkdm_name = "l4_per_clkdm" },
83 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 59 { .clkdm_name = "l4_secure_clkdm" },
84 }, 60 { .clkdm_name = "l4_wkup_clkdm" },
85 { 61 { .clkdm_name = "tesla_clkdm" },
86 .clkdm_name = "l3_2_clkdm",
87 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
88 },
89 {
90 .clkdm_name = "l3_dss_clkdm",
91 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
92 },
93 {
94 .clkdm_name = "l3_emif_clkdm",
95 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
96 },
97 {
98 .clkdm_name = "l3_gfx_clkdm",
99 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
100 },
101 {
102 .clkdm_name = "l3_init_clkdm",
103 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
104 },
105 {
106 .clkdm_name = "l4_cfg_clkdm",
107 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
108 },
109 {
110 .clkdm_name = "l4_per_clkdm",
111 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
112 },
113 {
114 .clkdm_name = "l4_secure_clkdm",
115 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
116 },
117 {
118 .clkdm_name = "l4_wkup_clkdm",
119 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
120 },
121 {
122 .clkdm_name = "tesla_clkdm",
123 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
124 },
125 { NULL }, 62 { NULL },
126}; 63};
127 64
128static struct clkdm_dep iss_wkup_sleep_deps[] = { 65static struct clkdm_dep iss_wkup_sleep_deps[] = {
129 { 66 { .clkdm_name = "ivahd_clkdm" },
130 .clkdm_name = "ivahd_clkdm", 67 { .clkdm_name = "l3_1_clkdm" },
131 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 68 { .clkdm_name = "l3_emif_clkdm" },
132 },
133 {
134 .clkdm_name = "l3_1_clkdm",
135 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
136 },
137 {
138 .clkdm_name = "l3_emif_clkdm",
139 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
140 },
141 { NULL }, 69 { NULL },
142}; 70};
143 71
144static struct clkdm_dep ivahd_wkup_sleep_deps[] = { 72static struct clkdm_dep ivahd_wkup_sleep_deps[] = {
145 { 73 { .clkdm_name = "l3_1_clkdm" },
146 .clkdm_name = "l3_1_clkdm", 74 { .clkdm_name = "l3_emif_clkdm" },
147 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
148 },
149 {
150 .clkdm_name = "l3_emif_clkdm",
151 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
152 },
153 { NULL }, 75 { NULL },
154}; 76};
155 77
156static struct clkdm_dep l3_dma_wkup_sleep_deps[] = { 78static struct clkdm_dep l3_dma_wkup_sleep_deps[] = {
157 { 79 { .clkdm_name = "abe_clkdm" },
158 .clkdm_name = "abe_clkdm", 80 { .clkdm_name = "ducati_clkdm" },
159 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 81 { .clkdm_name = "ivahd_clkdm" },
160 }, 82 { .clkdm_name = "l3_1_clkdm" },
161 { 83 { .clkdm_name = "l3_dss_clkdm" },
162 .clkdm_name = "ducati_clkdm", 84 { .clkdm_name = "l3_emif_clkdm" },
163 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 85 { .clkdm_name = "l3_init_clkdm" },
164 }, 86 { .clkdm_name = "l4_cfg_clkdm" },
165 { 87 { .clkdm_name = "l4_per_clkdm" },
166 .clkdm_name = "ivahd_clkdm", 88 { .clkdm_name = "l4_secure_clkdm" },
167 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 89 { .clkdm_name = "l4_wkup_clkdm" },
168 },
169 {
170 .clkdm_name = "l3_1_clkdm",
171 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
172 },
173 {
174 .clkdm_name = "l3_dss_clkdm",
175 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
176 },
177 {
178 .clkdm_name = "l3_emif_clkdm",
179 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
180 },
181 {
182 .clkdm_name = "l3_init_clkdm",
183 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
184 },
185 {
186 .clkdm_name = "l4_cfg_clkdm",
187 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
188 },
189 {
190 .clkdm_name = "l4_per_clkdm",
191 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
192 },
193 {
194 .clkdm_name = "l4_secure_clkdm",
195 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
196 },
197 {
198 .clkdm_name = "l4_wkup_clkdm",
199 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
200 },
201 { NULL }, 90 { NULL },
202}; 91};
203 92
204static struct clkdm_dep l3_dss_wkup_sleep_deps[] = { 93static struct clkdm_dep l3_dss_wkup_sleep_deps[] = {
205 { 94 { .clkdm_name = "ivahd_clkdm" },
206 .clkdm_name = "ivahd_clkdm", 95 { .clkdm_name = "l3_2_clkdm" },
207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 96 { .clkdm_name = "l3_emif_clkdm" },
208 },
209 {
210 .clkdm_name = "l3_2_clkdm",
211 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
212 },
213 {
214 .clkdm_name = "l3_emif_clkdm",
215 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
216 },
217 { NULL }, 97 { NULL },
218}; 98};
219 99
220static struct clkdm_dep l3_gfx_wkup_sleep_deps[] = { 100static struct clkdm_dep l3_gfx_wkup_sleep_deps[] = {
221 { 101 { .clkdm_name = "ivahd_clkdm" },
222 .clkdm_name = "ivahd_clkdm", 102 { .clkdm_name = "l3_1_clkdm" },
223 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 103 { .clkdm_name = "l3_emif_clkdm" },
224 },
225 {
226 .clkdm_name = "l3_1_clkdm",
227 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
228 },
229 {
230 .clkdm_name = "l3_emif_clkdm",
231 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
232 },
233 { NULL }, 104 { NULL },
234}; 105};
235 106
236static struct clkdm_dep l3_init_wkup_sleep_deps[] = { 107static struct clkdm_dep l3_init_wkup_sleep_deps[] = {
237 { 108 { .clkdm_name = "abe_clkdm" },
238 .clkdm_name = "abe_clkdm", 109 { .clkdm_name = "ivahd_clkdm" },
239 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 110 { .clkdm_name = "l3_emif_clkdm" },
240 }, 111 { .clkdm_name = "l4_cfg_clkdm" },
241 { 112 { .clkdm_name = "l4_per_clkdm" },
242 .clkdm_name = "ivahd_clkdm", 113 { .clkdm_name = "l4_secure_clkdm" },
243 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 114 { .clkdm_name = "l4_wkup_clkdm" },
244 },
245 {
246 .clkdm_name = "l3_emif_clkdm",
247 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
248 },
249 {
250 .clkdm_name = "l4_cfg_clkdm",
251 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
252 },
253 {
254 .clkdm_name = "l4_per_clkdm",
255 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
256 },
257 {
258 .clkdm_name = "l4_secure_clkdm",
259 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
260 },
261 {
262 .clkdm_name = "l4_wkup_clkdm",
263 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
264 },
265 { NULL }, 115 { NULL },
266}; 116};
267 117
268static struct clkdm_dep l4_secure_wkup_sleep_deps[] = { 118static struct clkdm_dep l4_secure_wkup_sleep_deps[] = {
269 { 119 { .clkdm_name = "l3_1_clkdm" },
270 .clkdm_name = "l3_1_clkdm", 120 { .clkdm_name = "l3_emif_clkdm" },
271 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 121 { .clkdm_name = "l4_per_clkdm" },
272 },
273 {
274 .clkdm_name = "l3_emif_clkdm",
275 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
276 },
277 {
278 .clkdm_name = "l4_per_clkdm",
279 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
280 },
281 { NULL }, 122 { NULL },
282}; 123};
283 124
284static struct clkdm_dep mpu_wkup_sleep_deps[] = { 125static struct clkdm_dep mpu_wkup_sleep_deps[] = {
285 { 126 { .clkdm_name = "abe_clkdm" },
286 .clkdm_name = "abe_clkdm", 127 { .clkdm_name = "ducati_clkdm" },
287 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 128 { .clkdm_name = "ivahd_clkdm" },
288 }, 129 { .clkdm_name = "l3_1_clkdm" },
289 { 130 { .clkdm_name = "l3_2_clkdm" },
290 .clkdm_name = "ducati_clkdm", 131 { .clkdm_name = "l3_dss_clkdm" },
291 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 132 { .clkdm_name = "l3_emif_clkdm" },
292 }, 133 { .clkdm_name = "l3_gfx_clkdm" },
293 { 134 { .clkdm_name = "l3_init_clkdm" },
294 .clkdm_name = "ivahd_clkdm", 135 { .clkdm_name = "l4_cfg_clkdm" },
295 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 136 { .clkdm_name = "l4_per_clkdm" },
296 }, 137 { .clkdm_name = "l4_secure_clkdm" },
297 { 138 { .clkdm_name = "l4_wkup_clkdm" },
298 .clkdm_name = "l3_1_clkdm", 139 { .clkdm_name = "tesla_clkdm" },
299 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
300 },
301 {
302 .clkdm_name = "l3_2_clkdm",
303 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
304 },
305 {
306 .clkdm_name = "l3_dss_clkdm",
307 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
308 },
309 {
310 .clkdm_name = "l3_emif_clkdm",
311 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
312 },
313 {
314 .clkdm_name = "l3_gfx_clkdm",
315 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
316 },
317 {
318 .clkdm_name = "l3_init_clkdm",
319 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
320 },
321 {
322 .clkdm_name = "l4_cfg_clkdm",
323 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
324 },
325 {
326 .clkdm_name = "l4_per_clkdm",
327 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
328 },
329 {
330 .clkdm_name = "l4_secure_clkdm",
331 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
332 },
333 {
334 .clkdm_name = "l4_wkup_clkdm",
335 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
336 },
337 {
338 .clkdm_name = "tesla_clkdm",
339 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
340 },
341 { NULL }, 140 { NULL },
342}; 141};
343 142
344static struct clkdm_dep tesla_wkup_sleep_deps[] = { 143static struct clkdm_dep tesla_wkup_sleep_deps[] = {
345 { 144 { .clkdm_name = "abe_clkdm" },
346 .clkdm_name = "abe_clkdm", 145 { .clkdm_name = "ivahd_clkdm" },
347 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 146 { .clkdm_name = "l3_1_clkdm" },
348 }, 147 { .clkdm_name = "l3_2_clkdm" },
349 { 148 { .clkdm_name = "l3_emif_clkdm" },
350 .clkdm_name = "ivahd_clkdm", 149 { .clkdm_name = "l3_init_clkdm" },
351 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430) 150 { .clkdm_name = "l4_cfg_clkdm" },
352 }, 151 { .clkdm_name = "l4_per_clkdm" },
353 { 152 { .clkdm_name = "l4_wkup_clkdm" },
354 .clkdm_name = "l3_1_clkdm",
355 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
356 },
357 {
358 .clkdm_name = "l3_2_clkdm",
359 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
360 },
361 {
362 .clkdm_name = "l3_emif_clkdm",
363 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
364 },
365 {
366 .clkdm_name = "l3_init_clkdm",
367 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
368 },
369 {
370 .clkdm_name = "l4_cfg_clkdm",
371 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
372 },
373 {
374 .clkdm_name = "l4_per_clkdm",
375 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
376 },
377 {
378 .clkdm_name = "l4_wkup_clkdm",
379 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
380 },
381 { NULL }, 153 { NULL },
382}; 154};
383 155
@@ -388,7 +160,6 @@ static struct clockdomain l4_cefuse_44xx_clkdm = {
388 .cm_inst = OMAP4430_CM2_CEFUSE_INST, 160 .cm_inst = OMAP4430_CM2_CEFUSE_INST,
389 .clkdm_offs = OMAP4430_CM2_CEFUSE_CEFUSE_CDOFFS, 161 .clkdm_offs = OMAP4430_CM2_CEFUSE_CEFUSE_CDOFFS,
390 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 162 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
391 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
392}; 163};
393 164
394static struct clockdomain l4_cfg_44xx_clkdm = { 165static struct clockdomain l4_cfg_44xx_clkdm = {
@@ -399,7 +170,6 @@ static struct clockdomain l4_cfg_44xx_clkdm = {
399 .clkdm_offs = OMAP4430_CM2_CORE_L4CFG_CDOFFS, 170 .clkdm_offs = OMAP4430_CM2_CORE_L4CFG_CDOFFS,
400 .dep_bit = OMAP4430_L4CFG_STATDEP_SHIFT, 171 .dep_bit = OMAP4430_L4CFG_STATDEP_SHIFT,
401 .flags = CLKDM_CAN_HWSUP, 172 .flags = CLKDM_CAN_HWSUP,
402 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
403}; 173};
404 174
405static struct clockdomain tesla_44xx_clkdm = { 175static struct clockdomain tesla_44xx_clkdm = {
@@ -412,7 +182,6 @@ static struct clockdomain tesla_44xx_clkdm = {
412 .wkdep_srcs = tesla_wkup_sleep_deps, 182 .wkdep_srcs = tesla_wkup_sleep_deps,
413 .sleepdep_srcs = tesla_wkup_sleep_deps, 183 .sleepdep_srcs = tesla_wkup_sleep_deps,
414 .flags = CLKDM_CAN_HWSUP_SWSUP, 184 .flags = CLKDM_CAN_HWSUP_SWSUP,
415 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
416}; 185};
417 186
418static struct clockdomain l3_gfx_44xx_clkdm = { 187static struct clockdomain l3_gfx_44xx_clkdm = {
@@ -425,7 +194,6 @@ static struct clockdomain l3_gfx_44xx_clkdm = {
425 .wkdep_srcs = l3_gfx_wkup_sleep_deps, 194 .wkdep_srcs = l3_gfx_wkup_sleep_deps,
426 .sleepdep_srcs = l3_gfx_wkup_sleep_deps, 195 .sleepdep_srcs = l3_gfx_wkup_sleep_deps,
427 .flags = CLKDM_CAN_HWSUP_SWSUP, 196 .flags = CLKDM_CAN_HWSUP_SWSUP,
428 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
429}; 197};
430 198
431static struct clockdomain ivahd_44xx_clkdm = { 199static struct clockdomain ivahd_44xx_clkdm = {
@@ -438,7 +206,6 @@ static struct clockdomain ivahd_44xx_clkdm = {
438 .wkdep_srcs = ivahd_wkup_sleep_deps, 206 .wkdep_srcs = ivahd_wkup_sleep_deps,
439 .sleepdep_srcs = ivahd_wkup_sleep_deps, 207 .sleepdep_srcs = ivahd_wkup_sleep_deps,
440 .flags = CLKDM_CAN_HWSUP_SWSUP, 208 .flags = CLKDM_CAN_HWSUP_SWSUP,
441 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
442}; 209};
443 210
444static struct clockdomain l4_secure_44xx_clkdm = { 211static struct clockdomain l4_secure_44xx_clkdm = {
@@ -451,7 +218,6 @@ static struct clockdomain l4_secure_44xx_clkdm = {
451 .wkdep_srcs = l4_secure_wkup_sleep_deps, 218 .wkdep_srcs = l4_secure_wkup_sleep_deps,
452 .sleepdep_srcs = l4_secure_wkup_sleep_deps, 219 .sleepdep_srcs = l4_secure_wkup_sleep_deps,
453 .flags = CLKDM_CAN_HWSUP_SWSUP, 220 .flags = CLKDM_CAN_HWSUP_SWSUP,
454 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
455}; 221};
456 222
457static struct clockdomain l4_per_44xx_clkdm = { 223static struct clockdomain l4_per_44xx_clkdm = {
@@ -462,7 +228,6 @@ static struct clockdomain l4_per_44xx_clkdm = {
462 .clkdm_offs = OMAP4430_CM2_L4PER_L4PER_CDOFFS, 228 .clkdm_offs = OMAP4430_CM2_L4PER_L4PER_CDOFFS,
463 .dep_bit = OMAP4430_L4PER_STATDEP_SHIFT, 229 .dep_bit = OMAP4430_L4PER_STATDEP_SHIFT,
464 .flags = CLKDM_CAN_HWSUP_SWSUP, 230 .flags = CLKDM_CAN_HWSUP_SWSUP,
465 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
466}; 231};
467 232
468static struct clockdomain abe_44xx_clkdm = { 233static struct clockdomain abe_44xx_clkdm = {
@@ -473,7 +238,6 @@ static struct clockdomain abe_44xx_clkdm = {
473 .clkdm_offs = OMAP4430_CM1_ABE_ABE_CDOFFS, 238 .clkdm_offs = OMAP4430_CM1_ABE_ABE_CDOFFS,
474 .dep_bit = OMAP4430_ABE_STATDEP_SHIFT, 239 .dep_bit = OMAP4430_ABE_STATDEP_SHIFT,
475 .flags = CLKDM_CAN_HWSUP_SWSUP, 240 .flags = CLKDM_CAN_HWSUP_SWSUP,
476 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
477}; 241};
478 242
479static struct clockdomain l3_instr_44xx_clkdm = { 243static struct clockdomain l3_instr_44xx_clkdm = {
@@ -482,7 +246,6 @@ static struct clockdomain l3_instr_44xx_clkdm = {
482 .prcm_partition = OMAP4430_CM2_PARTITION, 246 .prcm_partition = OMAP4430_CM2_PARTITION,
483 .cm_inst = OMAP4430_CM2_CORE_INST, 247 .cm_inst = OMAP4430_CM2_CORE_INST,
484 .clkdm_offs = OMAP4430_CM2_CORE_L3INSTR_CDOFFS, 248 .clkdm_offs = OMAP4430_CM2_CORE_L3INSTR_CDOFFS,
485 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
486}; 249};
487 250
488static struct clockdomain l3_init_44xx_clkdm = { 251static struct clockdomain l3_init_44xx_clkdm = {
@@ -495,7 +258,6 @@ static struct clockdomain l3_init_44xx_clkdm = {
495 .wkdep_srcs = l3_init_wkup_sleep_deps, 258 .wkdep_srcs = l3_init_wkup_sleep_deps,
496 .sleepdep_srcs = l3_init_wkup_sleep_deps, 259 .sleepdep_srcs = l3_init_wkup_sleep_deps,
497 .flags = CLKDM_CAN_HWSUP_SWSUP, 260 .flags = CLKDM_CAN_HWSUP_SWSUP,
498 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
499}; 261};
500 262
501static struct clockdomain d2d_44xx_clkdm = { 263static struct clockdomain d2d_44xx_clkdm = {
@@ -507,7 +269,6 @@ static struct clockdomain d2d_44xx_clkdm = {
507 .wkdep_srcs = d2d_wkup_sleep_deps, 269 .wkdep_srcs = d2d_wkup_sleep_deps,
508 .sleepdep_srcs = d2d_wkup_sleep_deps, 270 .sleepdep_srcs = d2d_wkup_sleep_deps,
509 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 271 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
510 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
511}; 272};
512 273
513static struct clockdomain mpu0_44xx_clkdm = { 274static struct clockdomain mpu0_44xx_clkdm = {
@@ -517,7 +278,6 @@ static struct clockdomain mpu0_44xx_clkdm = {
517 .cm_inst = OMAP4430_PRCM_MPU_CPU0_INST, 278 .cm_inst = OMAP4430_PRCM_MPU_CPU0_INST,
518 .clkdm_offs = OMAP4430_PRCM_MPU_CPU0_CPU0_CDOFFS, 279 .clkdm_offs = OMAP4430_PRCM_MPU_CPU0_CPU0_CDOFFS,
519 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 280 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
520 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
521}; 281};
522 282
523static struct clockdomain mpu1_44xx_clkdm = { 283static struct clockdomain mpu1_44xx_clkdm = {
@@ -527,7 +287,6 @@ static struct clockdomain mpu1_44xx_clkdm = {
527 .cm_inst = OMAP4430_PRCM_MPU_CPU1_INST, 287 .cm_inst = OMAP4430_PRCM_MPU_CPU1_INST,
528 .clkdm_offs = OMAP4430_PRCM_MPU_CPU1_CPU1_CDOFFS, 288 .clkdm_offs = OMAP4430_PRCM_MPU_CPU1_CPU1_CDOFFS,
529 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 289 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
530 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
531}; 290};
532 291
533static struct clockdomain l3_emif_44xx_clkdm = { 292static struct clockdomain l3_emif_44xx_clkdm = {
@@ -538,7 +297,6 @@ static struct clockdomain l3_emif_44xx_clkdm = {
538 .clkdm_offs = OMAP4430_CM2_CORE_MEMIF_CDOFFS, 297 .clkdm_offs = OMAP4430_CM2_CORE_MEMIF_CDOFFS,
539 .dep_bit = OMAP4430_MEMIF_STATDEP_SHIFT, 298 .dep_bit = OMAP4430_MEMIF_STATDEP_SHIFT,
540 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 299 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
541 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
542}; 300};
543 301
544static struct clockdomain l4_ao_44xx_clkdm = { 302static struct clockdomain l4_ao_44xx_clkdm = {
@@ -548,7 +306,6 @@ static struct clockdomain l4_ao_44xx_clkdm = {
548 .cm_inst = OMAP4430_CM2_ALWAYS_ON_INST, 306 .cm_inst = OMAP4430_CM2_ALWAYS_ON_INST,
549 .clkdm_offs = OMAP4430_CM2_ALWAYS_ON_ALWON_CDOFFS, 307 .clkdm_offs = OMAP4430_CM2_ALWAYS_ON_ALWON_CDOFFS,
550 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 308 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
551 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
552}; 309};
553 310
554static struct clockdomain ducati_44xx_clkdm = { 311static struct clockdomain ducati_44xx_clkdm = {
@@ -561,7 +318,6 @@ static struct clockdomain ducati_44xx_clkdm = {
561 .wkdep_srcs = ducati_wkup_sleep_deps, 318 .wkdep_srcs = ducati_wkup_sleep_deps,
562 .sleepdep_srcs = ducati_wkup_sleep_deps, 319 .sleepdep_srcs = ducati_wkup_sleep_deps,
563 .flags = CLKDM_CAN_HWSUP_SWSUP, 320 .flags = CLKDM_CAN_HWSUP_SWSUP,
564 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
565}; 321};
566 322
567static struct clockdomain mpu_44xx_clkdm = { 323static struct clockdomain mpu_44xx_clkdm = {
@@ -573,7 +329,6 @@ static struct clockdomain mpu_44xx_clkdm = {
573 .wkdep_srcs = mpu_wkup_sleep_deps, 329 .wkdep_srcs = mpu_wkup_sleep_deps,
574 .sleepdep_srcs = mpu_wkup_sleep_deps, 330 .sleepdep_srcs = mpu_wkup_sleep_deps,
575 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 331 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
576 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
577}; 332};
578 333
579static struct clockdomain l3_2_44xx_clkdm = { 334static struct clockdomain l3_2_44xx_clkdm = {
@@ -584,7 +339,6 @@ static struct clockdomain l3_2_44xx_clkdm = {
584 .clkdm_offs = OMAP4430_CM2_CORE_L3_2_CDOFFS, 339 .clkdm_offs = OMAP4430_CM2_CORE_L3_2_CDOFFS,
585 .dep_bit = OMAP4430_L3_2_STATDEP_SHIFT, 340 .dep_bit = OMAP4430_L3_2_STATDEP_SHIFT,
586 .flags = CLKDM_CAN_HWSUP, 341 .flags = CLKDM_CAN_HWSUP,
587 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
588}; 342};
589 343
590static struct clockdomain l3_1_44xx_clkdm = { 344static struct clockdomain l3_1_44xx_clkdm = {
@@ -595,7 +349,6 @@ static struct clockdomain l3_1_44xx_clkdm = {
595 .clkdm_offs = OMAP4430_CM2_CORE_L3_1_CDOFFS, 349 .clkdm_offs = OMAP4430_CM2_CORE_L3_1_CDOFFS,
596 .dep_bit = OMAP4430_L3_1_STATDEP_SHIFT, 350 .dep_bit = OMAP4430_L3_1_STATDEP_SHIFT,
597 .flags = CLKDM_CAN_HWSUP, 351 .flags = CLKDM_CAN_HWSUP,
598 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
599}; 352};
600 353
601static struct clockdomain iss_44xx_clkdm = { 354static struct clockdomain iss_44xx_clkdm = {
@@ -607,7 +360,6 @@ static struct clockdomain iss_44xx_clkdm = {
607 .wkdep_srcs = iss_wkup_sleep_deps, 360 .wkdep_srcs = iss_wkup_sleep_deps,
608 .sleepdep_srcs = iss_wkup_sleep_deps, 361 .sleepdep_srcs = iss_wkup_sleep_deps,
609 .flags = CLKDM_CAN_HWSUP_SWSUP, 362 .flags = CLKDM_CAN_HWSUP_SWSUP,
610 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
611}; 363};
612 364
613static struct clockdomain l3_dss_44xx_clkdm = { 365static struct clockdomain l3_dss_44xx_clkdm = {
@@ -620,7 +372,6 @@ static struct clockdomain l3_dss_44xx_clkdm = {
620 .wkdep_srcs = l3_dss_wkup_sleep_deps, 372 .wkdep_srcs = l3_dss_wkup_sleep_deps,
621 .sleepdep_srcs = l3_dss_wkup_sleep_deps, 373 .sleepdep_srcs = l3_dss_wkup_sleep_deps,
622 .flags = CLKDM_CAN_HWSUP_SWSUP, 374 .flags = CLKDM_CAN_HWSUP_SWSUP,
623 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
624}; 375};
625 376
626static struct clockdomain l4_wkup_44xx_clkdm = { 377static struct clockdomain l4_wkup_44xx_clkdm = {
@@ -631,7 +382,6 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
631 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS, 382 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
632 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT, 383 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT,
633 .flags = CLKDM_CAN_HWSUP, 384 .flags = CLKDM_CAN_HWSUP,
634 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
635}; 385};
636 386
637static struct clockdomain emu_sys_44xx_clkdm = { 387static struct clockdomain emu_sys_44xx_clkdm = {
@@ -641,7 +391,6 @@ static struct clockdomain emu_sys_44xx_clkdm = {
641 .cm_inst = OMAP4430_PRM_EMU_CM_INST, 391 .cm_inst = OMAP4430_PRM_EMU_CM_INST,
642 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS, 392 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS,
643 .flags = CLKDM_CAN_HWSUP, 393 .flags = CLKDM_CAN_HWSUP,
644 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
645}; 394};
646 395
647static struct clockdomain l3_dma_44xx_clkdm = { 396static struct clockdomain l3_dma_44xx_clkdm = {
@@ -653,7 +402,6 @@ static struct clockdomain l3_dma_44xx_clkdm = {
653 .wkdep_srcs = l3_dma_wkup_sleep_deps, 402 .wkdep_srcs = l3_dma_wkup_sleep_deps,
654 .sleepdep_srcs = l3_dma_wkup_sleep_deps, 403 .sleepdep_srcs = l3_dma_wkup_sleep_deps,
655 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 404 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
656 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
657}; 405};
658 406
659/* As clockdomains are added or removed above, this list must also be changed */ 407/* As clockdomains are added or removed above, this list must also be changed */
@@ -685,7 +433,10 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
685 NULL 433 NULL
686}; 434};
687 435
436
688void __init omap44xx_clockdomains_init(void) 437void __init omap44xx_clockdomains_init(void)
689{ 438{
690 clkdm_init(clockdomains_omap44xx, NULL, &omap4_clkdm_operations); 439 clkdm_register_platform_funcs(&omap4_clkdm_operations);
440 clkdm_register_clkdms(clockdomains_omap44xx);
441 clkdm_complete_init();
691} 442}
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 3f20cbb9967b..110e5b9db145 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -45,17 +45,22 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
45static struct omap_globals omap242x_globals = { 45static struct omap_globals omap242x_globals = {
46 .class = OMAP242X_CLASS, 46 .class = OMAP242X_CLASS,
47 .tap = OMAP2_L4_IO_ADDRESS(0x48014000), 47 .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
48 .sdrc = OMAP2420_SDRC_BASE, 48 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
49 .sms = OMAP2420_SMS_BASE, 49 .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
50 .ctrl = OMAP242X_CTRL_BASE, 50 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
51 .prm = OMAP2420_PRM_BASE, 51 .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
52 .cm = OMAP2420_CM_BASE, 52 .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
53}; 53};
54 54
55void __init omap2_set_globals_242x(void) 55void __init omap2_set_globals_242x(void)
56{ 56{
57 __omap2_set_globals(&omap242x_globals); 57 __omap2_set_globals(&omap242x_globals);
58} 58}
59
60void __init omap242x_map_io(void)
61{
62 omap242x_map_common_io();
63}
59#endif 64#endif
60 65
61#if defined(CONFIG_SOC_OMAP2430) 66#if defined(CONFIG_SOC_OMAP2430)
@@ -63,17 +68,22 @@ void __init omap2_set_globals_242x(void)
63static struct omap_globals omap243x_globals = { 68static struct omap_globals omap243x_globals = {
64 .class = OMAP243X_CLASS, 69 .class = OMAP243X_CLASS,
65 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000), 70 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
66 .sdrc = OMAP243X_SDRC_BASE, 71 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
67 .sms = OMAP243X_SMS_BASE, 72 .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
68 .ctrl = OMAP243X_CTRL_BASE, 73 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
69 .prm = OMAP2430_PRM_BASE, 74 .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
70 .cm = OMAP2430_CM_BASE, 75 .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
71}; 76};
72 77
73void __init omap2_set_globals_243x(void) 78void __init omap2_set_globals_243x(void)
74{ 79{
75 __omap2_set_globals(&omap243x_globals); 80 __omap2_set_globals(&omap243x_globals);
76} 81}
82
83void __init omap243x_map_io(void)
84{
85 omap243x_map_common_io();
86}
77#endif 87#endif
78 88
79#if defined(CONFIG_ARCH_OMAP3) 89#if defined(CONFIG_ARCH_OMAP3)
@@ -81,11 +91,11 @@ void __init omap2_set_globals_243x(void)
81static struct omap_globals omap3_globals = { 91static struct omap_globals omap3_globals = {
82 .class = OMAP343X_CLASS, 92 .class = OMAP343X_CLASS,
83 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000), 93 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
84 .sdrc = OMAP343X_SDRC_BASE, 94 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
85 .sms = OMAP343X_SMS_BASE, 95 .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
86 .ctrl = OMAP343X_CTRL_BASE, 96 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
87 .prm = OMAP3430_PRM_BASE, 97 .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
88 .cm = OMAP3430_CM_BASE, 98 .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
89}; 99};
90 100
91void __init omap2_set_globals_3xxx(void) 101void __init omap2_set_globals_3xxx(void)
@@ -95,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
95 105
96void __init omap3_map_io(void) 106void __init omap3_map_io(void)
97{ 107{
98 omap2_set_globals_3xxx();
99 omap34xx_map_common_io(); 108 omap34xx_map_common_io();
100} 109}
101 110
@@ -110,9 +119,9 @@ void __init omap3_map_io(void)
110static struct omap_globals ti816x_globals = { 119static struct omap_globals ti816x_globals = {
111 .class = OMAP343X_CLASS, 120 .class = OMAP343X_CLASS,
112 .tap = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE), 121 .tap = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
113 .ctrl = TI816X_CTRL_BASE, 122 .ctrl = OMAP2_L4_IO_ADDRESS(TI816X_CTRL_BASE),
114 .prm = TI816X_PRCM_BASE, 123 .prm = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
115 .cm = TI816X_PRCM_BASE, 124 .cm = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
116}; 125};
117 126
118void __init omap2_set_globals_ti816x(void) 127void __init omap2_set_globals_ti816x(void)
@@ -125,11 +134,11 @@ void __init omap2_set_globals_ti816x(void)
125static struct omap_globals omap4_globals = { 134static struct omap_globals omap4_globals = {
126 .class = OMAP443X_CLASS, 135 .class = OMAP443X_CLASS,
127 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), 136 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
128 .ctrl = OMAP443X_SCM_BASE, 137 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
129 .ctrl_pad = OMAP443X_CTRL_BASE, 138 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
130 .prm = OMAP4430_PRM_BASE, 139 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
131 .cm = OMAP4430_CM_BASE, 140 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
132 .cm2 = OMAP4430_CM2_BASE, 141 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
133}; 142};
134 143
135void __init omap2_set_globals_443x(void) 144void __init omap2_set_globals_443x(void)
@@ -138,5 +147,10 @@ void __init omap2_set_globals_443x(void)
138 omap2_set_globals_control(&omap4_globals); 147 omap2_set_globals_control(&omap4_globals);
139 omap2_set_globals_prcm(&omap4_globals); 148 omap2_set_globals_prcm(&omap4_globals);
140} 149}
150
151void __init omap4_map_io(void)
152{
153 omap44xx_map_common_io();
154}
141#endif 155#endif
142 156
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index aab884fecc55..e34d27f8c49c 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -149,17 +149,11 @@ static struct omap3_control_regs control_context;
149 149
150void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 150void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
151{ 151{
152 /* Static mapping, never released */ 152 if (omap2_globals->ctrl)
153 if (omap2_globals->ctrl) { 153 omap2_ctrl_base = omap2_globals->ctrl;
154 omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
155 WARN_ON(!omap2_ctrl_base);
156 }
157 154
158 /* Static mapping, never released */ 155 if (omap2_globals->ctrl_pad)
159 if (omap2_globals->ctrl_pad) { 156 omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
160 omap4_ctrl_pad_base = ioremap(omap2_globals->ctrl_pad, SZ_4K);
161 WARN_ON(!omap4_ctrl_pad_base);
162 }
163} 157}
164 158
165void __iomem *omap_ctrl_base_get(void) 159void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1077ad663f93..0f8e0eb18166 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -16,6 +16,7 @@
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/of.h>
19 20
20#include <mach/hardware.h> 21#include <mach/hardware.h>
21#include <mach/irqs.h> 22#include <mach/irqs.h>
@@ -44,7 +45,7 @@ static int __init omap3_l3_init(void)
44{ 45{
45 int l; 46 int l;
46 struct omap_hwmod *oh; 47 struct omap_hwmod *oh;
47 struct omap_device *od; 48 struct platform_device *pdev;
48 char oh_name[L3_MODULES_MAX_LEN]; 49 char oh_name[L3_MODULES_MAX_LEN];
49 50
50 /* 51 /*
@@ -61,12 +62,12 @@ static int __init omap3_l3_init(void)
61 if (!oh) 62 if (!oh)
62 pr_err("could not look up %s\n", oh_name); 63 pr_err("could not look up %s\n", oh_name);
63 64
64 od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, 65 pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
65 NULL, 0, 0); 66 NULL, 0, 0);
66 67
67 WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); 68 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
68 69
69 return IS_ERR(od) ? PTR_ERR(od) : 0; 70 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
70} 71}
71postcore_initcall(omap3_l3_init); 72postcore_initcall(omap3_l3_init);
72 73
@@ -74,9 +75,13 @@ static int __init omap4_l3_init(void)
74{ 75{
75 int l, i; 76 int l, i;
76 struct omap_hwmod *oh[3]; 77 struct omap_hwmod *oh[3];
77 struct omap_device *od; 78 struct platform_device *pdev;
78 char oh_name[L3_MODULES_MAX_LEN]; 79 char oh_name[L3_MODULES_MAX_LEN];
79 80
81 /* If dtb is there, the devices will be created dynamically */
82 if (of_have_populated_dt())
83 return -ENODEV;
84
80 /* 85 /*
81 * To avoid code running on other OMAPs in 86 * To avoid code running on other OMAPs in
82 * multi-omap builds 87 * multi-omap builds
@@ -92,12 +97,12 @@ static int __init omap4_l3_init(void)
92 pr_err("could not look up %s\n", oh_name); 97 pr_err("could not look up %s\n", oh_name);
93 } 98 }
94 99
95 od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, 100 pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
96 0, NULL, 0, 0); 101 0, NULL, 0, 0);
97 102
98 WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); 103 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
99 104
100 return IS_ERR(od) ? PTR_ERR(od) : 0; 105 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
101} 106}
102postcore_initcall(omap4_l3_init); 107postcore_initcall(omap4_l3_init);
103 108
@@ -221,18 +226,10 @@ static inline void omap_init_camera(void)
221#endif 226#endif
222} 227}
223 228
224struct omap_device_pm_latency omap_keyboard_latency[] = {
225 {
226 .deactivate_func = omap_device_idle_hwmods,
227 .activate_func = omap_device_enable_hwmods,
228 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
229 },
230};
231
232int __init omap4_keyboard_init(struct omap4_keypad_platform_data 229int __init omap4_keyboard_init(struct omap4_keypad_platform_data
233 *sdp4430_keypad_data, struct omap_board_data *bdata) 230 *sdp4430_keypad_data, struct omap_board_data *bdata)
234{ 231{
235 struct omap_device *od; 232 struct platform_device *pdev;
236 struct omap_hwmod *oh; 233 struct omap_hwmod *oh;
237 struct omap4_keypad_platform_data *keypad_data; 234 struct omap4_keypad_platform_data *keypad_data;
238 unsigned int id = -1; 235 unsigned int id = -1;
@@ -247,15 +244,13 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
247 244
248 keypad_data = sdp4430_keypad_data; 245 keypad_data = sdp4430_keypad_data;
249 246
250 od = omap_device_build(name, id, oh, keypad_data, 247 pdev = omap_device_build(name, id, oh, keypad_data,
251 sizeof(struct omap4_keypad_platform_data), 248 sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
252 omap_keyboard_latency,
253 ARRAY_SIZE(omap_keyboard_latency), 0);
254 249
255 if (IS_ERR(od)) { 250 if (IS_ERR(pdev)) {
256 WARN(1, "Can't build omap_device for %s:%s.\n", 251 WARN(1, "Can't build omap_device for %s:%s.\n",
257 name, oh->name); 252 name, oh->name);
258 return PTR_ERR(od); 253 return PTR_ERR(pdev);
259 } 254 }
260 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); 255 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
261 256
@@ -263,18 +258,10 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
263} 258}
264 259
265#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 260#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
266static struct omap_device_pm_latency mbox_latencies[] = {
267 [0] = {
268 .activate_func = omap_device_enable_hwmods,
269 .deactivate_func = omap_device_idle_hwmods,
270 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
271 },
272};
273
274static inline void omap_init_mbox(void) 261static inline void omap_init_mbox(void)
275{ 262{
276 struct omap_hwmod *oh; 263 struct omap_hwmod *oh;
277 struct omap_device *od; 264 struct platform_device *pdev;
278 265
279 oh = omap_hwmod_lookup("mailbox"); 266 oh = omap_hwmod_lookup("mailbox");
280 if (!oh) { 267 if (!oh) {
@@ -282,10 +269,9 @@ static inline void omap_init_mbox(void)
282 return; 269 return;
283 } 270 }
284 271
285 od = omap_device_build("omap-mailbox", -1, oh, NULL, 0, 272 pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
286 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); 273 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
287 WARN(IS_ERR(od), "%s: could not build device, err %ld\n", 274 __func__, PTR_ERR(pdev));
288 __func__, PTR_ERR(od));
289} 275}
290#else 276#else
291static inline void omap_init_mbox(void) { } 277static inline void omap_init_mbox(void) { }
@@ -334,17 +320,9 @@ static inline void omap_init_audio(void) {}
334 320
335#include <plat/mcspi.h> 321#include <plat/mcspi.h>
336 322
337struct omap_device_pm_latency omap_mcspi_latency[] = {
338 [0] = {
339 .deactivate_func = omap_device_idle_hwmods,
340 .activate_func = omap_device_enable_hwmods,
341 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
342 },
343};
344
345static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) 323static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
346{ 324{
347 struct omap_device *od; 325 struct platform_device *pdev;
348 char *name = "omap2_mcspi"; 326 char *name = "omap2_mcspi";
349 struct omap2_mcspi_platform_config *pdata; 327 struct omap2_mcspi_platform_config *pdata;
350 static int spi_num; 328 static int spi_num;
@@ -371,10 +349,9 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
371 } 349 }
372 350
373 spi_num++; 351 spi_num++;
374 od = omap_device_build(name, spi_num, oh, pdata, 352 pdev = omap_device_build(name, spi_num, oh, pdata,
375 sizeof(*pdata), omap_mcspi_latency, 353 sizeof(*pdata), NULL, 0, 0);
376 ARRAY_SIZE(omap_mcspi_latency), 0); 354 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
377 WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n",
378 name, oh->name); 355 name, oh->name);
379 kfree(pdata); 356 kfree(pdata);
380 return 0; 357 return 0;
@@ -698,18 +675,10 @@ static int __init omap2_init_devices(void)
698arch_initcall(omap2_init_devices); 675arch_initcall(omap2_init_devices);
699 676
700#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) 677#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
701static struct omap_device_pm_latency omap_wdt_latency[] = {
702 [0] = {
703 .deactivate_func = omap_device_idle_hwmods,
704 .activate_func = omap_device_enable_hwmods,
705 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
706 },
707};
708
709static int __init omap_init_wdt(void) 678static int __init omap_init_wdt(void)
710{ 679{
711 int id = -1; 680 int id = -1;
712 struct omap_device *od; 681 struct platform_device *pdev;
713 struct omap_hwmod *oh; 682 struct omap_hwmod *oh;
714 char *oh_name = "wd_timer2"; 683 char *oh_name = "wd_timer2";
715 char *dev_name = "omap_wdt"; 684 char *dev_name = "omap_wdt";
@@ -723,10 +692,8 @@ static int __init omap_init_wdt(void)
723 return -EINVAL; 692 return -EINVAL;
724 } 693 }
725 694
726 od = omap_device_build(dev_name, id, oh, NULL, 0, 695 pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
727 omap_wdt_latency, 696 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
728 ARRAY_SIZE(omap_wdt_latency), 0);
729 WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n",
730 dev_name, oh->name); 697 dev_name, oh->name);
731 return 0; 698 return 0;
732} 699}
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index a5b7a236aa5b..8ad0a2f0367d 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -35,14 +35,6 @@ static struct platform_device omap_display_device = {
35 }, 35 },
36}; 36};
37 37
38static struct omap_device_pm_latency omap_dss_latency[] = {
39 [0] = {
40 .deactivate_func = omap_device_idle_hwmods,
41 .activate_func = omap_device_enable_hwmods,
42 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
43 },
44};
45
46struct omap_dss_hwmod_data { 38struct omap_dss_hwmod_data {
47 const char *oh_name; 39 const char *oh_name;
48 const char *dev_name; 40 const char *dev_name;
@@ -78,7 +70,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
78{ 70{
79 int r = 0; 71 int r = 0;
80 struct omap_hwmod *oh; 72 struct omap_hwmod *oh;
81 struct omap_device *od; 73 struct platform_device *pdev;
82 int i, oh_count; 74 int i, oh_count;
83 struct omap_display_platform_data pdata; 75 struct omap_display_platform_data pdata;
84 const struct omap_dss_hwmod_data *curr_dss_hwmod; 76 const struct omap_dss_hwmod_data *curr_dss_hwmod;
@@ -108,13 +100,12 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
108 return -ENODEV; 100 return -ENODEV;
109 } 101 }
110 102
111 od = omap_device_build(curr_dss_hwmod[i].dev_name, 103 pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
112 curr_dss_hwmod[i].id, oh, &pdata, 104 curr_dss_hwmod[i].id, oh, &pdata,
113 sizeof(struct omap_display_platform_data), 105 sizeof(struct omap_display_platform_data),
114 omap_dss_latency, 106 NULL, 0, 0);
115 ARRAY_SIZE(omap_dss_latency), 0);
116 107
117 if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n", 108 if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
118 curr_dss_hwmod[i].oh_name)) 109 curr_dss_hwmod[i].oh_name))
119 return -ENODEV; 110 return -ENODEV;
120 } 111 }
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index c9ff0e79703d..a59a45a0096e 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
87 [CCDN] = 0xd8, 87 [CCDN] = 0xd8,
88}; 88};
89 89
90static struct omap_device_pm_latency omap2_dma_latency[] = {
91 {
92 .deactivate_func = omap_device_idle_hwmods,
93 .activate_func = omap_device_enable_hwmods,
94 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
95 },
96};
97
98static void __iomem *dma_base; 90static void __iomem *dma_base;
99static inline void dma_write(u32 val, int reg, int lch) 91static inline void dma_write(u32 val, int reg, int lch)
100{ 92{
@@ -228,7 +220,7 @@ static u32 configure_dma_errata(void)
228/* One time initializations */ 220/* One time initializations */
229static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) 221static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
230{ 222{
231 struct omap_device *od; 223 struct platform_device *pdev;
232 struct omap_system_dma_plat_info *p; 224 struct omap_system_dma_plat_info *p;
233 struct resource *mem; 225 struct resource *mem;
234 char *name = "omap_dma_system"; 226 char *name = "omap_dma_system";
@@ -258,23 +250,22 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
258 250
259 p->errata = configure_dma_errata(); 251 p->errata = configure_dma_errata();
260 252
261 od = omap_device_build(name, 0, oh, p, sizeof(*p), 253 pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
262 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
263 kfree(p); 254 kfree(p);
264 if (IS_ERR(od)) { 255 if (IS_ERR(pdev)) {
265 pr_err("%s: Can't build omap_device for %s:%s.\n", 256 pr_err("%s: Can't build omap_device for %s:%s.\n",
266 __func__, name, oh->name); 257 __func__, name, oh->name);
267 return PTR_ERR(od); 258 return PTR_ERR(pdev);
268 } 259 }
269 260
270 mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0); 261 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
271 if (!mem) { 262 if (!mem) {
272 dev_err(&od->pdev.dev, "%s: no mem resource\n", __func__); 263 dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
273 return -EINVAL; 264 return -EINVAL;
274 } 265 }
275 dma_base = ioremap(mem->start, resource_size(mem)); 266 dma_base = ioremap(mem->start, resource_size(mem));
276 if (!dma_base) { 267 if (!dma_base) {
277 dev_err(&od->pdev.dev, "%s: ioremap fail\n", __func__); 268 dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
278 return -ENOMEM; 269 return -ENOMEM;
279 } 270 }
280 271
@@ -283,7 +274,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
283 (d->lch_count), GFP_KERNEL); 274 (d->lch_count), GFP_KERNEL);
284 275
285 if (!d->chan) { 276 if (!d->chan) {
286 dev_err(&od->pdev.dev, "%s: kzalloc fail\n", __func__); 277 dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
287 return -ENOMEM; 278 return -ENOMEM;
288 } 279 }
289 return 0; 280 return 0;
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 2765cdc3152d..8cbfbc2918ce 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,17 +24,9 @@
24#include <plat/omap_hwmod.h> 24#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h> 25#include <plat/omap_device.h>
26 26
27static struct omap_device_pm_latency omap_gpio_latency[] = {
28 [0] = {
29 .deactivate_func = omap_device_idle_hwmods,
30 .activate_func = omap_device_enable_hwmods,
31 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
32 },
33};
34
35static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) 27static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
36{ 28{
37 struct omap_device *od; 29 struct platform_device *pdev;
38 struct omap_gpio_platform_data *pdata; 30 struct omap_gpio_platform_data *pdata;
39 struct omap_gpio_dev_attr *dev_attr; 31 struct omap_gpio_dev_attr *dev_attr;
40 char *name = "omap_gpio"; 32 char *name = "omap_gpio";
@@ -107,19 +99,17 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
107 return -EINVAL; 99 return -EINVAL;
108 } 100 }
109 101
110 od = omap_device_build(name, id - 1, oh, pdata, 102 pdev = omap_device_build(name, id - 1, oh, pdata,
111 sizeof(*pdata), omap_gpio_latency, 103 sizeof(*pdata), NULL, 0, false);
112 ARRAY_SIZE(omap_gpio_latency),
113 false);
114 kfree(pdata); 104 kfree(pdata);
115 105
116 if (IS_ERR(od)) { 106 if (IS_ERR(pdev)) {
117 WARN(1, "Can't build omap_device for %s:%s.\n", 107 WARN(1, "Can't build omap_device for %s:%s.\n",
118 name, oh->name); 108 name, oh->name);
119 return PTR_ERR(od); 109 return PTR_ERR(pdev);
120 } 110 }
121 111
122 omap_device_disable_idle_on_suspend(od); 112 omap_device_disable_idle_on_suspend(pdev);
123 113
124 gpio_bank_count++; 114 gpio_bank_count++;
125 return 0; 115 return 0;
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index a9b45c76e1d3..77085847e4e7 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -137,8 +137,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
137 */ 137 */
138 reg = omap4_ctrl_pad_readl(control_pbias_offset); 138 reg = omap4_ctrl_pad_readl(control_pbias_offset);
139 reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 139 reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
140 OMAP4_MMC1_PWRDNZ_MASK | 140 OMAP4_MMC1_PWRDNZ_MASK);
141 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
142 omap4_ctrl_pad_writel(reg, control_pbias_offset); 141 omap4_ctrl_pad_writel(reg, control_pbias_offset);
143} 142}
144 143
@@ -156,8 +155,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
156 else 155 else
157 reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK; 156 reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
158 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 157 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
159 OMAP4_MMC1_PWRDNZ_MASK | 158 OMAP4_MMC1_PWRDNZ_MASK);
160 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
161 omap4_ctrl_pad_writel(reg, control_pbias_offset); 159 omap4_ctrl_pad_writel(reg, control_pbias_offset);
162 160
163 timeout = jiffies + msecs_to_jiffies(5); 161 timeout = jiffies + msecs_to_jiffies(5);
@@ -171,16 +169,14 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
171 if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) { 169 if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
172 pr_err("Pbias Voltage is not same as LDO\n"); 170 pr_err("Pbias Voltage is not same as LDO\n");
173 /* Caution : On VMODE_ERROR Power Down MMC IO */ 171 /* Caution : On VMODE_ERROR Power Down MMC IO */
174 reg &= ~(OMAP4_MMC1_PWRDNZ_MASK | 172 reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
175 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
176 omap4_ctrl_pad_writel(reg, control_pbias_offset); 173 omap4_ctrl_pad_writel(reg, control_pbias_offset);
177 } 174 }
178 } else { 175 } else {
179 reg = omap4_ctrl_pad_readl(control_pbias_offset); 176 reg = omap4_ctrl_pad_readl(control_pbias_offset);
180 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 177 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
181 OMAP4_MMC1_PWRDNZ_MASK | 178 OMAP4_MMC1_PWRDNZ_MASK |
182 OMAP4_MMC1_PBIASLITE_VMODE_MASK | 179 OMAP4_MMC1_PBIASLITE_VMODE_MASK);
183 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
184 omap4_ctrl_pad_writel(reg, control_pbias_offset); 180 omap4_ctrl_pad_writel(reg, control_pbias_offset);
185 } 181 }
186} 182}
@@ -413,31 +409,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
413 return 0; 409 return 0;
414} 410}
415 411
416static struct omap_device_pm_latency omap_hsmmc_latency[] = {
417 [0] = {
418 .deactivate_func = omap_device_idle_hwmods,
419 .activate_func = omap_device_enable_hwmods,
420 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
421 },
422 /*
423 * XXX There should also be an entry here to power off/on the
424 * MMC regulators/PBIAS cells, etc.
425 */
426};
427
428#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 412#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
429 413
430void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) 414void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
431{ 415{
432 struct omap_hwmod *oh; 416 struct omap_hwmod *oh;
433 struct omap_device *od; 417 struct platform_device *pdev;
434 struct omap_device_pm_latency *ohl;
435 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; 418 char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
436 struct omap_mmc_platform_data *mmc_data; 419 struct omap_mmc_platform_data *mmc_data;
437 struct omap_mmc_dev_attr *mmc_dev_attr; 420 struct omap_mmc_dev_attr *mmc_dev_attr;
438 char *name; 421 char *name;
439 int l; 422 int l;
440 int ohl_cnt = 0;
441 423
442 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL); 424 mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
443 if (!mmc_data) { 425 if (!mmc_data) {
@@ -452,8 +434,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
452 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1)); 434 omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
453 435
454 name = "omap_hsmmc"; 436 name = "omap_hsmmc";
455 ohl = omap_hsmmc_latency;
456 ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
457 437
458 l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN, 438 l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
459 "mmc%d", ctrl_nr); 439 "mmc%d", ctrl_nr);
@@ -471,9 +451,9 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
471 mmc_data->controller_flags = mmc_dev_attr->flags; 451 mmc_data->controller_flags = mmc_dev_attr->flags;
472 } 452 }
473 453
474 od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, 454 pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
475 sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); 455 sizeof(struct omap_mmc_platform_data), NULL, 0, false);
476 if (IS_ERR(od)) { 456 if (IS_ERR(pdev)) {
477 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); 457 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
478 kfree(mmc_data->slots[0].name); 458 kfree(mmc_data->slots[0].name);
479 goto done; 459 goto done;
@@ -482,7 +462,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
482 * return device handle to board setup code 462 * return device handle to board setup code
483 * required to populate for regulator framework structure 463 * required to populate for regulator framework structure
484 */ 464 */
485 hsmmcinfo->dev = &od->pdev.dev; 465 hsmmcinfo->dev = &pdev->dev;
486 466
487done: 467done:
488 kfree(mmc_data); 468 kfree(mmc_data);
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 06d4a80660a5..36e21091b06a 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -23,19 +23,11 @@
23#include <plat/omap_hwmod.h> 23#include <plat/omap_hwmod.h>
24#include <plat/omap_device.h> 24#include <plat/omap_device.h>
25 25
26struct omap_device_pm_latency omap_spinlock_latency[] = {
27 {
28 .deactivate_func = omap_device_idle_hwmods,
29 .activate_func = omap_device_enable_hwmods,
30 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
31 }
32};
33
34int __init hwspinlocks_init(void) 26int __init hwspinlocks_init(void)
35{ 27{
36 int retval = 0; 28 int retval = 0;
37 struct omap_hwmod *oh; 29 struct omap_hwmod *oh;
38 struct omap_device *od; 30 struct platform_device *pdev;
39 const char *oh_name = "spinlock"; 31 const char *oh_name = "spinlock";
40 const char *dev_name = "omap_hwspinlock"; 32 const char *dev_name = "omap_hwspinlock";
41 33
@@ -48,13 +40,11 @@ int __init hwspinlocks_init(void)
48 if (oh == NULL) 40 if (oh == NULL)
49 return -EINVAL; 41 return -EINVAL;
50 42
51 od = omap_device_build(dev_name, 0, oh, NULL, 0, 43 pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
52 omap_spinlock_latency, 44 if (IS_ERR(pdev)) {
53 ARRAY_SIZE(omap_spinlock_latency), false);
54 if (IS_ERR(od)) {
55 pr_err("Can't build omap_device for %s:%s\n", dev_name, 45 pr_err("Can't build omap_device for %s:%s\n", dev_name,
56 oh_name); 46 oh_name);
57 retval = PTR_ERR(od); 47 retval = PTR_ERR(pdev);
58 } 48 }
59 49
60 return retval; 50 return retval;
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 37efb8696927..d27daf921c7e 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -28,7 +28,6 @@
28 28
29#include "control.h" 29#include "control.h"
30 30
31static struct omap_chip_id omap_chip;
32static unsigned int omap_revision; 31static unsigned int omap_revision;
33 32
34u32 omap_features; 33u32 omap_features;
@@ -39,19 +38,6 @@ unsigned int omap_rev(void)
39} 38}
40EXPORT_SYMBOL(omap_rev); 39EXPORT_SYMBOL(omap_rev);
41 40
42/**
43 * omap_chip_is - test whether currently running OMAP matches a chip type
44 * @oc: omap_chip_t to test against
45 *
46 * Test whether the currently-running OMAP chip matches the supplied
47 * chip type 'oc'. Returns 1 upon a match; 0 upon failure.
48 */
49int omap_chip_is(struct omap_chip_id oci)
50{
51 return (oci.oc & omap_chip.oc) ? 1 : 0;
52}
53EXPORT_SYMBOL(omap_chip_is);
54
55int omap_type(void) 41int omap_type(void)
56{ 42{
57 u32 val = 0; 43 u32 val = 0;
@@ -242,14 +228,12 @@ static void __init ti816x_check_features(void)
242 omap_features = OMAP3_HAS_NEON; 228 omap_features = OMAP3_HAS_NEON;
243} 229}
244 230
245static void __init omap3_check_revision(void) 231static void __init omap3_check_revision(const char **cpu_rev)
246{ 232{
247 u32 cpuid, idcode; 233 u32 cpuid, idcode;
248 u16 hawkeye; 234 u16 hawkeye;
249 u8 rev; 235 u8 rev;
250 236
251 omap_chip.oc = CHIP_IS_OMAP3430;
252
253 /* 237 /*
254 * We cannot access revision registers on ES1.0. 238 * We cannot access revision registers on ES1.0.
255 * If the processor type is Cortex-A8 and the revision is 0x0 239 * If the processor type is Cortex-A8 and the revision is 0x0
@@ -258,7 +242,7 @@ static void __init omap3_check_revision(void)
258 cpuid = read_cpuid(CPUID_ID); 242 cpuid = read_cpuid(CPUID_ID);
259 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 243 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
260 omap_revision = OMAP3430_REV_ES1_0; 244 omap_revision = OMAP3430_REV_ES1_0;
261 omap_chip.oc |= CHIP_IS_OMAP3430ES1; 245 *cpu_rev = "1.0";
262 return; 246 return;
263 } 247 }
264 248
@@ -279,77 +263,85 @@ static void __init omap3_check_revision(void)
279 case 0: /* Take care of early samples */ 263 case 0: /* Take care of early samples */
280 case 1: 264 case 1:
281 omap_revision = OMAP3430_REV_ES2_0; 265 omap_revision = OMAP3430_REV_ES2_0;
282 omap_chip.oc |= CHIP_IS_OMAP3430ES2; 266 *cpu_rev = "2.0";
283 break; 267 break;
284 case 2: 268 case 2:
285 omap_revision = OMAP3430_REV_ES2_1; 269 omap_revision = OMAP3430_REV_ES2_1;
286 omap_chip.oc |= CHIP_IS_OMAP3430ES2; 270 *cpu_rev = "2.1";
287 break; 271 break;
288 case 3: 272 case 3:
289 omap_revision = OMAP3430_REV_ES3_0; 273 omap_revision = OMAP3430_REV_ES3_0;
290 omap_chip.oc |= CHIP_IS_OMAP3430ES3_0; 274 *cpu_rev = "3.0";
291 break; 275 break;
292 case 4: 276 case 4:
293 omap_revision = OMAP3430_REV_ES3_1; 277 omap_revision = OMAP3430_REV_ES3_1;
294 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 278 *cpu_rev = "3.1";
295 break; 279 break;
296 case 7: 280 case 7:
297 /* FALLTHROUGH */ 281 /* FALLTHROUGH */
298 default: 282 default:
299 /* Use the latest known revision as default */ 283 /* Use the latest known revision as default */
300 omap_revision = OMAP3430_REV_ES3_1_2; 284 omap_revision = OMAP3430_REV_ES3_1_2;
301 285 *cpu_rev = "3.1.2";
302 /* REVISIT: Add CHIP_IS_OMAP3430ES3_1_2? */
303 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1;
304 } 286 }
305 break; 287 break;
306 case 0xb868: 288 case 0xb868:
307 /* Handle OMAP35xx/AM35xx devices 289 /*
290 * Handle OMAP/AM 3505/3517 devices
308 * 291 *
309 * Set the device to be OMAP3505 here. Actual device 292 * Set the device to be OMAP3517 here. Actual device
310 * is identified later based on the features. 293 * is identified later based on the features.
311 *
312 * REVISIT: AM3505/AM3517 should have their own CHIP_IS
313 */ 294 */
314 omap_revision = OMAP3505_REV(rev); 295 switch (rev) {
315 omap_chip.oc |= CHIP_IS_OMAP3430ES3_1; 296 case 0:
297 omap_revision = OMAP3517_REV_ES1_0;
298 *cpu_rev = "1.0";
299 break;
300 case 1:
301 /* FALLTHROUGH */
302 default:
303 omap_revision = OMAP3517_REV_ES1_1;
304 *cpu_rev = "1.1";
305 }
316 break; 306 break;
317 case 0xb891: 307 case 0xb891:
318 /* Handle 36xx devices */ 308 /* Handle 36xx devices */
319 omap_chip.oc |= CHIP_IS_OMAP3630ES1;
320 309
321 switch(rev) { 310 switch(rev) {
322 case 0: /* Take care of early samples */ 311 case 0: /* Take care of early samples */
323 omap_revision = OMAP3630_REV_ES1_0; 312 omap_revision = OMAP3630_REV_ES1_0;
313 *cpu_rev = "1.0";
324 break; 314 break;
325 case 1: 315 case 1:
326 omap_revision = OMAP3630_REV_ES1_1; 316 omap_revision = OMAP3630_REV_ES1_1;
327 omap_chip.oc |= CHIP_IS_OMAP3630ES1_1; 317 *cpu_rev = "1.1";
328 break; 318 break;
329 case 2: 319 case 2:
320 /* FALLTHROUGH */
330 default: 321 default:
331 omap_revision = OMAP3630_REV_ES1_2; 322 omap_revision = OMAP3630_REV_ES1_2;
332 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2; 323 *cpu_rev = "1.2";
333 } 324 }
334 break; 325 break;
335 case 0xb81e: 326 case 0xb81e:
336 omap_chip.oc = CHIP_IS_TI816X;
337
338 switch (rev) { 327 switch (rev) {
339 case 0: 328 case 0:
340 omap_revision = TI8168_REV_ES1_0; 329 omap_revision = TI8168_REV_ES1_0;
330 *cpu_rev = "1.0";
341 break; 331 break;
342 case 1: 332 case 1:
333 /* FALLTHROUGH */
334 default:
343 omap_revision = TI8168_REV_ES1_1; 335 omap_revision = TI8168_REV_ES1_1;
336 *cpu_rev = "1.1";
344 break; 337 break;
345 default:
346 omap_revision = TI8168_REV_ES1_1;
347 } 338 }
348 break; 339 break;
349 default: 340 default:
350 /* Unknown default to latest silicon rev as default*/ 341 /* Unknown default to latest silicon rev as default */
351 omap_revision = OMAP3630_REV_ES1_2; 342 omap_revision = OMAP3630_REV_ES1_2;
352 omap_chip.oc |= CHIP_IS_OMAP3630ES1_2; 343 *cpu_rev = "1.2";
344 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
353 } 345 }
354} 346}
355 347
@@ -382,24 +374,20 @@ static void __init omap4_check_revision(void)
382 switch (rev) { 374 switch (rev) {
383 case 0: 375 case 0:
384 omap_revision = OMAP4430_REV_ES1_0; 376 omap_revision = OMAP4430_REV_ES1_0;
385 omap_chip.oc |= CHIP_IS_OMAP4430ES1;
386 break; 377 break;
387 case 1: 378 case 1:
388 default: 379 default:
389 omap_revision = OMAP4430_REV_ES2_0; 380 omap_revision = OMAP4430_REV_ES2_0;
390 omap_chip.oc |= CHIP_IS_OMAP4430ES2;
391 } 381 }
392 break; 382 break;
393 case 0xb95c: 383 case 0xb95c:
394 switch (rev) { 384 switch (rev) {
395 case 3: 385 case 3:
396 omap_revision = OMAP4430_REV_ES2_1; 386 omap_revision = OMAP4430_REV_ES2_1;
397 omap_chip.oc |= CHIP_IS_OMAP4430ES2_1;
398 break; 387 break;
399 case 4: 388 case 4:
400 default: 389 default:
401 omap_revision = OMAP4430_REV_ES2_2; 390 omap_revision = OMAP4430_REV_ES2_2;
402 omap_chip.oc |= CHIP_IS_OMAP4430ES2_2;
403 } 391 }
404 break; 392 break;
405 case 0xb94e: 393 case 0xb94e:
@@ -407,14 +395,12 @@ static void __init omap4_check_revision(void)
407 case 0: 395 case 0:
408 default: 396 default:
409 omap_revision = OMAP4460_REV_ES1_0; 397 omap_revision = OMAP4460_REV_ES1_0;
410 omap_chip.oc |= CHIP_IS_OMAP4460ES1_0;
411 break; 398 break;
412 } 399 }
413 break; 400 break;
414 default: 401 default:
415 /* Unknown default to latest silicon rev as default */ 402 /* Unknown default to latest silicon rev as default */
416 omap_revision = OMAP4430_REV_ES2_2; 403 omap_revision = OMAP4430_REV_ES2_2;
417 omap_chip.oc |= CHIP_IS_OMAP4430ES2_2;
418 } 404 }
419 405
420 pr_info("OMAP%04x ES%d.%d\n", omap_rev() >> 16, 406 pr_info("OMAP%04x ES%d.%d\n", omap_rev() >> 16,
@@ -425,94 +411,33 @@ static void __init omap4_check_revision(void)
425 if (omap3_has_ ##feat()) \ 411 if (omap3_has_ ##feat()) \
426 printk(#feat" "); 412 printk(#feat" ");
427 413
428static void __init omap3_cpuinfo(void) 414static void __init omap3_cpuinfo(const char *cpu_rev)
429{ 415{
430 u8 rev = GET_OMAP_REVISION(); 416 const char *cpu_name;
431 char cpu_name[16], cpu_rev[16];
432 417
433 /* OMAP3430 and OMAP3530 are assumed to be same. 418 /*
419 * OMAP3430 and OMAP3530 are assumed to be same.
434 * 420 *
435 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based 421 * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
436 * on available features. Upon detection, update the CPU id 422 * on available features. Upon detection, update the CPU id
437 * and CPU class bits. 423 * and CPU class bits.
438 */ 424 */
439 if (cpu_is_omap3630()) { 425 if (cpu_is_omap3630()) {
440 strcpy(cpu_name, "OMAP3630"); 426 cpu_name = "OMAP3630";
441 } else if (cpu_is_omap3505()) { 427 } else if (cpu_is_omap3517()) {
442 /* 428 /* AM35xx devices */
443 * AM35xx devices 429 cpu_name = (omap3_has_sgx()) ? "AM3517" : "AM3505";
444 */
445 if (omap3_has_sgx()) {
446 omap_revision = OMAP3517_REV(rev);
447 strcpy(cpu_name, "AM3517");
448 } else {
449 /* Already set in omap3_check_revision() */
450 strcpy(cpu_name, "AM3505");
451 }
452 } else if (cpu_is_ti816x()) { 430 } else if (cpu_is_ti816x()) {
453 strcpy(cpu_name, "TI816X"); 431 cpu_name = "TI816X";
454 } else if (omap3_has_iva() && omap3_has_sgx()) { 432 } else if (omap3_has_iva() && omap3_has_sgx()) {
455 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */ 433 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
456 strcpy(cpu_name, "OMAP3430/3530"); 434 cpu_name = "OMAP3430/3530";
457 } else if (omap3_has_iva()) { 435 } else if (omap3_has_iva()) {
458 omap_revision = OMAP3525_REV(rev); 436 cpu_name = "OMAP3525";
459 strcpy(cpu_name, "OMAP3525");
460 } else if (omap3_has_sgx()) { 437 } else if (omap3_has_sgx()) {
461 omap_revision = OMAP3515_REV(rev); 438 cpu_name = "OMAP3515";
462 strcpy(cpu_name, "OMAP3515");
463 } else { 439 } else {
464 omap_revision = OMAP3503_REV(rev); 440 cpu_name = "OMAP3503";
465 strcpy(cpu_name, "OMAP3503");
466 }
467
468 if (cpu_is_omap3630() || cpu_is_ti816x()) {
469 switch (rev) {
470 case OMAP_REVBITS_00:
471 strcpy(cpu_rev, "1.0");
472 break;
473 case OMAP_REVBITS_01:
474 strcpy(cpu_rev, "1.1");
475 break;
476 case OMAP_REVBITS_02:
477 /* FALLTHROUGH */
478 default:
479 /* Use the latest known revision as default */
480 strcpy(cpu_rev, "1.2");
481 }
482 } else if (cpu_is_omap3505() || cpu_is_omap3517()) {
483 switch (rev) {
484 case OMAP_REVBITS_00:
485 strcpy(cpu_rev, "1.0");
486 break;
487 case OMAP_REVBITS_01:
488 /* FALLTHROUGH */
489 default:
490 /* Use the latest known revision as default */
491 strcpy(cpu_rev, "1.1");
492 }
493 } else {
494 switch (rev) {
495 case OMAP_REVBITS_00:
496 strcpy(cpu_rev, "1.0");
497 break;
498 case OMAP_REVBITS_01:
499 strcpy(cpu_rev, "2.0");
500 break;
501 case OMAP_REVBITS_02:
502 strcpy(cpu_rev, "2.1");
503 break;
504 case OMAP_REVBITS_03:
505 strcpy(cpu_rev, "3.0");
506 break;
507 case OMAP_REVBITS_04:
508 strcpy(cpu_rev, "3.1");
509 break;
510 case OMAP_REVBITS_05:
511 /* FALLTHROUGH */
512 default:
513 /* Use the latest known revision as default */
514 strcpy(cpu_rev, "3.1.2");
515 }
516 } 441 }
517 442
518 /* Print verbose information */ 443 /* Print verbose information */
@@ -533,6 +458,8 @@ static void __init omap3_cpuinfo(void)
533 */ 458 */
534void __init omap2_check_revision(void) 459void __init omap2_check_revision(void)
535{ 460{
461 const char *cpu_rev;
462
536 /* 463 /*
537 * At this point we have an idea about the processor revision set 464 * At this point we have an idea about the processor revision set
538 * earlier with omap2_set_globals_tap(). 465 * earlier with omap2_set_globals_tap().
@@ -540,7 +467,7 @@ void __init omap2_check_revision(void)
540 if (cpu_is_omap24xx()) { 467 if (cpu_is_omap24xx()) {
541 omap24xx_check_revision(); 468 omap24xx_check_revision();
542 } else if (cpu_is_omap34xx()) { 469 } else if (cpu_is_omap34xx()) {
543 omap3_check_revision(); 470 omap3_check_revision(&cpu_rev);
544 471
545 /* TI816X doesn't have feature register */ 472 /* TI816X doesn't have feature register */
546 if (!cpu_is_ti816x()) 473 if (!cpu_is_ti816x())
@@ -548,7 +475,7 @@ void __init omap2_check_revision(void)
548 else 475 else
549 ti816x_check_features(); 476 ti816x_check_features();
550 477
551 omap3_cpuinfo(); 478 omap3_cpuinfo(cpu_rev);
552 return; 479 return;
553 } else if (cpu_is_omap44xx()) { 480 } else if (cpu_is_omap44xx()) {
554 omap4_check_revision(); 481 omap4_check_revision();
@@ -557,22 +484,6 @@ void __init omap2_check_revision(void)
557 } else { 484 } else {
558 pr_err("OMAP revision unknown, please fix!\n"); 485 pr_err("OMAP revision unknown, please fix!\n");
559 } 486 }
560
561 /*
562 * OK, now we know the exact revision. Initialize omap_chip bits
563 * for powerdowmain and clockdomain code.
564 */
565 if (cpu_is_omap243x()) {
566 /* Currently only supports 2430ES2.1 and 2430-all */
567 omap_chip.oc |= CHIP_IS_OMAP2430;
568 return;
569 } else if (cpu_is_omap242x()) {
570 /* Currently only supports 2420ES2.1.1 and 2420-all */
571 omap_chip.oc |= CHIP_IS_OMAP2420;
572 return;
573 }
574
575 pr_err("Uninitialized omap_chip, please fix!\n");
576} 487}
577 488
578/* 489/*
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2ce1ce6fb4db..aa96538f3fee 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -35,14 +35,16 @@
35#include "clock2xxx.h" 35#include "clock2xxx.h"
36#include "clock3xxx.h" 36#include "clock3xxx.h"
37#include "clock44xx.h" 37#include "clock44xx.h"
38#include "io.h"
39 38
39#include <plat/common.h>
40#include <plat/omap-pm.h> 40#include <plat/omap-pm.h>
41#include "voltage.h"
41#include "powerdomain.h" 42#include "powerdomain.h"
42 43
43#include "clockdomain.h" 44#include "clockdomain.h"
44#include <plat/omap_hwmod.h> 45#include <plat/omap_hwmod.h>
45#include <plat/multi.h> 46#include <plat/multi.h>
47#include <plat/common.h>
46 48
47/* 49/*
48 * The machine specific code may provide the extra mapping besides the 50 * The machine specific code may provide the extra mapping besides the
@@ -239,25 +241,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
239}; 241};
240#endif 242#endif
241 243
242static void __init _omap2_map_common_io(void)
243{
244 /* Normally devicemaps_init() would flush caches and tlb after
245 * mdesc->map_io(), but we must also do it here because of the CPU
246 * revision check below.
247 */
248 local_flush_tlb_all();
249 flush_cache_all();
250
251 omap2_check_revision();
252 omap_sram_init();
253}
254
255#ifdef CONFIG_SOC_OMAP2420 244#ifdef CONFIG_SOC_OMAP2420
256void __init omap242x_map_common_io(void) 245void __init omap242x_map_common_io(void)
257{ 246{
258 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 247 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
259 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 248 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
260 _omap2_map_common_io();
261} 249}
262#endif 250#endif
263 251
@@ -266,7 +254,6 @@ void __init omap243x_map_common_io(void)
266{ 254{
267 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 255 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
268 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 256 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
269 _omap2_map_common_io();
270} 257}
271#endif 258#endif
272 259
@@ -274,7 +261,6 @@ void __init omap243x_map_common_io(void)
274void __init omap34xx_map_common_io(void) 261void __init omap34xx_map_common_io(void)
275{ 262{
276 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 263 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
277 _omap2_map_common_io();
278} 264}
279#endif 265#endif
280 266
@@ -282,7 +268,6 @@ void __init omap34xx_map_common_io(void)
282void __init omapti816x_map_common_io(void) 268void __init omapti816x_map_common_io(void)
283{ 269{
284 iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc)); 270 iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
285 _omap2_map_common_io();
286} 271}
287#endif 272#endif
288 273
@@ -290,7 +275,6 @@ void __init omapti816x_map_common_io(void)
290void __init omap44xx_map_common_io(void) 275void __init omap44xx_map_common_io(void)
291{ 276{
292 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 277 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
293 _omap2_map_common_io();
294} 278}
295#endif 279#endif
296 280
@@ -336,29 +320,15 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
336/* See irq.c, omap4-common.c and entry-macro.S */ 320/* See irq.c, omap4-common.c and entry-macro.S */
337void __iomem *omap_irq_base; 321void __iomem *omap_irq_base;
338 322
339void __init omap2_init_common_infrastructure(void) 323static void __init omap_common_init_early(void)
340{ 324{
341 u8 postsetup_state; 325 omap2_check_revision();
326 omap_ioremap_init();
327}
342 328
343 if (cpu_is_omap242x()) { 329static void __init omap_hwmod_init_postsetup(void)
344 omap2xxx_powerdomains_init(); 330{
345 omap2xxx_clockdomains_init(); 331 u8 postsetup_state;
346 omap2420_hwmod_init();
347 } else if (cpu_is_omap243x()) {
348 omap2xxx_powerdomains_init();
349 omap2xxx_clockdomains_init();
350 omap2430_hwmod_init();
351 } else if (cpu_is_omap34xx()) {
352 omap3xxx_powerdomains_init();
353 omap3xxx_clockdomains_init();
354 omap3xxx_hwmod_init();
355 } else if (cpu_is_omap44xx()) {
356 omap44xx_powerdomains_init();
357 omap44xx_clockdomains_init();
358 omap44xx_hwmod_init();
359 } else {
360 pr_err("Could not init hwmod data - unknown SoC\n");
361 }
362 332
363 /* Set the default postsetup state for all hwmods */ 333 /* Set the default postsetup state for all hwmods */
364#ifdef CONFIG_PM_RUNTIME 334#ifdef CONFIG_PM_RUNTIME
@@ -376,7 +346,7 @@ void __init omap2_init_common_infrastructure(void)
376 * omap_hwmod_late_init(), so boards that desire full watchdog 346 * omap_hwmod_late_init(), so boards that desire full watchdog
377 * coverage of kernel initialization can reprogram the 347 * coverage of kernel initialization can reprogram the
378 * postsetup_state between the calls to 348 * postsetup_state between the calls to
379 * omap2_init_common_infra() and omap2_init_common_devices(). 349 * omap2_init_common_infra() and omap_sdrc_init().
380 * 350 *
381 * XXX ideally we could detect whether the MPU WDT was currently 351 * XXX ideally we could detect whether the MPU WDT was currently
382 * enabled here and make this conditional 352 * enabled here and make this conditional
@@ -387,27 +357,101 @@ void __init omap2_init_common_infrastructure(void)
387 &postsetup_state); 357 &postsetup_state);
388 358
389 omap_pm_if_early_init(); 359 omap_pm_if_early_init();
360}
361
362void __init omap2420_init_early(void)
363{
364 omap2_set_globals_242x();
365 omap_common_init_early();
366 omap2xxx_voltagedomains_init();
367 omap242x_powerdomains_init();
368 omap242x_clockdomains_init();
369 omap2420_hwmod_init();
370 omap_hwmod_init_postsetup();
371 omap2420_clk_init();
372}
390 373
391 if (cpu_is_omap2420()) 374void __init omap2430_init_early(void)
392 omap2420_clk_init(); 375{
393 else if (cpu_is_omap2430()) 376 omap2_set_globals_243x();
394 omap2430_clk_init(); 377 omap_common_init_early();
395 else if (cpu_is_omap34xx()) 378 omap2xxx_voltagedomains_init();
396 omap3xxx_clk_init(); 379 omap243x_powerdomains_init();
397 else if (cpu_is_omap44xx()) 380 omap243x_clockdomains_init();
398 omap4xxx_clk_init(); 381 omap2430_hwmod_init();
399 else 382 omap_hwmod_init_postsetup();
400 pr_err("Could not init clock framework - unknown SoC\n"); 383 omap2430_clk_init();
384}
385
386/*
387 * Currently only board-omap3beagle.c should call this because of the
388 * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
389 */
390void __init omap3_init_early(void)
391{
392 omap2_set_globals_3xxx();
393 omap_common_init_early();
394 omap3xxx_voltagedomains_init();
395 omap3xxx_powerdomains_init();
396 omap3xxx_clockdomains_init();
397 omap3xxx_hwmod_init();
398 omap_hwmod_init_postsetup();
399 omap3xxx_clk_init();
401} 400}
402 401
403void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, 402void __init omap3430_init_early(void)
403{
404 omap3_init_early();
405}
406
407void __init omap35xx_init_early(void)
408{
409 omap3_init_early();
410}
411
412void __init omap3630_init_early(void)
413{
414 omap3_init_early();
415}
416
417void __init am35xx_init_early(void)
418{
419 omap3_init_early();
420}
421
422void __init ti816x_init_early(void)
423{
424 omap2_set_globals_ti816x();
425 omap_common_init_early();
426 omap3xxx_voltagedomains_init();
427 omap3xxx_powerdomains_init();
428 omap3xxx_clockdomains_init();
429 omap3xxx_hwmod_init();
430 omap_hwmod_init_postsetup();
431 omap3xxx_clk_init();
432}
433
434void __init omap4430_init_early(void)
435{
436 omap2_set_globals_443x();
437 omap_common_init_early();
438 omap44xx_voltagedomains_init();
439 omap44xx_powerdomains_init();
440 omap44xx_clockdomains_init();
441 omap44xx_hwmod_init();
442 omap_hwmod_init_postsetup();
443 omap4xxx_clk_init();
444}
445
446void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
404 struct omap_sdrc_params *sdrc_cs1) 447 struct omap_sdrc_params *sdrc_cs1)
405{ 448{
449 omap_sram_init();
450
406 if (cpu_is_omap24xx() || omap3_has_sdrc()) { 451 if (cpu_is_omap24xx() || omap3_has_sdrc()) {
407 omap2_sdrc_init(sdrc_cs0, sdrc_cs1); 452 omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
408 _omap2_init_reprogram_sdrc(); 453 _omap2_init_reprogram_sdrc();
409 } 454 }
410
411} 455}
412 456
413/* 457/*
diff --git a/arch/arm/mach-omap2/io.h b/arch/arm/mach-omap2/io.h
index fd230c6cded5..e69de29bb2d1 100644
--- a/arch/arm/mach-omap2/io.h
+++ b/arch/arm/mach-omap2/io.h
@@ -1,7 +0,0 @@
1
2#ifndef __MACH_OMAP2_IO_H__
3#define __MACH_OMAP2_IO_H__
4
5extern int __init omap_sram_init(void);
6
7#endif /* __MACH_OMAP2_IO_H__ */
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 3a12f7586a4c..65f1be6a182c 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -165,8 +165,8 @@ static void __init omap_init_irq(u32 base, int nr_irqs)
165 165
166 omap_irq_bank_init_one(bank); 166 omap_irq_bank_init_one(bank);
167 167
168 for (i = 0, j = 0; i < bank->nr_irqs; i += 32, j += 0x20) 168 for (j = 0; j < bank->nr_irqs; j += 32)
169 omap_alloc_gc(bank->base_reg + j, i, 32); 169 omap_alloc_gc(bank->base_reg + j, j, 32);
170 170
171 nr_of_irqs += bank->nr_irqs; 171 nr_of_irqs += bank->nr_irqs;
172 nr_banks++; 172 nr_banks++;
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 4a6ef6ab8458..292eee3be15f 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -27,66 +27,69 @@
27 27
28#include "control.h" 28#include "control.h"
29 29
30/* McBSP internal signal muxing functions */ 30/*
31 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
32 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
33 */
34#include "cm2xxx_3xxx.h"
35#include "cm-regbits-34xx.h"
31 36
32void omap2_mcbsp1_mux_clkr_src(u8 mux) 37/* McBSP internal signal muxing function */
38static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
39 const char *src)
33{ 40{
34 u32 v; 41 u32 v;
35 42
36 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); 43 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
37 if (mux == CLKR_SRC_CLKR)
38 v &= ~OMAP2_MCBSP1_CLKR_MASK;
39 else if (mux == CLKR_SRC_CLKX)
40 v |= OMAP2_MCBSP1_CLKR_MASK;
41 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
42}
43EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
44 44
45void omap2_mcbsp1_mux_fsr_src(u8 mux) 45 if (!strcmp(signal, "clkr")) {
46{ 46 if (!strcmp(src, "clkr"))
47 u32 v; 47 v &= ~OMAP2_MCBSP1_CLKR_MASK;
48 else if (!strcmp(src, "clkx"))
49 v |= OMAP2_MCBSP1_CLKR_MASK;
50 else
51 return -EINVAL;
52 } else if (!strcmp(signal, "fsr")) {
53 if (!strcmp(src, "fsr"))
54 v &= ~OMAP2_MCBSP1_FSR_MASK;
55 else if (!strcmp(src, "fsx"))
56 v |= OMAP2_MCBSP1_FSR_MASK;
57 else
58 return -EINVAL;
59 } else {
60 return -EINVAL;
61 }
48 62
49 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
50 if (mux == FSR_SRC_FSR)
51 v &= ~OMAP2_MCBSP1_FSR_MASK;
52 else if (mux == FSR_SRC_FSX)
53 v |= OMAP2_MCBSP1_FSR_MASK;
54 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); 63 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
64
65 return 0;
55} 66}
56EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
57 67
58/* McBSP CLKS source switching function */ 68/* McBSP CLKS source switching function */
59 69static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
60int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) 70 const char *src)
61{ 71{
62 struct omap_mcbsp *mcbsp;
63 struct clk *fck_src; 72 struct clk *fck_src;
64 char *fck_src_name; 73 char *fck_src_name;
65 int r; 74 int r;
66 75
67 if (!omap_mcbsp_check_valid_id(id)) { 76 if (!strcmp(src, "clks_ext"))
68 pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
69 return -EINVAL;
70 }
71 mcbsp = id_to_mcbsp_ptr(id);
72
73 if (fck_src_id == MCBSP_CLKS_PAD_SRC)
74 fck_src_name = "pad_fck"; 77 fck_src_name = "pad_fck";
75 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) 78 else if (!strcmp(src, "clks_fclk"))
76 fck_src_name = "prcm_fck"; 79 fck_src_name = "prcm_fck";
77 else 80 else
78 return -EINVAL; 81 return -EINVAL;
79 82
80 fck_src = clk_get(mcbsp->dev, fck_src_name); 83 fck_src = clk_get(dev, fck_src_name);
81 if (IS_ERR_OR_NULL(fck_src)) { 84 if (IS_ERR_OR_NULL(fck_src)) {
82 pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks", 85 pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
83 fck_src_name); 86 fck_src_name);
84 return -EINVAL; 87 return -EINVAL;
85 } 88 }
86 89
87 pm_runtime_put_sync(mcbsp->dev); 90 pm_runtime_put_sync(dev);
88 91
89 r = clk_set_parent(mcbsp->fclk, fck_src); 92 r = clk_set_parent(clk, fck_src);
90 if (IS_ERR_VALUE(r)) { 93 if (IS_ERR_VALUE(r)) {
91 pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n", 94 pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
92 "clks", fck_src_name); 95 "clks", fck_src_name);
@@ -94,21 +97,30 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
94 return -EINVAL; 97 return -EINVAL;
95 } 98 }
96 99
97 pm_runtime_get_sync(mcbsp->dev); 100 pm_runtime_get_sync(dev);
98 101
99 clk_put(fck_src); 102 clk_put(fck_src);
100 103
101 return 0; 104 return 0;
102} 105}
103EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
104 106
105struct omap_device_pm_latency omap2_mcbsp_latency[] = { 107static int omap3_enable_st_clock(unsigned int id, bool enable)
106 { 108{
107 .deactivate_func = omap_device_idle_hwmods, 109 unsigned int w;
108 .activate_func = omap_device_enable_hwmods, 110
109 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, 111 /*
110 }, 112 * Sidetone uses McBSP ICLK - which must not idle when sidetones
111}; 113 * are enabled or sidetones start sounding ugly.
114 */
115 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
116 if (enable)
117 w &= ~(1 << (id - 2));
118 else
119 w |= 1 << (id - 2);
120 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
121
122 return 0;
123}
112 124
113static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) 125static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
114{ 126{
@@ -116,7 +128,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
116 char *name = "omap-mcbsp"; 128 char *name = "omap-mcbsp";
117 struct omap_hwmod *oh_device[2]; 129 struct omap_hwmod *oh_device[2];
118 struct omap_mcbsp_platform_data *pdata = NULL; 130 struct omap_mcbsp_platform_data *pdata = NULL;
119 struct omap_device *od; 131 struct platform_device *pdev;
120 132
121 sscanf(oh->name, "mcbsp%d", &id); 133 sscanf(oh->name, "mcbsp%d", &id);
122 134
@@ -126,7 +138,13 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
126 return -ENOMEM; 138 return -ENOMEM;
127 } 139 }
128 140
129 pdata->mcbsp_config_type = oh->class->rev; 141 pdata->reg_step = 4;
142 if (oh->class->rev < MCBSP_CONFIG_TYPE2) {
143 pdata->reg_size = 2;
144 } else {
145 pdata->reg_size = 4;
146 pdata->has_ccr = true;
147 }
130 148
131 if (oh->class->rev == MCBSP_CONFIG_TYPE3) { 149 if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
132 if (id == 2) 150 if (id == 2)
@@ -137,22 +155,28 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
137 pdata->buffer_size = 0x80; 155 pdata->buffer_size = 0x80;
138 } 156 }
139 157
158 if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
159 pdata->has_wakeup = true;
160
140 oh_device[0] = oh; 161 oh_device[0] = oh;
141 162
142 if (oh->dev_attr) { 163 if (oh->dev_attr) {
143 oh_device[1] = omap_hwmod_lookup(( 164 oh_device[1] = omap_hwmod_lookup((
144 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); 165 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
166 pdata->enable_st_clock = omap3_enable_st_clock;
145 count++; 167 count++;
146 } 168 }
147 od = omap_device_build_ss(name, id, oh_device, count, pdata, 169 pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
148 sizeof(*pdata), omap2_mcbsp_latency, 170 sizeof(*pdata), NULL, 0, false);
149 ARRAY_SIZE(omap2_mcbsp_latency), false);
150 kfree(pdata); 171 kfree(pdata);
151 if (IS_ERR(od)) { 172 if (IS_ERR(pdev)) {
152 pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, 173 pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
153 name, oh->name); 174 name, oh->name);
154 return PTR_ERR(od); 175 return PTR_ERR(pdev);
155 } 176 }
177 pdata->set_clk_src = omap2_mcbsp_set_clk_src;
178 if (id == 1)
179 pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
156 omap_mcbsp_count++; 180 omap_mcbsp_count++;
157 return 0; 181 return 0;
158} 182}
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index ce65e9329c7b..11e25a4c4bd5 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -102,8 +102,11 @@ void __init smp_init_cpus(void)
102{ 102{
103 unsigned int i, ncores; 103 unsigned int i, ncores;
104 104
105 /* Never released */ 105 /*
106 scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256); 106 * Currently we can't call ioremap here because
107 * SoC detection won't work until after init_early.
108 */
109 scu_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
107 BUG_ON(!scu_base); 110 BUG_ON(!scu_base);
108 111
109 ncores = scu_get_core_count(scu_base); 112 ncores = scu_get_core_count(scu_base);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 84cc0bdda3ae..d71380705080 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1954,9 +1954,6 @@ int __init omap_hwmod_register(struct omap_hwmod **ohs)
1954 1954
1955 i = 0; 1955 i = 0;
1956 do { 1956 do {
1957 if (!omap_chip_is(ohs[i]->omap_chip))
1958 continue;
1959
1960 r = _register(ohs[i]); 1957 r = _register(ohs[i]);
1961 WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name, 1958 WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name,
1962 r); 1959 r);
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a015c69068f6..6d7206213525 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -100,7 +100,6 @@ static struct omap_hwmod omap2420_l3_main_hwmod = {
100 .masters_cnt = ARRAY_SIZE(omap2420_l3_main_masters), 100 .masters_cnt = ARRAY_SIZE(omap2420_l3_main_masters),
101 .slaves = omap2420_l3_main_slaves, 101 .slaves = omap2420_l3_main_slaves,
102 .slaves_cnt = ARRAY_SIZE(omap2420_l3_main_slaves), 102 .slaves_cnt = ARRAY_SIZE(omap2420_l3_main_slaves),
103 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
104 .flags = HWMOD_NO_IDLEST, 103 .flags = HWMOD_NO_IDLEST,
105}; 104};
106 105
@@ -206,7 +205,6 @@ static struct omap_hwmod omap2420_l4_core_hwmod = {
206 .masters_cnt = ARRAY_SIZE(omap2420_l4_core_masters), 205 .masters_cnt = ARRAY_SIZE(omap2420_l4_core_masters),
207 .slaves = omap2420_l4_core_slaves, 206 .slaves = omap2420_l4_core_slaves,
208 .slaves_cnt = ARRAY_SIZE(omap2420_l4_core_slaves), 207 .slaves_cnt = ARRAY_SIZE(omap2420_l4_core_slaves),
209 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
210 .flags = HWMOD_NO_IDLEST, 208 .flags = HWMOD_NO_IDLEST,
211}; 209};
212 210
@@ -227,7 +225,6 @@ static struct omap_hwmod omap2420_l4_wkup_hwmod = {
227 .masters_cnt = ARRAY_SIZE(omap2420_l4_wkup_masters), 225 .masters_cnt = ARRAY_SIZE(omap2420_l4_wkup_masters),
228 .slaves = omap2420_l4_wkup_slaves, 226 .slaves = omap2420_l4_wkup_slaves,
229 .slaves_cnt = ARRAY_SIZE(omap2420_l4_wkup_slaves), 227 .slaves_cnt = ARRAY_SIZE(omap2420_l4_wkup_slaves),
230 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
231 .flags = HWMOD_NO_IDLEST, 228 .flags = HWMOD_NO_IDLEST,
232}; 229};
233 230
@@ -243,7 +240,6 @@ static struct omap_hwmod omap2420_mpu_hwmod = {
243 .main_clk = "mpu_ck", 240 .main_clk = "mpu_ck",
244 .masters = omap2420_mpu_masters, 241 .masters = omap2420_mpu_masters,
245 .masters_cnt = ARRAY_SIZE(omap2420_mpu_masters), 242 .masters_cnt = ARRAY_SIZE(omap2420_mpu_masters),
246 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
247}; 243};
248 244
249/* 245/*
@@ -271,7 +267,16 @@ static struct omap_hwmod omap2420_iva_hwmod = {
271 .class = &iva_hwmod_class, 267 .class = &iva_hwmod_class,
272 .masters = omap2420_iva_masters, 268 .masters = omap2420_iva_masters,
273 .masters_cnt = ARRAY_SIZE(omap2420_iva_masters), 269 .masters_cnt = ARRAY_SIZE(omap2420_iva_masters),
274 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) 270};
271
272/* always-on timers dev attribute */
273static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
274 .timer_capability = OMAP_TIMER_ALWON,
275};
276
277/* pwm timers dev attribute */
278static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
279 .timer_capability = OMAP_TIMER_HAS_PWM,
275}; 280};
276 281
277/* timer1 */ 282/* timer1 */
@@ -314,10 +319,10 @@ static struct omap_hwmod omap2420_timer1_hwmod = {
314 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT, 319 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
315 }, 320 },
316 }, 321 },
322 .dev_attr = &capability_alwon_dev_attr,
317 .slaves = omap2420_timer1_slaves, 323 .slaves = omap2420_timer1_slaves,
318 .slaves_cnt = ARRAY_SIZE(omap2420_timer1_slaves), 324 .slaves_cnt = ARRAY_SIZE(omap2420_timer1_slaves),
319 .class = &omap2xxx_timer_hwmod_class, 325 .class = &omap2xxx_timer_hwmod_class,
320 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
321}; 326};
322 327
323/* timer2 */ 328/* timer2 */
@@ -351,10 +356,10 @@ static struct omap_hwmod omap2420_timer2_hwmod = {
351 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 356 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
352 }, 357 },
353 }, 358 },
359 .dev_attr = &capability_alwon_dev_attr,
354 .slaves = omap2420_timer2_slaves, 360 .slaves = omap2420_timer2_slaves,
355 .slaves_cnt = ARRAY_SIZE(omap2420_timer2_slaves), 361 .slaves_cnt = ARRAY_SIZE(omap2420_timer2_slaves),
356 .class = &omap2xxx_timer_hwmod_class, 362 .class = &omap2xxx_timer_hwmod_class,
357 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
358}; 363};
359 364
360/* timer3 */ 365/* timer3 */
@@ -388,10 +393,10 @@ static struct omap_hwmod omap2420_timer3_hwmod = {
388 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 393 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
389 }, 394 },
390 }, 395 },
396 .dev_attr = &capability_alwon_dev_attr,
391 .slaves = omap2420_timer3_slaves, 397 .slaves = omap2420_timer3_slaves,
392 .slaves_cnt = ARRAY_SIZE(omap2420_timer3_slaves), 398 .slaves_cnt = ARRAY_SIZE(omap2420_timer3_slaves),
393 .class = &omap2xxx_timer_hwmod_class, 399 .class = &omap2xxx_timer_hwmod_class,
394 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
395}; 400};
396 401
397/* timer4 */ 402/* timer4 */
@@ -425,10 +430,10 @@ static struct omap_hwmod omap2420_timer4_hwmod = {
425 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 430 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
426 }, 431 },
427 }, 432 },
433 .dev_attr = &capability_alwon_dev_attr,
428 .slaves = omap2420_timer4_slaves, 434 .slaves = omap2420_timer4_slaves,
429 .slaves_cnt = ARRAY_SIZE(omap2420_timer4_slaves), 435 .slaves_cnt = ARRAY_SIZE(omap2420_timer4_slaves),
430 .class = &omap2xxx_timer_hwmod_class, 436 .class = &omap2xxx_timer_hwmod_class,
431 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
432}; 437};
433 438
434/* timer5 */ 439/* timer5 */
@@ -462,10 +467,10 @@ static struct omap_hwmod omap2420_timer5_hwmod = {
462 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 467 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
463 }, 468 },
464 }, 469 },
470 .dev_attr = &capability_alwon_dev_attr,
465 .slaves = omap2420_timer5_slaves, 471 .slaves = omap2420_timer5_slaves,
466 .slaves_cnt = ARRAY_SIZE(omap2420_timer5_slaves), 472 .slaves_cnt = ARRAY_SIZE(omap2420_timer5_slaves),
467 .class = &omap2xxx_timer_hwmod_class, 473 .class = &omap2xxx_timer_hwmod_class,
468 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
469}; 474};
470 475
471 476
@@ -500,10 +505,10 @@ static struct omap_hwmod omap2420_timer6_hwmod = {
500 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 505 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
501 }, 506 },
502 }, 507 },
508 .dev_attr = &capability_alwon_dev_attr,
503 .slaves = omap2420_timer6_slaves, 509 .slaves = omap2420_timer6_slaves,
504 .slaves_cnt = ARRAY_SIZE(omap2420_timer6_slaves), 510 .slaves_cnt = ARRAY_SIZE(omap2420_timer6_slaves),
505 .class = &omap2xxx_timer_hwmod_class, 511 .class = &omap2xxx_timer_hwmod_class,
506 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
507}; 512};
508 513
509/* timer7 */ 514/* timer7 */
@@ -537,10 +542,10 @@ static struct omap_hwmod omap2420_timer7_hwmod = {
537 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 542 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
538 }, 543 },
539 }, 544 },
545 .dev_attr = &capability_alwon_dev_attr,
540 .slaves = omap2420_timer7_slaves, 546 .slaves = omap2420_timer7_slaves,
541 .slaves_cnt = ARRAY_SIZE(omap2420_timer7_slaves), 547 .slaves_cnt = ARRAY_SIZE(omap2420_timer7_slaves),
542 .class = &omap2xxx_timer_hwmod_class, 548 .class = &omap2xxx_timer_hwmod_class,
543 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
544}; 549};
545 550
546/* timer8 */ 551/* timer8 */
@@ -574,10 +579,10 @@ static struct omap_hwmod omap2420_timer8_hwmod = {
574 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 579 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
575 }, 580 },
576 }, 581 },
582 .dev_attr = &capability_alwon_dev_attr,
577 .slaves = omap2420_timer8_slaves, 583 .slaves = omap2420_timer8_slaves,
578 .slaves_cnt = ARRAY_SIZE(omap2420_timer8_slaves), 584 .slaves_cnt = ARRAY_SIZE(omap2420_timer8_slaves),
579 .class = &omap2xxx_timer_hwmod_class, 585 .class = &omap2xxx_timer_hwmod_class,
580 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
581}; 586};
582 587
583/* timer9 */ 588/* timer9 */
@@ -611,10 +616,10 @@ static struct omap_hwmod omap2420_timer9_hwmod = {
611 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT, 616 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
612 }, 617 },
613 }, 618 },
619 .dev_attr = &capability_pwm_dev_attr,
614 .slaves = omap2420_timer9_slaves, 620 .slaves = omap2420_timer9_slaves,
615 .slaves_cnt = ARRAY_SIZE(omap2420_timer9_slaves), 621 .slaves_cnt = ARRAY_SIZE(omap2420_timer9_slaves),
616 .class = &omap2xxx_timer_hwmod_class, 622 .class = &omap2xxx_timer_hwmod_class,
617 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
618}; 623};
619 624
620/* timer10 */ 625/* timer10 */
@@ -648,10 +653,10 @@ static struct omap_hwmod omap2420_timer10_hwmod = {
648 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT, 653 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
649 }, 654 },
650 }, 655 },
656 .dev_attr = &capability_pwm_dev_attr,
651 .slaves = omap2420_timer10_slaves, 657 .slaves = omap2420_timer10_slaves,
652 .slaves_cnt = ARRAY_SIZE(omap2420_timer10_slaves), 658 .slaves_cnt = ARRAY_SIZE(omap2420_timer10_slaves),
653 .class = &omap2xxx_timer_hwmod_class, 659 .class = &omap2xxx_timer_hwmod_class,
654 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
655}; 660};
656 661
657/* timer11 */ 662/* timer11 */
@@ -685,10 +690,10 @@ static struct omap_hwmod omap2420_timer11_hwmod = {
685 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT, 690 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
686 }, 691 },
687 }, 692 },
693 .dev_attr = &capability_pwm_dev_attr,
688 .slaves = omap2420_timer11_slaves, 694 .slaves = omap2420_timer11_slaves,
689 .slaves_cnt = ARRAY_SIZE(omap2420_timer11_slaves), 695 .slaves_cnt = ARRAY_SIZE(omap2420_timer11_slaves),
690 .class = &omap2xxx_timer_hwmod_class, 696 .class = &omap2xxx_timer_hwmod_class,
691 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
692}; 697};
693 698
694/* timer12 */ 699/* timer12 */
@@ -722,10 +727,10 @@ static struct omap_hwmod omap2420_timer12_hwmod = {
722 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT, 727 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
723 }, 728 },
724 }, 729 },
730 .dev_attr = &capability_pwm_dev_attr,
725 .slaves = omap2420_timer12_slaves, 731 .slaves = omap2420_timer12_slaves,
726 .slaves_cnt = ARRAY_SIZE(omap2420_timer12_slaves), 732 .slaves_cnt = ARRAY_SIZE(omap2420_timer12_slaves),
727 .class = &omap2xxx_timer_hwmod_class, 733 .class = &omap2xxx_timer_hwmod_class,
728 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420)
729}; 734};
730 735
731/* l4_wkup -> wd_timer2 */ 736/* l4_wkup -> wd_timer2 */
@@ -766,7 +771,6 @@ static struct omap_hwmod omap2420_wd_timer2_hwmod = {
766 }, 771 },
767 .slaves = omap2420_wd_timer2_slaves, 772 .slaves = omap2420_wd_timer2_slaves,
768 .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves), 773 .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves),
769 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
770}; 774};
771 775
772/* UART1 */ 776/* UART1 */
@@ -792,7 +796,6 @@ static struct omap_hwmod omap2420_uart1_hwmod = {
792 .slaves = omap2420_uart1_slaves, 796 .slaves = omap2420_uart1_slaves,
793 .slaves_cnt = ARRAY_SIZE(omap2420_uart1_slaves), 797 .slaves_cnt = ARRAY_SIZE(omap2420_uart1_slaves),
794 .class = &omap2_uart_class, 798 .class = &omap2_uart_class,
795 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
796}; 799};
797 800
798/* UART2 */ 801/* UART2 */
@@ -818,7 +821,6 @@ static struct omap_hwmod omap2420_uart2_hwmod = {
818 .slaves = omap2420_uart2_slaves, 821 .slaves = omap2420_uart2_slaves,
819 .slaves_cnt = ARRAY_SIZE(omap2420_uart2_slaves), 822 .slaves_cnt = ARRAY_SIZE(omap2420_uart2_slaves),
820 .class = &omap2_uart_class, 823 .class = &omap2_uart_class,
821 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
822}; 824};
823 825
824/* UART3 */ 826/* UART3 */
@@ -844,7 +846,6 @@ static struct omap_hwmod omap2420_uart3_hwmod = {
844 .slaves = omap2420_uart3_slaves, 846 .slaves = omap2420_uart3_slaves,
845 .slaves_cnt = ARRAY_SIZE(omap2420_uart3_slaves), 847 .slaves_cnt = ARRAY_SIZE(omap2420_uart3_slaves),
846 .class = &omap2_uart_class, 848 .class = &omap2_uart_class,
847 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
848}; 849};
849 850
850/* dss */ 851/* dss */
@@ -898,7 +899,6 @@ static struct omap_hwmod omap2420_dss_core_hwmod = {
898 .slaves_cnt = ARRAY_SIZE(omap2420_dss_slaves), 899 .slaves_cnt = ARRAY_SIZE(omap2420_dss_slaves),
899 .masters = omap2420_dss_masters, 900 .masters = omap2420_dss_masters,
900 .masters_cnt = ARRAY_SIZE(omap2420_dss_masters), 901 .masters_cnt = ARRAY_SIZE(omap2420_dss_masters),
901 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
902 .flags = HWMOD_NO_IDLEST, 902 .flags = HWMOD_NO_IDLEST,
903}; 903};
904 904
@@ -938,7 +938,6 @@ static struct omap_hwmod omap2420_dss_dispc_hwmod = {
938 }, 938 },
939 .slaves = omap2420_dss_dispc_slaves, 939 .slaves = omap2420_dss_dispc_slaves,
940 .slaves_cnt = ARRAY_SIZE(omap2420_dss_dispc_slaves), 940 .slaves_cnt = ARRAY_SIZE(omap2420_dss_dispc_slaves),
941 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
942 .flags = HWMOD_NO_IDLEST, 941 .flags = HWMOD_NO_IDLEST,
943}; 942};
944 943
@@ -975,7 +974,6 @@ static struct omap_hwmod omap2420_dss_rfbi_hwmod = {
975 }, 974 },
976 .slaves = omap2420_dss_rfbi_slaves, 975 .slaves = omap2420_dss_rfbi_slaves,
977 .slaves_cnt = ARRAY_SIZE(omap2420_dss_rfbi_slaves), 976 .slaves_cnt = ARRAY_SIZE(omap2420_dss_rfbi_slaves),
978 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
979 .flags = HWMOD_NO_IDLEST, 977 .flags = HWMOD_NO_IDLEST,
980}; 978};
981 979
@@ -1013,7 +1011,6 @@ static struct omap_hwmod omap2420_dss_venc_hwmod = {
1013 }, 1011 },
1014 .slaves = omap2420_dss_venc_slaves, 1012 .slaves = omap2420_dss_venc_slaves,
1015 .slaves_cnt = ARRAY_SIZE(omap2420_dss_venc_slaves), 1013 .slaves_cnt = ARRAY_SIZE(omap2420_dss_venc_slaves),
1016 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1017 .flags = HWMOD_NO_IDLEST, 1014 .flags = HWMOD_NO_IDLEST,
1018}; 1015};
1019 1016
@@ -1064,7 +1061,6 @@ static struct omap_hwmod omap2420_i2c1_hwmod = {
1064 .slaves_cnt = ARRAY_SIZE(omap2420_i2c1_slaves), 1061 .slaves_cnt = ARRAY_SIZE(omap2420_i2c1_slaves),
1065 .class = &i2c_class, 1062 .class = &i2c_class,
1066 .dev_attr = &i2c_dev_attr, 1063 .dev_attr = &i2c_dev_attr,
1067 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1068 .flags = HWMOD_16BIT_REG, 1064 .flags = HWMOD_16BIT_REG,
1069}; 1065};
1070 1066
@@ -1092,7 +1088,6 @@ static struct omap_hwmod omap2420_i2c2_hwmod = {
1092 .slaves_cnt = ARRAY_SIZE(omap2420_i2c2_slaves), 1088 .slaves_cnt = ARRAY_SIZE(omap2420_i2c2_slaves),
1093 .class = &i2c_class, 1089 .class = &i2c_class,
1094 .dev_attr = &i2c_dev_attr, 1090 .dev_attr = &i2c_dev_attr,
1095 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1096 .flags = HWMOD_16BIT_REG, 1091 .flags = HWMOD_16BIT_REG,
1097}; 1092};
1098 1093
@@ -1197,7 +1192,6 @@ static struct omap_hwmod omap2420_gpio1_hwmod = {
1197 .slaves_cnt = ARRAY_SIZE(omap2420_gpio1_slaves), 1192 .slaves_cnt = ARRAY_SIZE(omap2420_gpio1_slaves),
1198 .class = &omap2xxx_gpio_hwmod_class, 1193 .class = &omap2xxx_gpio_hwmod_class,
1199 .dev_attr = &gpio_dev_attr, 1194 .dev_attr = &gpio_dev_attr,
1200 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1201}; 1195};
1202 1196
1203/* gpio2 */ 1197/* gpio2 */
@@ -1223,7 +1217,6 @@ static struct omap_hwmod omap2420_gpio2_hwmod = {
1223 .slaves_cnt = ARRAY_SIZE(omap2420_gpio2_slaves), 1217 .slaves_cnt = ARRAY_SIZE(omap2420_gpio2_slaves),
1224 .class = &omap2xxx_gpio_hwmod_class, 1218 .class = &omap2xxx_gpio_hwmod_class,
1225 .dev_attr = &gpio_dev_attr, 1219 .dev_attr = &gpio_dev_attr,
1226 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1227}; 1220};
1228 1221
1229/* gpio3 */ 1222/* gpio3 */
@@ -1249,7 +1242,6 @@ static struct omap_hwmod omap2420_gpio3_hwmod = {
1249 .slaves_cnt = ARRAY_SIZE(omap2420_gpio3_slaves), 1242 .slaves_cnt = ARRAY_SIZE(omap2420_gpio3_slaves),
1250 .class = &omap2xxx_gpio_hwmod_class, 1243 .class = &omap2xxx_gpio_hwmod_class,
1251 .dev_attr = &gpio_dev_attr, 1244 .dev_attr = &gpio_dev_attr,
1252 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1253}; 1245};
1254 1246
1255/* gpio4 */ 1247/* gpio4 */
@@ -1275,7 +1267,6 @@ static struct omap_hwmod omap2420_gpio4_hwmod = {
1275 .slaves_cnt = ARRAY_SIZE(omap2420_gpio4_slaves), 1267 .slaves_cnt = ARRAY_SIZE(omap2420_gpio4_slaves),
1276 .class = &omap2xxx_gpio_hwmod_class, 1268 .class = &omap2xxx_gpio_hwmod_class,
1277 .dev_attr = &gpio_dev_attr, 1269 .dev_attr = &gpio_dev_attr,
1278 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1279}; 1270};
1280 1271
1281/* dma attributes */ 1272/* dma attributes */
@@ -1322,7 +1313,6 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
1322 .masters = omap2420_dma_system_masters, 1313 .masters = omap2420_dma_system_masters,
1323 .masters_cnt = ARRAY_SIZE(omap2420_dma_system_masters), 1314 .masters_cnt = ARRAY_SIZE(omap2420_dma_system_masters),
1324 .dev_attr = &dma_dev_attr, 1315 .dev_attr = &dma_dev_attr,
1325 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1326 .flags = HWMOD_NO_IDLEST, 1316 .flags = HWMOD_NO_IDLEST,
1327}; 1317};
1328 1318
@@ -1363,7 +1353,6 @@ static struct omap_hwmod omap2420_mailbox_hwmod = {
1363 }, 1353 },
1364 .slaves = omap2420_mailbox_slaves, 1354 .slaves = omap2420_mailbox_slaves,
1365 .slaves_cnt = ARRAY_SIZE(omap2420_mailbox_slaves), 1355 .slaves_cnt = ARRAY_SIZE(omap2420_mailbox_slaves),
1366 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1367}; 1356};
1368 1357
1369/* mcspi1 */ 1358/* mcspi1 */
@@ -1393,7 +1382,6 @@ static struct omap_hwmod omap2420_mcspi1_hwmod = {
1393 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi1_slaves), 1382 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi1_slaves),
1394 .class = &omap2xxx_mcspi_class, 1383 .class = &omap2xxx_mcspi_class,
1395 .dev_attr = &omap_mcspi1_dev_attr, 1384 .dev_attr = &omap_mcspi1_dev_attr,
1396 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1397}; 1385};
1398 1386
1399/* mcspi2 */ 1387/* mcspi2 */
@@ -1423,7 +1411,6 @@ static struct omap_hwmod omap2420_mcspi2_hwmod = {
1423 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi2_slaves), 1411 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi2_slaves),
1424 .class = &omap2xxx_mcspi_class, 1412 .class = &omap2xxx_mcspi_class,
1425 .dev_attr = &omap_mcspi2_dev_attr, 1413 .dev_attr = &omap_mcspi2_dev_attr,
1426 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1427}; 1414};
1428 1415
1429/* 1416/*
@@ -1473,7 +1460,6 @@ static struct omap_hwmod omap2420_mcbsp1_hwmod = {
1473 }, 1460 },
1474 .slaves = omap2420_mcbsp1_slaves, 1461 .slaves = omap2420_mcbsp1_slaves,
1475 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp1_slaves), 1462 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp1_slaves),
1476 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1477}; 1463};
1478 1464
1479/* mcbsp2 */ 1465/* mcbsp2 */
@@ -1514,7 +1500,6 @@ static struct omap_hwmod omap2420_mcbsp2_hwmod = {
1514 }, 1500 },
1515 .slaves = omap2420_mcbsp2_slaves, 1501 .slaves = omap2420_mcbsp2_slaves,
1516 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp2_slaves), 1502 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp2_slaves),
1517 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
1518}; 1503};
1519 1504
1520static __initdata struct omap_hwmod *omap2420_hwmods[] = { 1505static __initdata struct omap_hwmod *omap2420_hwmods[] = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 408193d8e044..a2580d01c3ff 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -110,7 +110,6 @@ static struct omap_hwmod omap2430_l3_main_hwmod = {
110 .masters_cnt = ARRAY_SIZE(omap2430_l3_main_masters), 110 .masters_cnt = ARRAY_SIZE(omap2430_l3_main_masters),
111 .slaves = omap2430_l3_main_slaves, 111 .slaves = omap2430_l3_main_slaves,
112 .slaves_cnt = ARRAY_SIZE(omap2430_l3_main_slaves), 112 .slaves_cnt = ARRAY_SIZE(omap2430_l3_main_slaves),
113 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
114 .flags = HWMOD_NO_IDLEST, 113 .flags = HWMOD_NO_IDLEST,
115}; 114};
116 115
@@ -250,7 +249,6 @@ static struct omap_hwmod omap2430_l4_core_hwmod = {
250 .masters_cnt = ARRAY_SIZE(omap2430_l4_core_masters), 249 .masters_cnt = ARRAY_SIZE(omap2430_l4_core_masters),
251 .slaves = omap2430_l4_core_slaves, 250 .slaves = omap2430_l4_core_slaves,
252 .slaves_cnt = ARRAY_SIZE(omap2430_l4_core_slaves), 251 .slaves_cnt = ARRAY_SIZE(omap2430_l4_core_slaves),
253 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
254 .flags = HWMOD_NO_IDLEST, 252 .flags = HWMOD_NO_IDLEST,
255}; 253};
256 254
@@ -301,7 +299,6 @@ static struct omap_hwmod omap2430_l4_wkup_hwmod = {
301 .masters_cnt = ARRAY_SIZE(omap2430_l4_wkup_masters), 299 .masters_cnt = ARRAY_SIZE(omap2430_l4_wkup_masters),
302 .slaves = omap2430_l4_wkup_slaves, 300 .slaves = omap2430_l4_wkup_slaves,
303 .slaves_cnt = ARRAY_SIZE(omap2430_l4_wkup_slaves), 301 .slaves_cnt = ARRAY_SIZE(omap2430_l4_wkup_slaves),
304 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
305 .flags = HWMOD_NO_IDLEST, 302 .flags = HWMOD_NO_IDLEST,
306}; 303};
307 304
@@ -317,7 +314,6 @@ static struct omap_hwmod omap2430_mpu_hwmod = {
317 .main_clk = "mpu_ck", 314 .main_clk = "mpu_ck",
318 .masters = omap2430_mpu_masters, 315 .masters = omap2430_mpu_masters,
319 .masters_cnt = ARRAY_SIZE(omap2430_mpu_masters), 316 .masters_cnt = ARRAY_SIZE(omap2430_mpu_masters),
320 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
321}; 317};
322 318
323/* 319/*
@@ -345,7 +341,16 @@ static struct omap_hwmod omap2430_iva_hwmod = {
345 .class = &iva_hwmod_class, 341 .class = &iva_hwmod_class,
346 .masters = omap2430_iva_masters, 342 .masters = omap2430_iva_masters,
347 .masters_cnt = ARRAY_SIZE(omap2430_iva_masters), 343 .masters_cnt = ARRAY_SIZE(omap2430_iva_masters),
348 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) 344};
345
346/* always-on timers dev attribute */
347static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
348 .timer_capability = OMAP_TIMER_ALWON,
349};
350
351/* pwm timers dev attribute */
352static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
353 .timer_capability = OMAP_TIMER_HAS_PWM,
349}; 354};
350 355
351/* timer1 */ 356/* timer1 */
@@ -388,10 +393,10 @@ static struct omap_hwmod omap2430_timer1_hwmod = {
388 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT, 393 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
389 }, 394 },
390 }, 395 },
396 .dev_attr = &capability_alwon_dev_attr,
391 .slaves = omap2430_timer1_slaves, 397 .slaves = omap2430_timer1_slaves,
392 .slaves_cnt = ARRAY_SIZE(omap2430_timer1_slaves), 398 .slaves_cnt = ARRAY_SIZE(omap2430_timer1_slaves),
393 .class = &omap2xxx_timer_hwmod_class, 399 .class = &omap2xxx_timer_hwmod_class,
394 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
395}; 400};
396 401
397/* timer2 */ 402/* timer2 */
@@ -425,10 +430,10 @@ static struct omap_hwmod omap2430_timer2_hwmod = {
425 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 430 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
426 }, 431 },
427 }, 432 },
433 .dev_attr = &capability_alwon_dev_attr,
428 .slaves = omap2430_timer2_slaves, 434 .slaves = omap2430_timer2_slaves,
429 .slaves_cnt = ARRAY_SIZE(omap2430_timer2_slaves), 435 .slaves_cnt = ARRAY_SIZE(omap2430_timer2_slaves),
430 .class = &omap2xxx_timer_hwmod_class, 436 .class = &omap2xxx_timer_hwmod_class,
431 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
432}; 437};
433 438
434/* timer3 */ 439/* timer3 */
@@ -462,10 +467,10 @@ static struct omap_hwmod omap2430_timer3_hwmod = {
462 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 467 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
463 }, 468 },
464 }, 469 },
470 .dev_attr = &capability_alwon_dev_attr,
465 .slaves = omap2430_timer3_slaves, 471 .slaves = omap2430_timer3_slaves,
466 .slaves_cnt = ARRAY_SIZE(omap2430_timer3_slaves), 472 .slaves_cnt = ARRAY_SIZE(omap2430_timer3_slaves),
467 .class = &omap2xxx_timer_hwmod_class, 473 .class = &omap2xxx_timer_hwmod_class,
468 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
469}; 474};
470 475
471/* timer4 */ 476/* timer4 */
@@ -499,10 +504,10 @@ static struct omap_hwmod omap2430_timer4_hwmod = {
499 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 504 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
500 }, 505 },
501 }, 506 },
507 .dev_attr = &capability_alwon_dev_attr,
502 .slaves = omap2430_timer4_slaves, 508 .slaves = omap2430_timer4_slaves,
503 .slaves_cnt = ARRAY_SIZE(omap2430_timer4_slaves), 509 .slaves_cnt = ARRAY_SIZE(omap2430_timer4_slaves),
504 .class = &omap2xxx_timer_hwmod_class, 510 .class = &omap2xxx_timer_hwmod_class,
505 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
506}; 511};
507 512
508/* timer5 */ 513/* timer5 */
@@ -536,10 +541,10 @@ static struct omap_hwmod omap2430_timer5_hwmod = {
536 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 541 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
537 }, 542 },
538 }, 543 },
544 .dev_attr = &capability_alwon_dev_attr,
539 .slaves = omap2430_timer5_slaves, 545 .slaves = omap2430_timer5_slaves,
540 .slaves_cnt = ARRAY_SIZE(omap2430_timer5_slaves), 546 .slaves_cnt = ARRAY_SIZE(omap2430_timer5_slaves),
541 .class = &omap2xxx_timer_hwmod_class, 547 .class = &omap2xxx_timer_hwmod_class,
542 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
543}; 548};
544 549
545/* timer6 */ 550/* timer6 */
@@ -573,10 +578,10 @@ static struct omap_hwmod omap2430_timer6_hwmod = {
573 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 578 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
574 }, 579 },
575 }, 580 },
581 .dev_attr = &capability_alwon_dev_attr,
576 .slaves = omap2430_timer6_slaves, 582 .slaves = omap2430_timer6_slaves,
577 .slaves_cnt = ARRAY_SIZE(omap2430_timer6_slaves), 583 .slaves_cnt = ARRAY_SIZE(omap2430_timer6_slaves),
578 .class = &omap2xxx_timer_hwmod_class, 584 .class = &omap2xxx_timer_hwmod_class,
579 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
580}; 585};
581 586
582/* timer7 */ 587/* timer7 */
@@ -610,10 +615,10 @@ static struct omap_hwmod omap2430_timer7_hwmod = {
610 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT, 615 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
611 }, 616 },
612 }, 617 },
618 .dev_attr = &capability_alwon_dev_attr,
613 .slaves = omap2430_timer7_slaves, 619 .slaves = omap2430_timer7_slaves,
614 .slaves_cnt = ARRAY_SIZE(omap2430_timer7_slaves), 620 .slaves_cnt = ARRAY_SIZE(omap2430_timer7_slaves),
615 .class = &omap2xxx_timer_hwmod_class, 621 .class = &omap2xxx_timer_hwmod_class,
616 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
617}; 622};
618 623
619/* timer8 */ 624/* timer8 */
@@ -647,10 +652,10 @@ static struct omap_hwmod omap2430_timer8_hwmod = {
647 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 652 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
648 }, 653 },
649 }, 654 },
655 .dev_attr = &capability_alwon_dev_attr,
650 .slaves = omap2430_timer8_slaves, 656 .slaves = omap2430_timer8_slaves,
651 .slaves_cnt = ARRAY_SIZE(omap2430_timer8_slaves), 657 .slaves_cnt = ARRAY_SIZE(omap2430_timer8_slaves),
652 .class = &omap2xxx_timer_hwmod_class, 658 .class = &omap2xxx_timer_hwmod_class,
653 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
654}; 659};
655 660
656/* timer9 */ 661/* timer9 */
@@ -684,10 +689,10 @@ static struct omap_hwmod omap2430_timer9_hwmod = {
684 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT, 689 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
685 }, 690 },
686 }, 691 },
692 .dev_attr = &capability_pwm_dev_attr,
687 .slaves = omap2430_timer9_slaves, 693 .slaves = omap2430_timer9_slaves,
688 .slaves_cnt = ARRAY_SIZE(omap2430_timer9_slaves), 694 .slaves_cnt = ARRAY_SIZE(omap2430_timer9_slaves),
689 .class = &omap2xxx_timer_hwmod_class, 695 .class = &omap2xxx_timer_hwmod_class,
690 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
691}; 696};
692 697
693/* timer10 */ 698/* timer10 */
@@ -721,10 +726,10 @@ static struct omap_hwmod omap2430_timer10_hwmod = {
721 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT, 726 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
722 }, 727 },
723 }, 728 },
729 .dev_attr = &capability_pwm_dev_attr,
724 .slaves = omap2430_timer10_slaves, 730 .slaves = omap2430_timer10_slaves,
725 .slaves_cnt = ARRAY_SIZE(omap2430_timer10_slaves), 731 .slaves_cnt = ARRAY_SIZE(omap2430_timer10_slaves),
726 .class = &omap2xxx_timer_hwmod_class, 732 .class = &omap2xxx_timer_hwmod_class,
727 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
728}; 733};
729 734
730/* timer11 */ 735/* timer11 */
@@ -758,10 +763,10 @@ static struct omap_hwmod omap2430_timer11_hwmod = {
758 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT, 763 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
759 }, 764 },
760 }, 765 },
766 .dev_attr = &capability_pwm_dev_attr,
761 .slaves = omap2430_timer11_slaves, 767 .slaves = omap2430_timer11_slaves,
762 .slaves_cnt = ARRAY_SIZE(omap2430_timer11_slaves), 768 .slaves_cnt = ARRAY_SIZE(omap2430_timer11_slaves),
763 .class = &omap2xxx_timer_hwmod_class, 769 .class = &omap2xxx_timer_hwmod_class,
764 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
765}; 770};
766 771
767/* timer12 */ 772/* timer12 */
@@ -795,10 +800,10 @@ static struct omap_hwmod omap2430_timer12_hwmod = {
795 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT, 800 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
796 }, 801 },
797 }, 802 },
803 .dev_attr = &capability_pwm_dev_attr,
798 .slaves = omap2430_timer12_slaves, 804 .slaves = omap2430_timer12_slaves,
799 .slaves_cnt = ARRAY_SIZE(omap2430_timer12_slaves), 805 .slaves_cnt = ARRAY_SIZE(omap2430_timer12_slaves),
800 .class = &omap2xxx_timer_hwmod_class, 806 .class = &omap2xxx_timer_hwmod_class,
801 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
802}; 807};
803 808
804/* l4_wkup -> wd_timer2 */ 809/* l4_wkup -> wd_timer2 */
@@ -839,7 +844,6 @@ static struct omap_hwmod omap2430_wd_timer2_hwmod = {
839 }, 844 },
840 .slaves = omap2430_wd_timer2_slaves, 845 .slaves = omap2430_wd_timer2_slaves,
841 .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves), 846 .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves),
842 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
843}; 847};
844 848
845/* UART1 */ 849/* UART1 */
@@ -865,7 +869,6 @@ static struct omap_hwmod omap2430_uart1_hwmod = {
865 .slaves = omap2430_uart1_slaves, 869 .slaves = omap2430_uart1_slaves,
866 .slaves_cnt = ARRAY_SIZE(omap2430_uart1_slaves), 870 .slaves_cnt = ARRAY_SIZE(omap2430_uart1_slaves),
867 .class = &omap2_uart_class, 871 .class = &omap2_uart_class,
868 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
869}; 872};
870 873
871/* UART2 */ 874/* UART2 */
@@ -891,7 +894,6 @@ static struct omap_hwmod omap2430_uart2_hwmod = {
891 .slaves = omap2430_uart2_slaves, 894 .slaves = omap2430_uart2_slaves,
892 .slaves_cnt = ARRAY_SIZE(omap2430_uart2_slaves), 895 .slaves_cnt = ARRAY_SIZE(omap2430_uart2_slaves),
893 .class = &omap2_uart_class, 896 .class = &omap2_uart_class,
894 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
895}; 897};
896 898
897/* UART3 */ 899/* UART3 */
@@ -917,7 +919,6 @@ static struct omap_hwmod omap2430_uart3_hwmod = {
917 .slaves = omap2430_uart3_slaves, 919 .slaves = omap2430_uart3_slaves,
918 .slaves_cnt = ARRAY_SIZE(omap2430_uart3_slaves), 920 .slaves_cnt = ARRAY_SIZE(omap2430_uart3_slaves),
919 .class = &omap2_uart_class, 921 .class = &omap2_uart_class,
920 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
921}; 922};
922 923
923/* dss */ 924/* dss */
@@ -965,7 +966,6 @@ static struct omap_hwmod omap2430_dss_core_hwmod = {
965 .slaves_cnt = ARRAY_SIZE(omap2430_dss_slaves), 966 .slaves_cnt = ARRAY_SIZE(omap2430_dss_slaves),
966 .masters = omap2430_dss_masters, 967 .masters = omap2430_dss_masters,
967 .masters_cnt = ARRAY_SIZE(omap2430_dss_masters), 968 .masters_cnt = ARRAY_SIZE(omap2430_dss_masters),
968 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
969 .flags = HWMOD_NO_IDLEST, 969 .flags = HWMOD_NO_IDLEST,
970}; 970};
971 971
@@ -999,7 +999,6 @@ static struct omap_hwmod omap2430_dss_dispc_hwmod = {
999 }, 999 },
1000 .slaves = omap2430_dss_dispc_slaves, 1000 .slaves = omap2430_dss_dispc_slaves,
1001 .slaves_cnt = ARRAY_SIZE(omap2430_dss_dispc_slaves), 1001 .slaves_cnt = ARRAY_SIZE(omap2430_dss_dispc_slaves),
1002 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1003 .flags = HWMOD_NO_IDLEST, 1002 .flags = HWMOD_NO_IDLEST,
1004}; 1003};
1005 1004
@@ -1030,7 +1029,6 @@ static struct omap_hwmod omap2430_dss_rfbi_hwmod = {
1030 }, 1029 },
1031 .slaves = omap2430_dss_rfbi_slaves, 1030 .slaves = omap2430_dss_rfbi_slaves,
1032 .slaves_cnt = ARRAY_SIZE(omap2430_dss_rfbi_slaves), 1031 .slaves_cnt = ARRAY_SIZE(omap2430_dss_rfbi_slaves),
1033 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1034 .flags = HWMOD_NO_IDLEST, 1032 .flags = HWMOD_NO_IDLEST,
1035}; 1033};
1036 1034
@@ -1062,7 +1060,6 @@ static struct omap_hwmod omap2430_dss_venc_hwmod = {
1062 }, 1060 },
1063 .slaves = omap2430_dss_venc_slaves, 1061 .slaves = omap2430_dss_venc_slaves,
1064 .slaves_cnt = ARRAY_SIZE(omap2430_dss_venc_slaves), 1062 .slaves_cnt = ARRAY_SIZE(omap2430_dss_venc_slaves),
1065 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1066 .flags = HWMOD_NO_IDLEST, 1063 .flags = HWMOD_NO_IDLEST,
1067}; 1064};
1068 1065
@@ -1123,7 +1120,6 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
1123 .slaves_cnt = ARRAY_SIZE(omap2430_i2c1_slaves), 1120 .slaves_cnt = ARRAY_SIZE(omap2430_i2c1_slaves),
1124 .class = &i2c_class, 1121 .class = &i2c_class,
1125 .dev_attr = &i2c_dev_attr, 1122 .dev_attr = &i2c_dev_attr,
1126 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1127}; 1123};
1128 1124
1129/* I2C2 */ 1125/* I2C2 */
@@ -1151,7 +1147,6 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
1151 .slaves_cnt = ARRAY_SIZE(omap2430_i2c2_slaves), 1147 .slaves_cnt = ARRAY_SIZE(omap2430_i2c2_slaves),
1152 .class = &i2c_class, 1148 .class = &i2c_class,
1153 .dev_attr = &i2c_dev_attr, 1149 .dev_attr = &i2c_dev_attr,
1154 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1155}; 1150};
1156 1151
1157/* l4_wkup -> gpio1 */ 1152/* l4_wkup -> gpio1 */
@@ -1273,7 +1268,6 @@ static struct omap_hwmod omap2430_gpio1_hwmod = {
1273 .slaves_cnt = ARRAY_SIZE(omap2430_gpio1_slaves), 1268 .slaves_cnt = ARRAY_SIZE(omap2430_gpio1_slaves),
1274 .class = &omap2xxx_gpio_hwmod_class, 1269 .class = &omap2xxx_gpio_hwmod_class,
1275 .dev_attr = &gpio_dev_attr, 1270 .dev_attr = &gpio_dev_attr,
1276 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1277}; 1271};
1278 1272
1279/* gpio2 */ 1273/* gpio2 */
@@ -1299,7 +1293,6 @@ static struct omap_hwmod omap2430_gpio2_hwmod = {
1299 .slaves_cnt = ARRAY_SIZE(omap2430_gpio2_slaves), 1293 .slaves_cnt = ARRAY_SIZE(omap2430_gpio2_slaves),
1300 .class = &omap2xxx_gpio_hwmod_class, 1294 .class = &omap2xxx_gpio_hwmod_class,
1301 .dev_attr = &gpio_dev_attr, 1295 .dev_attr = &gpio_dev_attr,
1302 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1303}; 1296};
1304 1297
1305/* gpio3 */ 1298/* gpio3 */
@@ -1325,7 +1318,6 @@ static struct omap_hwmod omap2430_gpio3_hwmod = {
1325 .slaves_cnt = ARRAY_SIZE(omap2430_gpio3_slaves), 1318 .slaves_cnt = ARRAY_SIZE(omap2430_gpio3_slaves),
1326 .class = &omap2xxx_gpio_hwmod_class, 1319 .class = &omap2xxx_gpio_hwmod_class,
1327 .dev_attr = &gpio_dev_attr, 1320 .dev_attr = &gpio_dev_attr,
1328 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1329}; 1321};
1330 1322
1331/* gpio4 */ 1323/* gpio4 */
@@ -1351,7 +1343,6 @@ static struct omap_hwmod omap2430_gpio4_hwmod = {
1351 .slaves_cnt = ARRAY_SIZE(omap2430_gpio4_slaves), 1343 .slaves_cnt = ARRAY_SIZE(omap2430_gpio4_slaves),
1352 .class = &omap2xxx_gpio_hwmod_class, 1344 .class = &omap2xxx_gpio_hwmod_class,
1353 .dev_attr = &gpio_dev_attr, 1345 .dev_attr = &gpio_dev_attr,
1354 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1355}; 1346};
1356 1347
1357/* gpio5 */ 1348/* gpio5 */
@@ -1382,7 +1373,6 @@ static struct omap_hwmod omap2430_gpio5_hwmod = {
1382 .slaves_cnt = ARRAY_SIZE(omap2430_gpio5_slaves), 1373 .slaves_cnt = ARRAY_SIZE(omap2430_gpio5_slaves),
1383 .class = &omap2xxx_gpio_hwmod_class, 1374 .class = &omap2xxx_gpio_hwmod_class,
1384 .dev_attr = &gpio_dev_attr, 1375 .dev_attr = &gpio_dev_attr,
1385 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1386}; 1376};
1387 1377
1388/* dma attributes */ 1378/* dma attributes */
@@ -1429,7 +1419,6 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
1429 .masters = omap2430_dma_system_masters, 1419 .masters = omap2430_dma_system_masters,
1430 .masters_cnt = ARRAY_SIZE(omap2430_dma_system_masters), 1420 .masters_cnt = ARRAY_SIZE(omap2430_dma_system_masters),
1431 .dev_attr = &dma_dev_attr, 1421 .dev_attr = &dma_dev_attr,
1432 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1433 .flags = HWMOD_NO_IDLEST, 1422 .flags = HWMOD_NO_IDLEST,
1434}; 1423};
1435 1424
@@ -1469,7 +1458,6 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
1469 }, 1458 },
1470 .slaves = omap2430_mailbox_slaves, 1459 .slaves = omap2430_mailbox_slaves,
1471 .slaves_cnt = ARRAY_SIZE(omap2430_mailbox_slaves), 1460 .slaves_cnt = ARRAY_SIZE(omap2430_mailbox_slaves),
1472 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1473}; 1461};
1474 1462
1475/* mcspi1 */ 1463/* mcspi1 */
@@ -1499,7 +1487,6 @@ static struct omap_hwmod omap2430_mcspi1_hwmod = {
1499 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi1_slaves), 1487 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi1_slaves),
1500 .class = &omap2xxx_mcspi_class, 1488 .class = &omap2xxx_mcspi_class,
1501 .dev_attr = &omap_mcspi1_dev_attr, 1489 .dev_attr = &omap_mcspi1_dev_attr,
1502 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1503}; 1490};
1504 1491
1505/* mcspi2 */ 1492/* mcspi2 */
@@ -1529,7 +1516,6 @@ static struct omap_hwmod omap2430_mcspi2_hwmod = {
1529 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi2_slaves), 1516 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi2_slaves),
1530 .class = &omap2xxx_mcspi_class, 1517 .class = &omap2xxx_mcspi_class,
1531 .dev_attr = &omap_mcspi2_dev_attr, 1518 .dev_attr = &omap_mcspi2_dev_attr,
1532 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1533}; 1519};
1534 1520
1535/* mcspi3 */ 1521/* mcspi3 */
@@ -1572,7 +1558,6 @@ static struct omap_hwmod omap2430_mcspi3_hwmod = {
1572 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi3_slaves), 1558 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi3_slaves),
1573 .class = &omap2xxx_mcspi_class, 1559 .class = &omap2xxx_mcspi_class,
1574 .dev_attr = &omap_mcspi3_dev_attr, 1560 .dev_attr = &omap_mcspi3_dev_attr,
1575 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1576}; 1561};
1577 1562
1578/* 1563/*
@@ -1628,7 +1613,6 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
1628 */ 1613 */
1629 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE 1614 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
1630 | HWMOD_SWSUP_MSTANDBY, 1615 | HWMOD_SWSUP_MSTANDBY,
1631 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430)
1632}; 1616};
1633 1617
1634/* 1618/*
@@ -1689,7 +1673,6 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
1689 }, 1673 },
1690 .slaves = omap2430_mcbsp1_slaves, 1674 .slaves = omap2430_mcbsp1_slaves,
1691 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp1_slaves), 1675 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp1_slaves),
1692 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1693}; 1676};
1694 1677
1695/* mcbsp2 */ 1678/* mcbsp2 */
@@ -1731,7 +1714,6 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
1731 }, 1714 },
1732 .slaves = omap2430_mcbsp2_slaves, 1715 .slaves = omap2430_mcbsp2_slaves,
1733 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp2_slaves), 1716 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp2_slaves),
1734 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1735}; 1717};
1736 1718
1737/* mcbsp3 */ 1719/* mcbsp3 */
@@ -1783,7 +1765,6 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
1783 }, 1765 },
1784 .slaves = omap2430_mcbsp3_slaves, 1766 .slaves = omap2430_mcbsp3_slaves,
1785 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp3_slaves), 1767 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp3_slaves),
1786 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1787}; 1768};
1788 1769
1789/* mcbsp4 */ 1770/* mcbsp4 */
@@ -1841,7 +1822,6 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
1841 }, 1822 },
1842 .slaves = omap2430_mcbsp4_slaves, 1823 .slaves = omap2430_mcbsp4_slaves,
1843 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp4_slaves), 1824 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp4_slaves),
1844 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1845}; 1825};
1846 1826
1847/* mcbsp5 */ 1827/* mcbsp5 */
@@ -1899,7 +1879,6 @@ static struct omap_hwmod omap2430_mcbsp5_hwmod = {
1899 }, 1879 },
1900 .slaves = omap2430_mcbsp5_slaves, 1880 .slaves = omap2430_mcbsp5_slaves,
1901 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp5_slaves), 1881 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp5_slaves),
1902 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1903}; 1882};
1904 1883
1905/* MMC/SD/SDIO common */ 1884/* MMC/SD/SDIO common */
@@ -1966,7 +1945,6 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
1966 .slaves = omap2430_mmc1_slaves, 1945 .slaves = omap2430_mmc1_slaves,
1967 .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), 1946 .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
1968 .class = &omap2430_mmc_class, 1947 .class = &omap2430_mmc_class,
1969 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
1970}; 1948};
1971 1949
1972/* MMC/SD/SDIO2 */ 1950/* MMC/SD/SDIO2 */
@@ -2010,7 +1988,6 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
2010 .slaves = omap2430_mmc2_slaves, 1988 .slaves = omap2430_mmc2_slaves,
2011 .slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves), 1989 .slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves),
2012 .class = &omap2430_mmc_class, 1990 .class = &omap2430_mmc_class,
2013 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
2014}; 1991};
2015 1992
2016static __initdata struct omap_hwmod *omap2430_hwmods[] = { 1993static __initdata struct omap_hwmod *omap2430_hwmods[] = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 25bf43b5a4ec..3008e1672c7a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -156,7 +156,6 @@ static struct omap_hwmod omap3xxx_l3_main_hwmod = {
156 .masters_cnt = ARRAY_SIZE(omap3xxx_l3_main_masters), 156 .masters_cnt = ARRAY_SIZE(omap3xxx_l3_main_masters),
157 .slaves = omap3xxx_l3_main_slaves, 157 .slaves = omap3xxx_l3_main_slaves,
158 .slaves_cnt = ARRAY_SIZE(omap3xxx_l3_main_slaves), 158 .slaves_cnt = ARRAY_SIZE(omap3xxx_l3_main_slaves),
159 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
160 .flags = HWMOD_NO_IDLEST, 159 .flags = HWMOD_NO_IDLEST,
161}; 160};
162 161
@@ -459,7 +458,6 @@ static struct omap_hwmod omap3xxx_l4_core_hwmod = {
459 .class = &l4_hwmod_class, 458 .class = &l4_hwmod_class,
460 .slaves = omap3xxx_l4_core_slaves, 459 .slaves = omap3xxx_l4_core_slaves,
461 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves), 460 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves),
462 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
463 .flags = HWMOD_NO_IDLEST, 461 .flags = HWMOD_NO_IDLEST,
464}; 462};
465 463
@@ -474,7 +472,6 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = {
474 .class = &l4_hwmod_class, 472 .class = &l4_hwmod_class,
475 .slaves = omap3xxx_l4_per_slaves, 473 .slaves = omap3xxx_l4_per_slaves,
476 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves), 474 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves),
477 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
478 .flags = HWMOD_NO_IDLEST, 475 .flags = HWMOD_NO_IDLEST,
479}; 476};
480 477
@@ -489,7 +486,6 @@ static struct omap_hwmod omap3xxx_l4_wkup_hwmod = {
489 .class = &l4_hwmod_class, 486 .class = &l4_hwmod_class,
490 .slaves = omap3xxx_l4_wkup_slaves, 487 .slaves = omap3xxx_l4_wkup_slaves,
491 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves), 488 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves),
492 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
493 .flags = HWMOD_NO_IDLEST, 489 .flags = HWMOD_NO_IDLEST,
494}; 490};
495 491
@@ -505,7 +501,6 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
505 .main_clk = "arm_fck", 501 .main_clk = "arm_fck",
506 .masters = omap3xxx_mpu_masters, 502 .masters = omap3xxx_mpu_masters,
507 .masters_cnt = ARRAY_SIZE(omap3xxx_mpu_masters), 503 .masters_cnt = ARRAY_SIZE(omap3xxx_mpu_masters),
508 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
509}; 504};
510 505
511/* 506/*
@@ -533,7 +528,6 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {
533 .class = &iva_hwmod_class, 528 .class = &iva_hwmod_class,
534 .masters = omap3xxx_iva_masters, 529 .masters = omap3xxx_iva_masters,
535 .masters_cnt = ARRAY_SIZE(omap3xxx_iva_masters), 530 .masters_cnt = ARRAY_SIZE(omap3xxx_iva_masters),
536 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
537}; 531};
538 532
539/* timer class */ 533/* timer class */
@@ -570,6 +564,21 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
570 .rev = OMAP_TIMER_IP_VERSION_1, 564 .rev = OMAP_TIMER_IP_VERSION_1,
571}; 565};
572 566
567/* secure timers dev attribute */
568static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
569 .timer_capability = OMAP_TIMER_SECURE,
570};
571
572/* always-on timers dev attribute */
573static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
574 .timer_capability = OMAP_TIMER_ALWON,
575};
576
577/* pwm timers dev attribute */
578static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
579 .timer_capability = OMAP_TIMER_HAS_PWM,
580};
581
573/* timer1 */ 582/* timer1 */
574static struct omap_hwmod omap3xxx_timer1_hwmod; 583static struct omap_hwmod omap3xxx_timer1_hwmod;
575 584
@@ -610,10 +619,10 @@ static struct omap_hwmod omap3xxx_timer1_hwmod = {
610 .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT, 619 .idlest_idle_bit = OMAP3430_ST_GPT1_SHIFT,
611 }, 620 },
612 }, 621 },
622 .dev_attr = &capability_alwon_dev_attr,
613 .slaves = omap3xxx_timer1_slaves, 623 .slaves = omap3xxx_timer1_slaves,
614 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves), 624 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves),
615 .class = &omap3xxx_timer_1ms_hwmod_class, 625 .class = &omap3xxx_timer_1ms_hwmod_class,
616 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
617}; 626};
618 627
619/* timer2 */ 628/* timer2 */
@@ -656,10 +665,10 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
656 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT, 665 .idlest_idle_bit = OMAP3430_ST_GPT2_SHIFT,
657 }, 666 },
658 }, 667 },
668 .dev_attr = &capability_alwon_dev_attr,
659 .slaves = omap3xxx_timer2_slaves, 669 .slaves = omap3xxx_timer2_slaves,
660 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer2_slaves), 670 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer2_slaves),
661 .class = &omap3xxx_timer_1ms_hwmod_class, 671 .class = &omap3xxx_timer_1ms_hwmod_class,
662 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
663}; 672};
664 673
665/* timer3 */ 674/* timer3 */
@@ -702,10 +711,10 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
702 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT, 711 .idlest_idle_bit = OMAP3430_ST_GPT3_SHIFT,
703 }, 712 },
704 }, 713 },
714 .dev_attr = &capability_alwon_dev_attr,
705 .slaves = omap3xxx_timer3_slaves, 715 .slaves = omap3xxx_timer3_slaves,
706 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer3_slaves), 716 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer3_slaves),
707 .class = &omap3xxx_timer_hwmod_class, 717 .class = &omap3xxx_timer_hwmod_class,
708 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
709}; 718};
710 719
711/* timer4 */ 720/* timer4 */
@@ -748,10 +757,10 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
748 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT, 757 .idlest_idle_bit = OMAP3430_ST_GPT4_SHIFT,
749 }, 758 },
750 }, 759 },
760 .dev_attr = &capability_alwon_dev_attr,
751 .slaves = omap3xxx_timer4_slaves, 761 .slaves = omap3xxx_timer4_slaves,
752 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer4_slaves), 762 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer4_slaves),
753 .class = &omap3xxx_timer_hwmod_class, 763 .class = &omap3xxx_timer_hwmod_class,
754 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
755}; 764};
756 765
757/* timer5 */ 766/* timer5 */
@@ -794,10 +803,10 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
794 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT, 803 .idlest_idle_bit = OMAP3430_ST_GPT5_SHIFT,
795 }, 804 },
796 }, 805 },
806 .dev_attr = &capability_alwon_dev_attr,
797 .slaves = omap3xxx_timer5_slaves, 807 .slaves = omap3xxx_timer5_slaves,
798 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer5_slaves), 808 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer5_slaves),
799 .class = &omap3xxx_timer_hwmod_class, 809 .class = &omap3xxx_timer_hwmod_class,
800 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
801}; 810};
802 811
803/* timer6 */ 812/* timer6 */
@@ -840,10 +849,10 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
840 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT, 849 .idlest_idle_bit = OMAP3430_ST_GPT6_SHIFT,
841 }, 850 },
842 }, 851 },
852 .dev_attr = &capability_alwon_dev_attr,
843 .slaves = omap3xxx_timer6_slaves, 853 .slaves = omap3xxx_timer6_slaves,
844 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer6_slaves), 854 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer6_slaves),
845 .class = &omap3xxx_timer_hwmod_class, 855 .class = &omap3xxx_timer_hwmod_class,
846 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
847}; 856};
848 857
849/* timer7 */ 858/* timer7 */
@@ -886,10 +895,10 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
886 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT, 895 .idlest_idle_bit = OMAP3430_ST_GPT7_SHIFT,
887 }, 896 },
888 }, 897 },
898 .dev_attr = &capability_alwon_dev_attr,
889 .slaves = omap3xxx_timer7_slaves, 899 .slaves = omap3xxx_timer7_slaves,
890 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer7_slaves), 900 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer7_slaves),
891 .class = &omap3xxx_timer_hwmod_class, 901 .class = &omap3xxx_timer_hwmod_class,
892 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
893}; 902};
894 903
895/* timer8 */ 904/* timer8 */
@@ -932,10 +941,10 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
932 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT, 941 .idlest_idle_bit = OMAP3430_ST_GPT8_SHIFT,
933 }, 942 },
934 }, 943 },
944 .dev_attr = &capability_pwm_dev_attr,
935 .slaves = omap3xxx_timer8_slaves, 945 .slaves = omap3xxx_timer8_slaves,
936 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer8_slaves), 946 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer8_slaves),
937 .class = &omap3xxx_timer_hwmod_class, 947 .class = &omap3xxx_timer_hwmod_class,
938 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
939}; 948};
940 949
941/* timer9 */ 950/* timer9 */
@@ -978,10 +987,10 @@ static struct omap_hwmod omap3xxx_timer9_hwmod = {
978 .idlest_idle_bit = OMAP3430_ST_GPT9_SHIFT, 987 .idlest_idle_bit = OMAP3430_ST_GPT9_SHIFT,
979 }, 988 },
980 }, 989 },
990 .dev_attr = &capability_pwm_dev_attr,
981 .slaves = omap3xxx_timer9_slaves, 991 .slaves = omap3xxx_timer9_slaves,
982 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer9_slaves), 992 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer9_slaves),
983 .class = &omap3xxx_timer_hwmod_class, 993 .class = &omap3xxx_timer_hwmod_class,
984 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
985}; 994};
986 995
987/* timer10 */ 996/* timer10 */
@@ -1015,10 +1024,10 @@ static struct omap_hwmod omap3xxx_timer10_hwmod = {
1015 .idlest_idle_bit = OMAP3430_ST_GPT10_SHIFT, 1024 .idlest_idle_bit = OMAP3430_ST_GPT10_SHIFT,
1016 }, 1025 },
1017 }, 1026 },
1027 .dev_attr = &capability_pwm_dev_attr,
1018 .slaves = omap3xxx_timer10_slaves, 1028 .slaves = omap3xxx_timer10_slaves,
1019 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer10_slaves), 1029 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer10_slaves),
1020 .class = &omap3xxx_timer_1ms_hwmod_class, 1030 .class = &omap3xxx_timer_1ms_hwmod_class,
1021 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
1022}; 1031};
1023 1032
1024/* timer11 */ 1033/* timer11 */
@@ -1052,10 +1061,10 @@ static struct omap_hwmod omap3xxx_timer11_hwmod = {
1052 .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT, 1061 .idlest_idle_bit = OMAP3430_ST_GPT11_SHIFT,
1053 }, 1062 },
1054 }, 1063 },
1064 .dev_attr = &capability_pwm_dev_attr,
1055 .slaves = omap3xxx_timer11_slaves, 1065 .slaves = omap3xxx_timer11_slaves,
1056 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer11_slaves), 1066 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer11_slaves),
1057 .class = &omap3xxx_timer_hwmod_class, 1067 .class = &omap3xxx_timer_hwmod_class,
1058 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
1059}; 1068};
1060 1069
1061/* timer12*/ 1070/* timer12*/
@@ -1102,10 +1111,10 @@ static struct omap_hwmod omap3xxx_timer12_hwmod = {
1102 .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT, 1111 .idlest_idle_bit = OMAP3430_ST_GPT12_SHIFT,
1103 }, 1112 },
1104 }, 1113 },
1114 .dev_attr = &capability_secure_dev_attr,
1105 .slaves = omap3xxx_timer12_slaves, 1115 .slaves = omap3xxx_timer12_slaves,
1106 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer12_slaves), 1116 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer12_slaves),
1107 .class = &omap3xxx_timer_hwmod_class, 1117 .class = &omap3xxx_timer_hwmod_class,
1108 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
1109}; 1118};
1110 1119
1111/* l4_wkup -> wd_timer2 */ 1120/* l4_wkup -> wd_timer2 */
@@ -1182,7 +1191,6 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
1182 }, 1191 },
1183 .slaves = omap3xxx_wd_timer2_slaves, 1192 .slaves = omap3xxx_wd_timer2_slaves,
1184 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), 1193 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
1185 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1186 /* 1194 /*
1187 * XXX: Use software supervised mode, HW supervised smartidle seems to 1195 * XXX: Use software supervised mode, HW supervised smartidle seems to
1188 * block CORE power domain idle transitions. Maybe a HW bug in wdt2? 1196 * block CORE power domain idle transitions. Maybe a HW bug in wdt2?
@@ -1213,7 +1221,6 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
1213 .slaves = omap3xxx_uart1_slaves, 1221 .slaves = omap3xxx_uart1_slaves,
1214 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart1_slaves), 1222 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart1_slaves),
1215 .class = &omap2_uart_class, 1223 .class = &omap2_uart_class,
1216 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1217}; 1224};
1218 1225
1219/* UART2 */ 1226/* UART2 */
@@ -1239,7 +1246,6 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = {
1239 .slaves = omap3xxx_uart2_slaves, 1246 .slaves = omap3xxx_uart2_slaves,
1240 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart2_slaves), 1247 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart2_slaves),
1241 .class = &omap2_uart_class, 1248 .class = &omap2_uart_class,
1242 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1243}; 1249};
1244 1250
1245/* UART3 */ 1251/* UART3 */
@@ -1265,7 +1271,6 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = {
1265 .slaves = omap3xxx_uart3_slaves, 1271 .slaves = omap3xxx_uart3_slaves,
1266 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart3_slaves), 1272 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart3_slaves),
1267 .class = &omap2_uart_class, 1273 .class = &omap2_uart_class,
1268 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1269}; 1274};
1270 1275
1271/* UART4 */ 1276/* UART4 */
@@ -1302,7 +1307,6 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
1302 .slaves = omap3xxx_uart4_slaves, 1307 .slaves = omap3xxx_uart4_slaves,
1303 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart4_slaves), 1308 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart4_slaves),
1304 .class = &omap2_uart_class, 1309 .class = &omap2_uart_class,
1305 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
1306}; 1310};
1307 1311
1308static struct omap_hwmod_class i2c_class = { 1312static struct omap_hwmod_class i2c_class = {
@@ -1390,7 +1394,6 @@ static struct omap_hwmod omap3430es1_dss_core_hwmod = {
1390 .slaves_cnt = ARRAY_SIZE(omap3430es1_dss_slaves), 1394 .slaves_cnt = ARRAY_SIZE(omap3430es1_dss_slaves),
1391 .masters = omap3xxx_dss_masters, 1395 .masters = omap3xxx_dss_masters,
1392 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters), 1396 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters),
1393 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
1394 .flags = HWMOD_NO_IDLEST, 1397 .flags = HWMOD_NO_IDLEST,
1395}; 1398};
1396 1399
@@ -1415,8 +1418,6 @@ static struct omap_hwmod omap3xxx_dss_core_hwmod = {
1415 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_slaves), 1418 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_slaves),
1416 .masters = omap3xxx_dss_masters, 1419 .masters = omap3xxx_dss_masters,
1417 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters), 1420 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters),
1418 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2 |
1419 CHIP_IS_OMAP3630ES1 | CHIP_GE_OMAP3630ES1_1),
1420}; 1421};
1421 1422
1422/* l4_core -> dss_dispc */ 1423/* l4_core -> dss_dispc */
@@ -1454,9 +1455,6 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {
1454 }, 1455 },
1455 .slaves = omap3xxx_dss_dispc_slaves, 1456 .slaves = omap3xxx_dss_dispc_slaves,
1456 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dispc_slaves), 1457 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dispc_slaves),
1457 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
1458 CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
1459 CHIP_GE_OMAP3630ES1_1),
1460 .flags = HWMOD_NO_IDLEST, 1458 .flags = HWMOD_NO_IDLEST,
1461}; 1459};
1462 1460
@@ -1518,9 +1516,6 @@ static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = {
1518 }, 1516 },
1519 .slaves = omap3xxx_dss_dsi1_slaves, 1517 .slaves = omap3xxx_dss_dsi1_slaves,
1520 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves), 1518 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves),
1521 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
1522 CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
1523 CHIP_GE_OMAP3630ES1_1),
1524 .flags = HWMOD_NO_IDLEST, 1519 .flags = HWMOD_NO_IDLEST,
1525}; 1520};
1526 1521
@@ -1558,9 +1553,6 @@ static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = {
1558 }, 1553 },
1559 .slaves = omap3xxx_dss_rfbi_slaves, 1554 .slaves = omap3xxx_dss_rfbi_slaves,
1560 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves), 1555 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves),
1561 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
1562 CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
1563 CHIP_GE_OMAP3630ES1_1),
1564 .flags = HWMOD_NO_IDLEST, 1556 .flags = HWMOD_NO_IDLEST,
1565}; 1557};
1566 1558
@@ -1599,9 +1591,6 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
1599 }, 1591 },
1600 .slaves = omap3xxx_dss_venc_slaves, 1592 .slaves = omap3xxx_dss_venc_slaves,
1601 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_venc_slaves), 1593 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_venc_slaves),
1602 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
1603 CHIP_GE_OMAP3430ES2 | CHIP_IS_OMAP3630ES1 |
1604 CHIP_GE_OMAP3630ES1_1),
1605 .flags = HWMOD_NO_IDLEST, 1594 .flags = HWMOD_NO_IDLEST,
1606}; 1595};
1607 1596
@@ -1637,7 +1626,6 @@ static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1637 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c1_slaves), 1626 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c1_slaves),
1638 .class = &i2c_class, 1627 .class = &i2c_class,
1639 .dev_attr = &i2c1_dev_attr, 1628 .dev_attr = &i2c1_dev_attr,
1640 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1641}; 1629};
1642 1630
1643/* I2C2 */ 1631/* I2C2 */
@@ -1672,7 +1660,6 @@ static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1672 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c2_slaves), 1660 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c2_slaves),
1673 .class = &i2c_class, 1661 .class = &i2c_class,
1674 .dev_attr = &i2c2_dev_attr, 1662 .dev_attr = &i2c2_dev_attr,
1675 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1676}; 1663};
1677 1664
1678/* I2C3 */ 1665/* I2C3 */
@@ -1718,7 +1705,6 @@ static struct omap_hwmod omap3xxx_i2c3_hwmod = {
1718 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c3_slaves), 1705 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c3_slaves),
1719 .class = &i2c_class, 1706 .class = &i2c_class,
1720 .dev_attr = &i2c3_dev_attr, 1707 .dev_attr = &i2c3_dev_attr,
1721 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1722}; 1708};
1723 1709
1724/* l4_wkup -> gpio1 */ 1710/* l4_wkup -> gpio1 */
@@ -1880,7 +1866,6 @@ static struct omap_hwmod omap3xxx_gpio1_hwmod = {
1880 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio1_slaves), 1866 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio1_slaves),
1881 .class = &omap3xxx_gpio_hwmod_class, 1867 .class = &omap3xxx_gpio_hwmod_class,
1882 .dev_attr = &gpio_dev_attr, 1868 .dev_attr = &gpio_dev_attr,
1883 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1884}; 1869};
1885 1870
1886/* gpio2 */ 1871/* gpio2 */
@@ -1912,7 +1897,6 @@ static struct omap_hwmod omap3xxx_gpio2_hwmod = {
1912 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio2_slaves), 1897 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio2_slaves),
1913 .class = &omap3xxx_gpio_hwmod_class, 1898 .class = &omap3xxx_gpio_hwmod_class,
1914 .dev_attr = &gpio_dev_attr, 1899 .dev_attr = &gpio_dev_attr,
1915 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1916}; 1900};
1917 1901
1918/* gpio3 */ 1902/* gpio3 */
@@ -1944,7 +1928,6 @@ static struct omap_hwmod omap3xxx_gpio3_hwmod = {
1944 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio3_slaves), 1928 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio3_slaves),
1945 .class = &omap3xxx_gpio_hwmod_class, 1929 .class = &omap3xxx_gpio_hwmod_class,
1946 .dev_attr = &gpio_dev_attr, 1930 .dev_attr = &gpio_dev_attr,
1947 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1948}; 1931};
1949 1932
1950/* gpio4 */ 1933/* gpio4 */
@@ -1976,7 +1959,6 @@ static struct omap_hwmod omap3xxx_gpio4_hwmod = {
1976 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio4_slaves), 1959 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio4_slaves),
1977 .class = &omap3xxx_gpio_hwmod_class, 1960 .class = &omap3xxx_gpio_hwmod_class,
1978 .dev_attr = &gpio_dev_attr, 1961 .dev_attr = &gpio_dev_attr,
1979 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1980}; 1962};
1981 1963
1982/* gpio5 */ 1964/* gpio5 */
@@ -2013,7 +1995,6 @@ static struct omap_hwmod omap3xxx_gpio5_hwmod = {
2013 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio5_slaves), 1995 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio5_slaves),
2014 .class = &omap3xxx_gpio_hwmod_class, 1996 .class = &omap3xxx_gpio_hwmod_class,
2015 .dev_attr = &gpio_dev_attr, 1997 .dev_attr = &gpio_dev_attr,
2016 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2017}; 1998};
2018 1999
2019/* gpio6 */ 2000/* gpio6 */
@@ -2050,7 +2031,6 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = {
2050 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio6_slaves), 2031 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio6_slaves),
2051 .class = &omap3xxx_gpio_hwmod_class, 2032 .class = &omap3xxx_gpio_hwmod_class,
2052 .dev_attr = &gpio_dev_attr, 2033 .dev_attr = &gpio_dev_attr,
2053 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2054}; 2034};
2055 2035
2056/* dma_system -> L3 */ 2036/* dma_system -> L3 */
@@ -2134,7 +2114,6 @@ static struct omap_hwmod omap3xxx_dma_system_hwmod = {
2134 .masters = omap3xxx_dma_system_masters, 2114 .masters = omap3xxx_dma_system_masters,
2135 .masters_cnt = ARRAY_SIZE(omap3xxx_dma_system_masters), 2115 .masters_cnt = ARRAY_SIZE(omap3xxx_dma_system_masters),
2136 .dev_attr = &dma_dev_attr, 2116 .dev_attr = &dma_dev_attr,
2137 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2138 .flags = HWMOD_NO_IDLEST, 2117 .flags = HWMOD_NO_IDLEST,
2139}; 2118};
2140 2119
@@ -2207,7 +2186,6 @@ static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
2207 }, 2186 },
2208 .slaves = omap3xxx_mcbsp1_slaves, 2187 .slaves = omap3xxx_mcbsp1_slaves,
2209 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp1_slaves), 2188 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp1_slaves),
2210 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2211}; 2189};
2212 2190
2213/* mcbsp2 */ 2191/* mcbsp2 */
@@ -2264,7 +2242,6 @@ static struct omap_hwmod omap3xxx_mcbsp2_hwmod = {
2264 .slaves = omap3xxx_mcbsp2_slaves, 2242 .slaves = omap3xxx_mcbsp2_slaves,
2265 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_slaves), 2243 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_slaves),
2266 .dev_attr = &omap34xx_mcbsp2_dev_attr, 2244 .dev_attr = &omap34xx_mcbsp2_dev_attr,
2267 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2268}; 2245};
2269 2246
2270/* mcbsp3 */ 2247/* mcbsp3 */
@@ -2321,7 +2298,6 @@ static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
2321 .slaves = omap3xxx_mcbsp3_slaves, 2298 .slaves = omap3xxx_mcbsp3_slaves,
2322 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_slaves), 2299 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_slaves),
2323 .dev_attr = &omap34xx_mcbsp3_dev_attr, 2300 .dev_attr = &omap34xx_mcbsp3_dev_attr,
2324 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2325}; 2301};
2326 2302
2327/* mcbsp4 */ 2303/* mcbsp4 */
@@ -2379,7 +2355,6 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
2379 }, 2355 },
2380 .slaves = omap3xxx_mcbsp4_slaves, 2356 .slaves = omap3xxx_mcbsp4_slaves,
2381 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp4_slaves), 2357 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp4_slaves),
2382 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2383}; 2358};
2384 2359
2385/* mcbsp5 */ 2360/* mcbsp5 */
@@ -2437,7 +2412,6 @@ static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
2437 }, 2412 },
2438 .slaves = omap3xxx_mcbsp5_slaves, 2413 .slaves = omap3xxx_mcbsp5_slaves,
2439 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp5_slaves), 2414 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp5_slaves),
2440 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2441}; 2415};
2442/* 'mcbsp sidetone' class */ 2416/* 'mcbsp sidetone' class */
2443 2417
@@ -2498,7 +2472,6 @@ static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod = {
2498 }, 2472 },
2499 .slaves = omap3xxx_mcbsp2_sidetone_slaves, 2473 .slaves = omap3xxx_mcbsp2_sidetone_slaves,
2500 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_sidetone_slaves), 2474 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_sidetone_slaves),
2501 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2502}; 2475};
2503 2476
2504/* mcbsp3_sidetone */ 2477/* mcbsp3_sidetone */
@@ -2547,7 +2520,6 @@ static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = {
2547 }, 2520 },
2548 .slaves = omap3xxx_mcbsp3_sidetone_slaves, 2521 .slaves = omap3xxx_mcbsp3_sidetone_slaves,
2549 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_sidetone_slaves), 2522 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_sidetone_slaves),
2550 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2551}; 2523};
2552 2524
2553 2525
@@ -2597,7 +2569,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2597 .name = "sr1_hwmod", 2569 .name = "sr1_hwmod",
2598 .class = &omap34xx_smartreflex_hwmod_class, 2570 .class = &omap34xx_smartreflex_hwmod_class,
2599 .main_clk = "sr1_fck", 2571 .main_clk = "sr1_fck",
2600 .vdd_name = "mpu", 2572 .vdd_name = "mpu_iva",
2601 .prcm = { 2573 .prcm = {
2602 .omap2 = { 2574 .omap2 = {
2603 .prcm_reg_id = 1, 2575 .prcm_reg_id = 1,
@@ -2609,9 +2581,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2609 }, 2581 },
2610 .slaves = omap3_sr1_slaves, 2582 .slaves = omap3_sr1_slaves,
2611 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2583 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2612 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2 |
2613 CHIP_IS_OMAP3430ES3_0 |
2614 CHIP_IS_OMAP3430ES3_1),
2615 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2584 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2616}; 2585};
2617 2586
@@ -2619,7 +2588,7 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2619 .name = "sr1_hwmod", 2588 .name = "sr1_hwmod",
2620 .class = &omap36xx_smartreflex_hwmod_class, 2589 .class = &omap36xx_smartreflex_hwmod_class,
2621 .main_clk = "sr1_fck", 2590 .main_clk = "sr1_fck",
2622 .vdd_name = "mpu", 2591 .vdd_name = "mpu_iva",
2623 .prcm = { 2592 .prcm = {
2624 .omap2 = { 2593 .omap2 = {
2625 .prcm_reg_id = 1, 2594 .prcm_reg_id = 1,
@@ -2631,7 +2600,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2631 }, 2600 },
2632 .slaves = omap3_sr1_slaves, 2601 .slaves = omap3_sr1_slaves,
2633 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), 2602 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2634 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
2635}; 2603};
2636 2604
2637/* SR2 */ 2605/* SR2 */
@@ -2655,9 +2623,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2655 }, 2623 },
2656 .slaves = omap3_sr2_slaves, 2624 .slaves = omap3_sr2_slaves,
2657 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2625 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2658 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES2 |
2659 CHIP_IS_OMAP3430ES3_0 |
2660 CHIP_IS_OMAP3430ES3_1),
2661 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2626 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2662}; 2627};
2663 2628
@@ -2677,7 +2642,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2677 }, 2642 },
2678 .slaves = omap3_sr2_slaves, 2643 .slaves = omap3_sr2_slaves,
2679 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), 2644 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2680 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1),
2681}; 2645};
2682 2646
2683/* 2647/*
@@ -2745,7 +2709,6 @@ static struct omap_hwmod omap3xxx_mailbox_hwmod = {
2745 }, 2709 },
2746 .slaves = omap3xxx_mailbox_slaves, 2710 .slaves = omap3xxx_mailbox_slaves,
2747 .slaves_cnt = ARRAY_SIZE(omap3xxx_mailbox_slaves), 2711 .slaves_cnt = ARRAY_SIZE(omap3xxx_mailbox_slaves),
2748 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2749}; 2712};
2750 2713
2751/* l4 core -> mcspi1 interface */ 2714/* l4 core -> mcspi1 interface */
@@ -2843,7 +2806,6 @@ static struct omap_hwmod omap34xx_mcspi1 = {
2843 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi1_slaves), 2806 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi1_slaves),
2844 .class = &omap34xx_mcspi_class, 2807 .class = &omap34xx_mcspi_class,
2845 .dev_attr = &omap_mcspi1_dev_attr, 2808 .dev_attr = &omap_mcspi1_dev_attr,
2846 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2847}; 2809};
2848 2810
2849/* mcspi2 */ 2811/* mcspi2 */
@@ -2873,7 +2835,6 @@ static struct omap_hwmod omap34xx_mcspi2 = {
2873 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi2_slaves), 2835 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi2_slaves),
2874 .class = &omap34xx_mcspi_class, 2836 .class = &omap34xx_mcspi_class,
2875 .dev_attr = &omap_mcspi2_dev_attr, 2837 .dev_attr = &omap_mcspi2_dev_attr,
2876 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2877}; 2838};
2878 2839
2879/* mcspi3 */ 2840/* mcspi3 */
@@ -2916,7 +2877,6 @@ static struct omap_hwmod omap34xx_mcspi3 = {
2916 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi3_slaves), 2877 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi3_slaves),
2917 .class = &omap34xx_mcspi_class, 2878 .class = &omap34xx_mcspi_class,
2918 .dev_attr = &omap_mcspi3_dev_attr, 2879 .dev_attr = &omap_mcspi3_dev_attr,
2919 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2920}; 2880};
2921 2881
2922/* SPI4 */ 2882/* SPI4 */
@@ -2957,7 +2917,6 @@ static struct omap_hwmod omap34xx_mcspi4 = {
2957 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi4_slaves), 2917 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi4_slaves),
2958 .class = &omap34xx_mcspi_class, 2918 .class = &omap34xx_mcspi_class,
2959 .dev_attr = &omap_mcspi4_dev_attr, 2919 .dev_attr = &omap_mcspi4_dev_attr,
2960 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
2961}; 2920};
2962 2921
2963/* 2922/*
@@ -3014,7 +2973,6 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
3014 */ 2973 */
3015 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE 2974 .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE
3016 | HWMOD_SWSUP_MSTANDBY, 2975 | HWMOD_SWSUP_MSTANDBY,
3017 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
3018}; 2976};
3019 2977
3020/* usb_otg_hs */ 2978/* usb_otg_hs */
@@ -3042,7 +3000,6 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
3042 .slaves = am35xx_usbhsotg_slaves, 3000 .slaves = am35xx_usbhsotg_slaves,
3043 .slaves_cnt = ARRAY_SIZE(am35xx_usbhsotg_slaves), 3001 .slaves_cnt = ARRAY_SIZE(am35xx_usbhsotg_slaves),
3044 .class = &am35xx_usbotg_class, 3002 .class = &am35xx_usbotg_class,
3045 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1)
3046}; 3003};
3047 3004
3048/* MMC/SD/SDIO common */ 3005/* MMC/SD/SDIO common */
@@ -3108,7 +3065,6 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = {
3108 .slaves = omap3xxx_mmc1_slaves, 3065 .slaves = omap3xxx_mmc1_slaves,
3109 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves), 3066 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
3110 .class = &omap34xx_mmc_class, 3067 .class = &omap34xx_mmc_class,
3111 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
3112}; 3068};
3113 3069
3114/* MMC/SD/SDIO2 */ 3070/* MMC/SD/SDIO2 */
@@ -3151,7 +3107,6 @@ static struct omap_hwmod omap3xxx_mmc2_hwmod = {
3151 .slaves = omap3xxx_mmc2_slaves, 3107 .slaves = omap3xxx_mmc2_slaves,
3152 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves), 3108 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves),
3153 .class = &omap34xx_mmc_class, 3109 .class = &omap34xx_mmc_class,
3154 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
3155}; 3110};
3156 3111
3157/* MMC/SD/SDIO3 */ 3112/* MMC/SD/SDIO3 */
@@ -3193,7 +3148,6 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
3193 .slaves = omap3xxx_mmc3_slaves, 3148 .slaves = omap3xxx_mmc3_slaves,
3194 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc3_slaves), 3149 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc3_slaves),
3195 .class = &omap34xx_mmc_class, 3150 .class = &omap34xx_mmc_class,
3196 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
3197}; 3151};
3198 3152
3199static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { 3153static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
@@ -3224,10 +3178,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3224 &omap3xxx_uart1_hwmod, 3178 &omap3xxx_uart1_hwmod,
3225 &omap3xxx_uart2_hwmod, 3179 &omap3xxx_uart2_hwmod,
3226 &omap3xxx_uart3_hwmod, 3180 &omap3xxx_uart3_hwmod,
3227 &omap3xxx_uart4_hwmod,
3228 /* dss class */ 3181 /* dss class */
3229 &omap3430es1_dss_core_hwmod,
3230 &omap3xxx_dss_core_hwmod,
3231 &omap3xxx_dss_dispc_hwmod, 3182 &omap3xxx_dss_dispc_hwmod,
3232 &omap3xxx_dss_dsi1_hwmod, 3183 &omap3xxx_dss_dsi1_hwmod,
3233 &omap3xxx_dss_rfbi_hwmod, 3184 &omap3xxx_dss_rfbi_hwmod,
@@ -3239,9 +3190,6 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3239 &omap3xxx_i2c3_hwmod, 3190 &omap3xxx_i2c3_hwmod,
3240 &omap34xx_sr1_hwmod, 3191 &omap34xx_sr1_hwmod,
3241 &omap34xx_sr2_hwmod, 3192 &omap34xx_sr2_hwmod,
3242 &omap36xx_sr1_hwmod,
3243 &omap36xx_sr2_hwmod,
3244
3245 3193
3246 /* gpio class */ 3194 /* gpio class */
3247 &omap3xxx_gpio1_hwmod, 3195 &omap3xxx_gpio1_hwmod,
@@ -3272,16 +3220,96 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3272 &omap34xx_mcspi3, 3220 &omap34xx_mcspi3,
3273 &omap34xx_mcspi4, 3221 &omap34xx_mcspi4,
3274 3222
3275 /* usbotg class */ 3223 NULL,
3224};
3225
3226/* 3430ES1-only hwmods */
3227static __initdata struct omap_hwmod *omap3430es1_hwmods[] = {
3228 &omap3430es1_dss_core_hwmod,
3229 NULL
3230};
3231
3232/* 3430ES2+-only hwmods */
3233static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = {
3234 &omap3xxx_dss_core_hwmod,
3276 &omap3xxx_usbhsotg_hwmod, 3235 &omap3xxx_usbhsotg_hwmod,
3236 NULL
3237};
3277 3238
3278 /* usbotg for am35x */ 3239/* 34xx-only hwmods (all ES revisions) */
3279 &am35xx_usbhsotg_hwmod, 3240static __initdata struct omap_hwmod *omap34xx_hwmods[] = {
3241 &omap34xx_sr1_hwmod,
3242 &omap34xx_sr2_hwmod,
3243 NULL
3244};
3280 3245
3281 NULL, 3246/* 36xx-only hwmods (all ES revisions) */
3247static __initdata struct omap_hwmod *omap36xx_hwmods[] = {
3248 &omap3xxx_uart4_hwmod,
3249 &omap3xxx_dss_core_hwmod,
3250 &omap36xx_sr1_hwmod,
3251 &omap36xx_sr2_hwmod,
3252 &omap3xxx_usbhsotg_hwmod,
3253 NULL
3254};
3255
3256static __initdata struct omap_hwmod *am35xx_hwmods[] = {
3257 &omap3xxx_dss_core_hwmod, /* XXX ??? */
3258 &am35xx_usbhsotg_hwmod,
3259 NULL
3282}; 3260};
3283 3261
3284int __init omap3xxx_hwmod_init(void) 3262int __init omap3xxx_hwmod_init(void)
3285{ 3263{
3286 return omap_hwmod_register(omap3xxx_hwmods); 3264 int r;
3265 struct omap_hwmod **h = NULL;
3266 unsigned int rev;
3267
3268 /* Register hwmods common to all OMAP3 */
3269 r = omap_hwmod_register(omap3xxx_hwmods);
3270 if (!r)
3271 return r;
3272
3273 rev = omap_rev();
3274
3275 /*
3276 * Register hwmods common to individual OMAP3 families, all
3277 * silicon revisions (e.g., 34xx, or AM3505/3517, or 36xx)
3278 * All possible revisions should be included in this conditional.
3279 */
3280 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
3281 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 ||
3282 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) {
3283 h = omap34xx_hwmods;
3284 } else if (rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1) {
3285 h = am35xx_hwmods;
3286 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 ||
3287 rev == OMAP3630_REV_ES1_2) {
3288 h = omap36xx_hwmods;
3289 } else {
3290 WARN(1, "OMAP3 hwmod family init: unknown chip type\n");
3291 return -EINVAL;
3292 };
3293
3294 r = omap_hwmod_register(h);
3295 if (!r)
3296 return r;
3297
3298 /*
3299 * Register hwmods specific to certain ES levels of a
3300 * particular family of silicon (e.g., 34xx ES1.0)
3301 */
3302 h = NULL;
3303 if (rev == OMAP3430_REV_ES1_0) {
3304 h = omap3430es1_hwmods;
3305 } else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
3306 rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
3307 rev == OMAP3430_REV_ES3_1_2) {
3308 h = omap3430es2plus_hwmods;
3309 };
3310
3311 if (h)
3312 r = omap_hwmod_register(h);
3313
3314 return r;
3287} 3315}
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 6201422c0606..393afac9caf6 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -29,6 +29,7 @@
29#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
30#include <plat/mmc.h> 30#include <plat/mmc.h>
31#include <plat/i2c.h> 31#include <plat/i2c.h>
32#include <plat/dmtimer.h>
32 33
33#include "omap_hwmod_common_data.h" 34#include "omap_hwmod_common_data.h"
34 35
@@ -133,7 +134,6 @@ static struct omap_hwmod omap44xx_dmm_hwmod = {
133 .slaves = omap44xx_dmm_slaves, 134 .slaves = omap44xx_dmm_slaves,
134 .slaves_cnt = ARRAY_SIZE(omap44xx_dmm_slaves), 135 .slaves_cnt = ARRAY_SIZE(omap44xx_dmm_slaves),
135 .mpu_irqs = omap44xx_dmm_irqs, 136 .mpu_irqs = omap44xx_dmm_irqs,
136 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
137}; 137};
138 138
139/* 139/*
@@ -189,7 +189,6 @@ static struct omap_hwmod omap44xx_emif_fw_hwmod = {
189 }, 189 },
190 .slaves = omap44xx_emif_fw_slaves, 190 .slaves = omap44xx_emif_fw_slaves,
191 .slaves_cnt = ARRAY_SIZE(omap44xx_emif_fw_slaves), 191 .slaves_cnt = ARRAY_SIZE(omap44xx_emif_fw_slaves),
192 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
193}; 192};
194 193
195/* 194/*
@@ -236,7 +235,6 @@ static struct omap_hwmod omap44xx_l3_instr_hwmod = {
236 }, 235 },
237 .slaves = omap44xx_l3_instr_slaves, 236 .slaves = omap44xx_l3_instr_slaves,
238 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_instr_slaves), 237 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_instr_slaves),
239 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
240}; 238};
241 239
242/* l3_main_1 */ 240/* l3_main_1 */
@@ -336,7 +334,6 @@ static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
336 }, 334 },
337 .slaves = omap44xx_l3_main_1_slaves, 335 .slaves = omap44xx_l3_main_1_slaves,
338 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_1_slaves), 336 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_1_slaves),
339 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
340}; 337};
341 338
342/* l3_main_2 */ 339/* l3_main_2 */
@@ -438,7 +435,6 @@ static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
438 }, 435 },
439 .slaves = omap44xx_l3_main_2_slaves, 436 .slaves = omap44xx_l3_main_2_slaves,
440 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_2_slaves), 437 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_2_slaves),
441 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
442}; 438};
443 439
444/* l3_main_3 */ 440/* l3_main_3 */
@@ -496,7 +492,6 @@ static struct omap_hwmod omap44xx_l3_main_3_hwmod = {
496 }, 492 },
497 .slaves = omap44xx_l3_main_3_slaves, 493 .slaves = omap44xx_l3_main_3_slaves,
498 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_3_slaves), 494 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_3_slaves),
499 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
500}; 495};
501 496
502/* 497/*
@@ -559,7 +554,6 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod = {
559 }, 554 },
560 .slaves = omap44xx_l4_abe_slaves, 555 .slaves = omap44xx_l4_abe_slaves,
561 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_abe_slaves), 556 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_abe_slaves),
562 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
563}; 557};
564 558
565/* l4_cfg */ 559/* l4_cfg */
@@ -588,7 +582,6 @@ static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
588 }, 582 },
589 .slaves = omap44xx_l4_cfg_slaves, 583 .slaves = omap44xx_l4_cfg_slaves,
590 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_cfg_slaves), 584 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_cfg_slaves),
591 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
592}; 585};
593 586
594/* l4_per */ 587/* l4_per */
@@ -617,7 +610,6 @@ static struct omap_hwmod omap44xx_l4_per_hwmod = {
617 }, 610 },
618 .slaves = omap44xx_l4_per_slaves, 611 .slaves = omap44xx_l4_per_slaves,
619 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_per_slaves), 612 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_per_slaves),
620 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
621}; 613};
622 614
623/* l4_wkup */ 615/* l4_wkup */
@@ -646,7 +638,6 @@ static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
646 }, 638 },
647 .slaves = omap44xx_l4_wkup_slaves, 639 .slaves = omap44xx_l4_wkup_slaves,
648 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_wkup_slaves), 640 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_wkup_slaves),
649 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
650}; 641};
651 642
652/* 643/*
@@ -677,7 +668,6 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
677 .clkdm_name = "mpuss_clkdm", 668 .clkdm_name = "mpuss_clkdm",
678 .slaves = omap44xx_mpu_private_slaves, 669 .slaves = omap44xx_mpu_private_slaves,
679 .slaves_cnt = ARRAY_SIZE(omap44xx_mpu_private_slaves), 670 .slaves_cnt = ARRAY_SIZE(omap44xx_mpu_private_slaves),
680 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
681}; 671};
682 672
683/* 673/*
@@ -828,7 +818,6 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
828 .slaves_cnt = ARRAY_SIZE(omap44xx_aess_slaves), 818 .slaves_cnt = ARRAY_SIZE(omap44xx_aess_slaves),
829 .masters = omap44xx_aess_masters, 819 .masters = omap44xx_aess_masters,
830 .masters_cnt = ARRAY_SIZE(omap44xx_aess_masters), 820 .masters_cnt = ARRAY_SIZE(omap44xx_aess_masters),
831 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
832}; 821};
833 822
834/* 823/*
@@ -856,7 +845,6 @@ static struct omap_hwmod omap44xx_bandgap_hwmod = {
856 }, 845 },
857 .opt_clks = bandgap_opt_clks, 846 .opt_clks = bandgap_opt_clks,
858 .opt_clks_cnt = ARRAY_SIZE(bandgap_opt_clks), 847 .opt_clks_cnt = ARRAY_SIZE(bandgap_opt_clks),
859 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
860}; 848};
861 849
862/* 850/*
@@ -917,7 +905,6 @@ static struct omap_hwmod omap44xx_counter_32k_hwmod = {
917 }, 905 },
918 .slaves = omap44xx_counter_32k_slaves, 906 .slaves = omap44xx_counter_32k_slaves,
919 .slaves_cnt = ARRAY_SIZE(omap44xx_counter_32k_slaves), 907 .slaves_cnt = ARRAY_SIZE(omap44xx_counter_32k_slaves),
920 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
921}; 908};
922 909
923/* 910/*
@@ -1005,7 +992,6 @@ static struct omap_hwmod omap44xx_dma_system_hwmod = {
1005 .slaves_cnt = ARRAY_SIZE(omap44xx_dma_system_slaves), 992 .slaves_cnt = ARRAY_SIZE(omap44xx_dma_system_slaves),
1006 .masters = omap44xx_dma_system_masters, 993 .masters = omap44xx_dma_system_masters,
1007 .masters_cnt = ARRAY_SIZE(omap44xx_dma_system_masters), 994 .masters_cnt = ARRAY_SIZE(omap44xx_dma_system_masters),
1008 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1009}; 995};
1010 996
1011/* 997/*
@@ -1098,7 +1084,6 @@ static struct omap_hwmod omap44xx_dmic_hwmod = {
1098 }, 1084 },
1099 .slaves = omap44xx_dmic_slaves, 1085 .slaves = omap44xx_dmic_slaves,
1100 .slaves_cnt = ARRAY_SIZE(omap44xx_dmic_slaves), 1086 .slaves_cnt = ARRAY_SIZE(omap44xx_dmic_slaves),
1101 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1102}; 1087};
1103 1088
1104/* 1089/*
@@ -1164,7 +1149,6 @@ static struct omap_hwmod omap44xx_dsp_c0_hwmod = {
1164 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET, 1149 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
1165 }, 1150 },
1166 }, 1151 },
1167 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1168}; 1152};
1169 1153
1170static struct omap_hwmod omap44xx_dsp_hwmod = { 1154static struct omap_hwmod omap44xx_dsp_hwmod = {
@@ -1187,7 +1171,6 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
1187 .slaves_cnt = ARRAY_SIZE(omap44xx_dsp_slaves), 1171 .slaves_cnt = ARRAY_SIZE(omap44xx_dsp_slaves),
1188 .masters = omap44xx_dsp_masters, 1172 .masters = omap44xx_dsp_masters,
1189 .masters_cnt = ARRAY_SIZE(omap44xx_dsp_masters), 1173 .masters_cnt = ARRAY_SIZE(omap44xx_dsp_masters),
1190 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1191}; 1174};
1192 1175
1193/* 1176/*
@@ -1278,7 +1261,6 @@ static struct omap_hwmod omap44xx_dss_hwmod = {
1278 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_slaves), 1261 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_slaves),
1279 .masters = omap44xx_dss_masters, 1262 .masters = omap44xx_dss_masters,
1280 .masters_cnt = ARRAY_SIZE(omap44xx_dss_masters), 1263 .masters_cnt = ARRAY_SIZE(omap44xx_dss_masters),
1281 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1282}; 1264};
1283 1265
1284/* 1266/*
@@ -1381,7 +1363,6 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
1381 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks), 1363 .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks),
1382 .slaves = omap44xx_dss_dispc_slaves, 1364 .slaves = omap44xx_dss_dispc_slaves,
1383 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves), 1365 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves),
1384 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1385}; 1366};
1386 1367
1387/* 1368/*
@@ -1480,7 +1461,6 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
1480 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks), 1461 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks),
1481 .slaves = omap44xx_dss_dsi1_slaves, 1462 .slaves = omap44xx_dss_dsi1_slaves,
1482 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi1_slaves), 1463 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi1_slaves),
1483 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1484}; 1464};
1485 1465
1486/* dss_dsi2 */ 1466/* dss_dsi2 */
@@ -1558,7 +1538,6 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
1558 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks), 1538 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks),
1559 .slaves = omap44xx_dss_dsi2_slaves, 1539 .slaves = omap44xx_dss_dsi2_slaves,
1560 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi2_slaves), 1540 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi2_slaves),
1561 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1562}; 1541};
1563 1542
1564/* 1543/*
@@ -1656,7 +1635,6 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
1656 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks), 1635 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
1657 .slaves = omap44xx_dss_hdmi_slaves, 1636 .slaves = omap44xx_dss_hdmi_slaves,
1658 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_hdmi_slaves), 1637 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_hdmi_slaves),
1659 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1660}; 1638};
1661 1639
1662/* 1640/*
@@ -1748,7 +1726,6 @@ static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
1748 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), 1726 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
1749 .slaves = omap44xx_dss_rfbi_slaves, 1727 .slaves = omap44xx_dss_rfbi_slaves,
1750 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_rfbi_slaves), 1728 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_rfbi_slaves),
1751 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1752}; 1729};
1753 1730
1754/* 1731/*
@@ -1817,7 +1794,6 @@ static struct omap_hwmod omap44xx_dss_venc_hwmod = {
1817 }, 1794 },
1818 .slaves = omap44xx_dss_venc_slaves, 1795 .slaves = omap44xx_dss_venc_slaves,
1819 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_venc_slaves), 1796 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_venc_slaves),
1820 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1821}; 1797};
1822 1798
1823/* 1799/*
@@ -1901,7 +1877,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
1901 .dev_attr = &gpio_dev_attr, 1877 .dev_attr = &gpio_dev_attr,
1902 .slaves = omap44xx_gpio1_slaves, 1878 .slaves = omap44xx_gpio1_slaves,
1903 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves), 1879 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves),
1904 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1905}; 1880};
1906 1881
1907/* gpio2 */ 1882/* gpio2 */
@@ -1957,7 +1932,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
1957 .dev_attr = &gpio_dev_attr, 1932 .dev_attr = &gpio_dev_attr,
1958 .slaves = omap44xx_gpio2_slaves, 1933 .slaves = omap44xx_gpio2_slaves,
1959 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves), 1934 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves),
1960 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
1961}; 1935};
1962 1936
1963/* gpio3 */ 1937/* gpio3 */
@@ -2013,7 +1987,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
2013 .dev_attr = &gpio_dev_attr, 1987 .dev_attr = &gpio_dev_attr,
2014 .slaves = omap44xx_gpio3_slaves, 1988 .slaves = omap44xx_gpio3_slaves,
2015 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio3_slaves), 1989 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio3_slaves),
2016 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2017}; 1990};
2018 1991
2019/* gpio4 */ 1992/* gpio4 */
@@ -2069,7 +2042,6 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
2069 .dev_attr = &gpio_dev_attr, 2042 .dev_attr = &gpio_dev_attr,
2070 .slaves = omap44xx_gpio4_slaves, 2043 .slaves = omap44xx_gpio4_slaves,
2071 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio4_slaves), 2044 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio4_slaves),
2072 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2073}; 2045};
2074 2046
2075/* gpio5 */ 2047/* gpio5 */
@@ -2125,7 +2097,6 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
2125 .dev_attr = &gpio_dev_attr, 2097 .dev_attr = &gpio_dev_attr,
2126 .slaves = omap44xx_gpio5_slaves, 2098 .slaves = omap44xx_gpio5_slaves,
2127 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio5_slaves), 2099 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio5_slaves),
2128 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2129}; 2100};
2130 2101
2131/* gpio6 */ 2102/* gpio6 */
@@ -2181,7 +2152,6 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
2181 .dev_attr = &gpio_dev_attr, 2152 .dev_attr = &gpio_dev_attr,
2182 .slaves = omap44xx_gpio6_slaves, 2153 .slaves = omap44xx_gpio6_slaves,
2183 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves), 2154 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves),
2184 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2185}; 2155};
2186 2156
2187/* 2157/*
@@ -2261,7 +2231,6 @@ static struct omap_hwmod omap44xx_hsi_hwmod = {
2261 .slaves_cnt = ARRAY_SIZE(omap44xx_hsi_slaves), 2231 .slaves_cnt = ARRAY_SIZE(omap44xx_hsi_slaves),
2262 .masters = omap44xx_hsi_masters, 2232 .masters = omap44xx_hsi_masters,
2263 .masters_cnt = ARRAY_SIZE(omap44xx_hsi_masters), 2233 .masters_cnt = ARRAY_SIZE(omap44xx_hsi_masters),
2264 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2265}; 2234};
2266 2235
2267/* 2236/*
@@ -2345,7 +2314,6 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
2345 .slaves = omap44xx_i2c1_slaves, 2314 .slaves = omap44xx_i2c1_slaves,
2346 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves), 2315 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves),
2347 .dev_attr = &i2c_dev_attr, 2316 .dev_attr = &i2c_dev_attr,
2348 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2349}; 2317};
2350 2318
2351/* i2c2 */ 2319/* i2c2 */
@@ -2402,7 +2370,6 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
2402 .slaves = omap44xx_i2c2_slaves, 2370 .slaves = omap44xx_i2c2_slaves,
2403 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves), 2371 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves),
2404 .dev_attr = &i2c_dev_attr, 2372 .dev_attr = &i2c_dev_attr,
2405 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2406}; 2373};
2407 2374
2408/* i2c3 */ 2375/* i2c3 */
@@ -2459,7 +2426,6 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
2459 .slaves = omap44xx_i2c3_slaves, 2426 .slaves = omap44xx_i2c3_slaves,
2460 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves), 2427 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves),
2461 .dev_attr = &i2c_dev_attr, 2428 .dev_attr = &i2c_dev_attr,
2462 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2463}; 2429};
2464 2430
2465/* i2c4 */ 2431/* i2c4 */
@@ -2516,7 +2482,6 @@ static struct omap_hwmod omap44xx_i2c4_hwmod = {
2516 .slaves = omap44xx_i2c4_slaves, 2482 .slaves = omap44xx_i2c4_slaves,
2517 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves), 2483 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves),
2518 .dev_attr = &i2c_dev_attr, 2484 .dev_attr = &i2c_dev_attr,
2519 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2520}; 2485};
2521 2486
2522/* 2487/*
@@ -2577,7 +2542,6 @@ static struct omap_hwmod omap44xx_ipu_c0_hwmod = {
2577 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET, 2542 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2578 }, 2543 },
2579 }, 2544 },
2580 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2581}; 2545};
2582 2546
2583/* Pseudo hwmod for reset control purpose only */ 2547/* Pseudo hwmod for reset control purpose only */
@@ -2593,7 +2557,6 @@ static struct omap_hwmod omap44xx_ipu_c1_hwmod = {
2593 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET, 2557 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2594 }, 2558 },
2595 }, 2559 },
2596 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2597}; 2560};
2598 2561
2599static struct omap_hwmod omap44xx_ipu_hwmod = { 2562static struct omap_hwmod omap44xx_ipu_hwmod = {
@@ -2616,7 +2579,6 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
2616 .slaves_cnt = ARRAY_SIZE(omap44xx_ipu_slaves), 2579 .slaves_cnt = ARRAY_SIZE(omap44xx_ipu_slaves),
2617 .masters = omap44xx_ipu_masters, 2580 .masters = omap44xx_ipu_masters,
2618 .masters_cnt = ARRAY_SIZE(omap44xx_ipu_masters), 2581 .masters_cnt = ARRAY_SIZE(omap44xx_ipu_masters),
2619 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2620}; 2582};
2621 2583
2622/* 2584/*
@@ -2706,7 +2668,6 @@ static struct omap_hwmod omap44xx_iss_hwmod = {
2706 .slaves_cnt = ARRAY_SIZE(omap44xx_iss_slaves), 2668 .slaves_cnt = ARRAY_SIZE(omap44xx_iss_slaves),
2707 .masters = omap44xx_iss_masters, 2669 .masters = omap44xx_iss_masters,
2708 .masters_cnt = ARRAY_SIZE(omap44xx_iss_masters), 2670 .masters_cnt = ARRAY_SIZE(omap44xx_iss_masters),
2709 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2710}; 2671};
2711 2672
2712/* 2673/*
@@ -2781,7 +2742,6 @@ static struct omap_hwmod omap44xx_iva_seq0_hwmod = {
2781 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET, 2742 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2782 }, 2743 },
2783 }, 2744 },
2784 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2785}; 2745};
2786 2746
2787/* Pseudo hwmod for reset control purpose only */ 2747/* Pseudo hwmod for reset control purpose only */
@@ -2797,7 +2757,6 @@ static struct omap_hwmod omap44xx_iva_seq1_hwmod = {
2797 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET, 2757 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2798 }, 2758 },
2799 }, 2759 },
2800 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2801}; 2760};
2802 2761
2803static struct omap_hwmod omap44xx_iva_hwmod = { 2762static struct omap_hwmod omap44xx_iva_hwmod = {
@@ -2820,7 +2779,6 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
2820 .slaves_cnt = ARRAY_SIZE(omap44xx_iva_slaves), 2779 .slaves_cnt = ARRAY_SIZE(omap44xx_iva_slaves),
2821 .masters = omap44xx_iva_masters, 2780 .masters = omap44xx_iva_masters,
2822 .masters_cnt = ARRAY_SIZE(omap44xx_iva_masters), 2781 .masters_cnt = ARRAY_SIZE(omap44xx_iva_masters),
2823 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2824}; 2782};
2825 2783
2826/* 2784/*
@@ -2890,7 +2848,6 @@ static struct omap_hwmod omap44xx_kbd_hwmod = {
2890 }, 2848 },
2891 .slaves = omap44xx_kbd_slaves, 2849 .slaves = omap44xx_kbd_slaves,
2892 .slaves_cnt = ARRAY_SIZE(omap44xx_kbd_slaves), 2850 .slaves_cnt = ARRAY_SIZE(omap44xx_kbd_slaves),
2893 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2894}; 2851};
2895 2852
2896/* 2853/*
@@ -2956,7 +2913,6 @@ static struct omap_hwmod omap44xx_mailbox_hwmod = {
2956 }, 2913 },
2957 .slaves = omap44xx_mailbox_slaves, 2914 .slaves = omap44xx_mailbox_slaves,
2958 .slaves_cnt = ARRAY_SIZE(omap44xx_mailbox_slaves), 2915 .slaves_cnt = ARRAY_SIZE(omap44xx_mailbox_slaves),
2959 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
2960}; 2916};
2961 2917
2962/* 2918/*
@@ -3051,7 +3007,6 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
3051 }, 3007 },
3052 .slaves = omap44xx_mcbsp1_slaves, 3008 .slaves = omap44xx_mcbsp1_slaves,
3053 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves), 3009 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves),
3054 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3055}; 3010};
3056 3011
3057/* mcbsp2 */ 3012/* mcbsp2 */
@@ -3127,7 +3082,6 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
3127 }, 3082 },
3128 .slaves = omap44xx_mcbsp2_slaves, 3083 .slaves = omap44xx_mcbsp2_slaves,
3129 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves), 3084 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves),
3130 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3131}; 3085};
3132 3086
3133/* mcbsp3 */ 3087/* mcbsp3 */
@@ -3203,7 +3157,6 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
3203 }, 3157 },
3204 .slaves = omap44xx_mcbsp3_slaves, 3158 .slaves = omap44xx_mcbsp3_slaves,
3205 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves), 3159 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves),
3206 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3207}; 3160};
3208 3161
3209/* mcbsp4 */ 3162/* mcbsp4 */
@@ -3258,7 +3211,6 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
3258 }, 3211 },
3259 .slaves = omap44xx_mcbsp4_slaves, 3212 .slaves = omap44xx_mcbsp4_slaves,
3260 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves), 3213 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves),
3261 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3262}; 3214};
3263 3215
3264/* 3216/*
@@ -3353,7 +3305,6 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
3353 }, 3305 },
3354 .slaves = omap44xx_mcpdm_slaves, 3306 .slaves = omap44xx_mcpdm_slaves,
3355 .slaves_cnt = ARRAY_SIZE(omap44xx_mcpdm_slaves), 3307 .slaves_cnt = ARRAY_SIZE(omap44xx_mcpdm_slaves),
3356 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3357}; 3308};
3358 3309
3359/* 3310/*
@@ -3442,7 +3393,6 @@ static struct omap_hwmod omap44xx_mcspi1_hwmod = {
3442 .dev_attr = &mcspi1_dev_attr, 3393 .dev_attr = &mcspi1_dev_attr,
3443 .slaves = omap44xx_mcspi1_slaves, 3394 .slaves = omap44xx_mcspi1_slaves,
3444 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi1_slaves), 3395 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi1_slaves),
3445 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3446}; 3396};
3447 3397
3448/* mcspi2 */ 3398/* mcspi2 */
@@ -3505,7 +3455,6 @@ static struct omap_hwmod omap44xx_mcspi2_hwmod = {
3505 .dev_attr = &mcspi2_dev_attr, 3455 .dev_attr = &mcspi2_dev_attr,
3506 .slaves = omap44xx_mcspi2_slaves, 3456 .slaves = omap44xx_mcspi2_slaves,
3507 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi2_slaves), 3457 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi2_slaves),
3508 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3509}; 3458};
3510 3459
3511/* mcspi3 */ 3460/* mcspi3 */
@@ -3568,7 +3517,6 @@ static struct omap_hwmod omap44xx_mcspi3_hwmod = {
3568 .dev_attr = &mcspi3_dev_attr, 3517 .dev_attr = &mcspi3_dev_attr,
3569 .slaves = omap44xx_mcspi3_slaves, 3518 .slaves = omap44xx_mcspi3_slaves,
3570 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi3_slaves), 3519 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi3_slaves),
3571 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3572}; 3520};
3573 3521
3574/* mcspi4 */ 3522/* mcspi4 */
@@ -3629,7 +3577,6 @@ static struct omap_hwmod omap44xx_mcspi4_hwmod = {
3629 .dev_attr = &mcspi4_dev_attr, 3577 .dev_attr = &mcspi4_dev_attr,
3630 .slaves = omap44xx_mcspi4_slaves, 3578 .slaves = omap44xx_mcspi4_slaves,
3631 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi4_slaves), 3579 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi4_slaves),
3632 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3633}; 3580};
3634 3581
3635/* 3582/*
@@ -3718,7 +3665,6 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
3718 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves), 3665 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
3719 .masters = omap44xx_mmc1_masters, 3666 .masters = omap44xx_mmc1_masters,
3720 .masters_cnt = ARRAY_SIZE(omap44xx_mmc1_masters), 3667 .masters_cnt = ARRAY_SIZE(omap44xx_mmc1_masters),
3721 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3722}; 3668};
3723 3669
3724/* mmc2 */ 3670/* mmc2 */
@@ -3779,7 +3725,6 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
3779 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc2_slaves), 3725 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc2_slaves),
3780 .masters = omap44xx_mmc2_masters, 3726 .masters = omap44xx_mmc2_masters,
3781 .masters_cnt = ARRAY_SIZE(omap44xx_mmc2_masters), 3727 .masters_cnt = ARRAY_SIZE(omap44xx_mmc2_masters),
3782 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3783}; 3728};
3784 3729
3785/* mmc3 */ 3730/* mmc3 */
@@ -3834,7 +3779,6 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
3834 }, 3779 },
3835 .slaves = omap44xx_mmc3_slaves, 3780 .slaves = omap44xx_mmc3_slaves,
3836 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc3_slaves), 3781 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc3_slaves),
3837 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3838}; 3782};
3839 3783
3840/* mmc4 */ 3784/* mmc4 */
@@ -3890,7 +3834,6 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
3890 }, 3834 },
3891 .slaves = omap44xx_mmc4_slaves, 3835 .slaves = omap44xx_mmc4_slaves,
3892 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc4_slaves), 3836 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc4_slaves),
3893 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3894}; 3837};
3895 3838
3896/* mmc5 */ 3839/* mmc5 */
@@ -3945,7 +3888,6 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
3945 }, 3888 },
3946 .slaves = omap44xx_mmc5_slaves, 3889 .slaves = omap44xx_mmc5_slaves,
3947 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc5_slaves), 3890 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc5_slaves),
3948 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3949}; 3891};
3950 3892
3951/* 3893/*
@@ -3987,7 +3929,6 @@ static struct omap_hwmod omap44xx_mpu_hwmod = {
3987 }, 3929 },
3988 .masters = omap44xx_mpu_masters, 3930 .masters = omap44xx_mpu_masters,
3989 .masters_cnt = ARRAY_SIZE(omap44xx_mpu_masters), 3931 .masters_cnt = ARRAY_SIZE(omap44xx_mpu_masters),
3990 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
3991}; 3932};
3992 3933
3993/* 3934/*
@@ -4063,7 +4004,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
4063 }, 4004 },
4064 .slaves = omap44xx_smartreflex_core_slaves, 4005 .slaves = omap44xx_smartreflex_core_slaves,
4065 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), 4006 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
4066 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4067}; 4007};
4068 4008
4069/* smartreflex_iva */ 4009/* smartreflex_iva */
@@ -4112,7 +4052,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4112 }, 4052 },
4113 .slaves = omap44xx_smartreflex_iva_slaves, 4053 .slaves = omap44xx_smartreflex_iva_slaves,
4114 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), 4054 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
4115 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4116}; 4055};
4117 4056
4118/* smartreflex_mpu */ 4057/* smartreflex_mpu */
@@ -4161,7 +4100,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4161 }, 4100 },
4162 .slaves = omap44xx_smartreflex_mpu_slaves, 4101 .slaves = omap44xx_smartreflex_mpu_slaves,
4163 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), 4102 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves),
4164 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4165}; 4103};
4166 4104
4167/* 4105/*
@@ -4224,7 +4162,6 @@ static struct omap_hwmod omap44xx_spinlock_hwmod = {
4224 }, 4162 },
4225 .slaves = omap44xx_spinlock_slaves, 4163 .slaves = omap44xx_spinlock_slaves,
4226 .slaves_cnt = ARRAY_SIZE(omap44xx_spinlock_slaves), 4164 .slaves_cnt = ARRAY_SIZE(omap44xx_spinlock_slaves),
4227 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4228}; 4165};
4229 4166
4230/* 4167/*
@@ -4265,6 +4202,16 @@ static struct omap_hwmod_class omap44xx_timer_hwmod_class = {
4265 .sysc = &omap44xx_timer_sysc, 4202 .sysc = &omap44xx_timer_sysc,
4266}; 4203};
4267 4204
4205/* always-on timers dev attribute */
4206static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
4207 .timer_capability = OMAP_TIMER_ALWON,
4208};
4209
4210/* pwm timers dev attribute */
4211static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
4212 .timer_capability = OMAP_TIMER_HAS_PWM,
4213};
4214
4268/* timer1 */ 4215/* timer1 */
4269static struct omap_hwmod omap44xx_timer1_hwmod; 4216static struct omap_hwmod omap44xx_timer1_hwmod;
4270static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = { 4217static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
@@ -4308,9 +4255,9 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
4308 .modulemode = MODULEMODE_SWCTRL, 4255 .modulemode = MODULEMODE_SWCTRL,
4309 }, 4256 },
4310 }, 4257 },
4258 .dev_attr = &capability_alwon_dev_attr,
4311 .slaves = omap44xx_timer1_slaves, 4259 .slaves = omap44xx_timer1_slaves,
4312 .slaves_cnt = ARRAY_SIZE(omap44xx_timer1_slaves), 4260 .slaves_cnt = ARRAY_SIZE(omap44xx_timer1_slaves),
4313 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4314}; 4261};
4315 4262
4316/* timer2 */ 4263/* timer2 */
@@ -4356,9 +4303,9 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
4356 .modulemode = MODULEMODE_SWCTRL, 4303 .modulemode = MODULEMODE_SWCTRL,
4357 }, 4304 },
4358 }, 4305 },
4306 .dev_attr = &capability_alwon_dev_attr,
4359 .slaves = omap44xx_timer2_slaves, 4307 .slaves = omap44xx_timer2_slaves,
4360 .slaves_cnt = ARRAY_SIZE(omap44xx_timer2_slaves), 4308 .slaves_cnt = ARRAY_SIZE(omap44xx_timer2_slaves),
4361 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4362}; 4309};
4363 4310
4364/* timer3 */ 4311/* timer3 */
@@ -4404,9 +4351,9 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
4404 .modulemode = MODULEMODE_SWCTRL, 4351 .modulemode = MODULEMODE_SWCTRL,
4405 }, 4352 },
4406 }, 4353 },
4354 .dev_attr = &capability_alwon_dev_attr,
4407 .slaves = omap44xx_timer3_slaves, 4355 .slaves = omap44xx_timer3_slaves,
4408 .slaves_cnt = ARRAY_SIZE(omap44xx_timer3_slaves), 4356 .slaves_cnt = ARRAY_SIZE(omap44xx_timer3_slaves),
4409 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4410}; 4357};
4411 4358
4412/* timer4 */ 4359/* timer4 */
@@ -4452,9 +4399,9 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
4452 .modulemode = MODULEMODE_SWCTRL, 4399 .modulemode = MODULEMODE_SWCTRL,
4453 }, 4400 },
4454 }, 4401 },
4402 .dev_attr = &capability_alwon_dev_attr,
4455 .slaves = omap44xx_timer4_slaves, 4403 .slaves = omap44xx_timer4_slaves,
4456 .slaves_cnt = ARRAY_SIZE(omap44xx_timer4_slaves), 4404 .slaves_cnt = ARRAY_SIZE(omap44xx_timer4_slaves),
4457 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4458}; 4405};
4459 4406
4460/* timer5 */ 4407/* timer5 */
@@ -4519,9 +4466,9 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
4519 .modulemode = MODULEMODE_SWCTRL, 4466 .modulemode = MODULEMODE_SWCTRL,
4520 }, 4467 },
4521 }, 4468 },
4469 .dev_attr = &capability_alwon_dev_attr,
4522 .slaves = omap44xx_timer5_slaves, 4470 .slaves = omap44xx_timer5_slaves,
4523 .slaves_cnt = ARRAY_SIZE(omap44xx_timer5_slaves), 4471 .slaves_cnt = ARRAY_SIZE(omap44xx_timer5_slaves),
4524 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4525}; 4472};
4526 4473
4527/* timer6 */ 4474/* timer6 */
@@ -4587,9 +4534,9 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
4587 .modulemode = MODULEMODE_SWCTRL, 4534 .modulemode = MODULEMODE_SWCTRL,
4588 }, 4535 },
4589 }, 4536 },
4537 .dev_attr = &capability_alwon_dev_attr,
4590 .slaves = omap44xx_timer6_slaves, 4538 .slaves = omap44xx_timer6_slaves,
4591 .slaves_cnt = ARRAY_SIZE(omap44xx_timer6_slaves), 4539 .slaves_cnt = ARRAY_SIZE(omap44xx_timer6_slaves),
4592 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4593}; 4540};
4594 4541
4595/* timer7 */ 4542/* timer7 */
@@ -4654,9 +4601,9 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
4654 .modulemode = MODULEMODE_SWCTRL, 4601 .modulemode = MODULEMODE_SWCTRL,
4655 }, 4602 },
4656 }, 4603 },
4604 .dev_attr = &capability_alwon_dev_attr,
4657 .slaves = omap44xx_timer7_slaves, 4605 .slaves = omap44xx_timer7_slaves,
4658 .slaves_cnt = ARRAY_SIZE(omap44xx_timer7_slaves), 4606 .slaves_cnt = ARRAY_SIZE(omap44xx_timer7_slaves),
4659 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4660}; 4607};
4661 4608
4662/* timer8 */ 4609/* timer8 */
@@ -4721,9 +4668,9 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
4721 .modulemode = MODULEMODE_SWCTRL, 4668 .modulemode = MODULEMODE_SWCTRL,
4722 }, 4669 },
4723 }, 4670 },
4671 .dev_attr = &capability_pwm_dev_attr,
4724 .slaves = omap44xx_timer8_slaves, 4672 .slaves = omap44xx_timer8_slaves,
4725 .slaves_cnt = ARRAY_SIZE(omap44xx_timer8_slaves), 4673 .slaves_cnt = ARRAY_SIZE(omap44xx_timer8_slaves),
4726 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4727}; 4674};
4728 4675
4729/* timer9 */ 4676/* timer9 */
@@ -4769,9 +4716,9 @@ static struct omap_hwmod omap44xx_timer9_hwmod = {
4769 .modulemode = MODULEMODE_SWCTRL, 4716 .modulemode = MODULEMODE_SWCTRL,
4770 }, 4717 },
4771 }, 4718 },
4719 .dev_attr = &capability_pwm_dev_attr,
4772 .slaves = omap44xx_timer9_slaves, 4720 .slaves = omap44xx_timer9_slaves,
4773 .slaves_cnt = ARRAY_SIZE(omap44xx_timer9_slaves), 4721 .slaves_cnt = ARRAY_SIZE(omap44xx_timer9_slaves),
4774 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4775}; 4722};
4776 4723
4777/* timer10 */ 4724/* timer10 */
@@ -4817,9 +4764,9 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
4817 .modulemode = MODULEMODE_SWCTRL, 4764 .modulemode = MODULEMODE_SWCTRL,
4818 }, 4765 },
4819 }, 4766 },
4767 .dev_attr = &capability_pwm_dev_attr,
4820 .slaves = omap44xx_timer10_slaves, 4768 .slaves = omap44xx_timer10_slaves,
4821 .slaves_cnt = ARRAY_SIZE(omap44xx_timer10_slaves), 4769 .slaves_cnt = ARRAY_SIZE(omap44xx_timer10_slaves),
4822 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4823}; 4770};
4824 4771
4825/* timer11 */ 4772/* timer11 */
@@ -4865,9 +4812,9 @@ static struct omap_hwmod omap44xx_timer11_hwmod = {
4865 .modulemode = MODULEMODE_SWCTRL, 4812 .modulemode = MODULEMODE_SWCTRL,
4866 }, 4813 },
4867 }, 4814 },
4815 .dev_attr = &capability_pwm_dev_attr,
4868 .slaves = omap44xx_timer11_slaves, 4816 .slaves = omap44xx_timer11_slaves,
4869 .slaves_cnt = ARRAY_SIZE(omap44xx_timer11_slaves), 4817 .slaves_cnt = ARRAY_SIZE(omap44xx_timer11_slaves),
4870 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4871}; 4818};
4872 4819
4873/* 4820/*
@@ -4944,7 +4891,6 @@ static struct omap_hwmod omap44xx_uart1_hwmod = {
4944 }, 4891 },
4945 .slaves = omap44xx_uart1_slaves, 4892 .slaves = omap44xx_uart1_slaves,
4946 .slaves_cnt = ARRAY_SIZE(omap44xx_uart1_slaves), 4893 .slaves_cnt = ARRAY_SIZE(omap44xx_uart1_slaves),
4947 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
4948}; 4894};
4949 4895
4950/* uart2 */ 4896/* uart2 */
@@ -4999,7 +4945,6 @@ static struct omap_hwmod omap44xx_uart2_hwmod = {
4999 }, 4945 },
5000 .slaves = omap44xx_uart2_slaves, 4946 .slaves = omap44xx_uart2_slaves,
5001 .slaves_cnt = ARRAY_SIZE(omap44xx_uart2_slaves), 4947 .slaves_cnt = ARRAY_SIZE(omap44xx_uart2_slaves),
5002 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5003}; 4948};
5004 4949
5005/* uart3 */ 4950/* uart3 */
@@ -5055,7 +5000,6 @@ static struct omap_hwmod omap44xx_uart3_hwmod = {
5055 }, 5000 },
5056 .slaves = omap44xx_uart3_slaves, 5001 .slaves = omap44xx_uart3_slaves,
5057 .slaves_cnt = ARRAY_SIZE(omap44xx_uart3_slaves), 5002 .slaves_cnt = ARRAY_SIZE(omap44xx_uart3_slaves),
5058 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5059}; 5003};
5060 5004
5061/* uart4 */ 5005/* uart4 */
@@ -5110,7 +5054,6 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
5110 }, 5054 },
5111 .slaves = omap44xx_uart4_slaves, 5055 .slaves = omap44xx_uart4_slaves,
5112 .slaves_cnt = ARRAY_SIZE(omap44xx_uart4_slaves), 5056 .slaves_cnt = ARRAY_SIZE(omap44xx_uart4_slaves),
5113 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5114}; 5057};
5115 5058
5116/* 5059/*
@@ -5195,7 +5138,6 @@ static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
5195 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves), 5138 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves),
5196 .masters = omap44xx_usb_otg_hs_masters, 5139 .masters = omap44xx_usb_otg_hs_masters,
5197 .masters_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_masters), 5140 .masters_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_masters),
5198 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5199}; 5141};
5200 5142
5201/* 5143/*
@@ -5266,7 +5208,6 @@ static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
5266 }, 5208 },
5267 .slaves = omap44xx_wd_timer2_slaves, 5209 .slaves = omap44xx_wd_timer2_slaves,
5268 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves), 5210 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves),
5269 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5270}; 5211};
5271 5212
5272/* wd_timer3 */ 5213/* wd_timer3 */
@@ -5333,7 +5274,6 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
5333 }, 5274 },
5334 .slaves = omap44xx_wd_timer3_slaves, 5275 .slaves = omap44xx_wd_timer3_slaves,
5335 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves), 5276 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
5336 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
5337}; 5277};
5338 5278
5339static __initdata struct omap_hwmod *omap44xx_hwmods[] = { 5279static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c
index 7b9f1909ddb2..c8b1bef92e5a 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.c
+++ b/arch/arm/mach-omap2/omap_l3_noc.c
@@ -1,25 +1,25 @@
1/* 1/*
2 * OMAP4XXX L3 Interconnect error handling driver 2 * OMAP4XXX L3 Interconnect error handling driver
3 * 3 *
4 * Copyright (C) 2011 Texas Corporation 4 * Copyright (C) 2011 Texas Corporation
5 * Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Sricharan <r.sricharan@ti.com> 6 * Sricharan <r.sricharan@ti.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA 21 * USA
22 */ 22 */
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
@@ -55,12 +55,12 @@
55static irqreturn_t l3_interrupt_handler(int irq, void *_l3) 55static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
56{ 56{
57 57
58 struct omap4_l3 *l3 = _l3; 58 struct omap4_l3 *l3 = _l3;
59 int inttype, i, j; 59 int inttype, i, k;
60 int err_src = 0; 60 int err_src = 0;
61 u32 std_err_main_addr, std_err_main, err_reg; 61 u32 std_err_main, err_reg, clear, masterid;
62 u32 base, slave_addr, clear; 62 void __iomem *base, *l3_targ_base;
63 char *source_name; 63 char *target_name, *master_name = "UN IDENTIFIED";
64 64
65 /* Get the Type of interrupt */ 65 /* Get the Type of interrupt */
66 inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; 66 inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
@@ -70,43 +70,50 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
70 * Read the regerr register of the clock domain 70 * Read the regerr register of the clock domain
71 * to determine the source 71 * to determine the source
72 */ 72 */
73 base = (u32)l3->l3_base[i]; 73 base = l3->l3_base[i];
74 err_reg = readl(base + l3_flagmux[i] + (inttype << 3)); 74 err_reg = __raw_readl(base + l3_flagmux[i] +
75 + L3_FLAGMUX_REGERR0 + (inttype << 3));
75 76
76 /* Get the corresponding error and analyse */ 77 /* Get the corresponding error and analyse */
77 if (err_reg) { 78 if (err_reg) {
78 /* Identify the source from control status register */ 79 /* Identify the source from control status register */
79 for (j = 0; !(err_reg & (1 << j)); j++) 80 err_src = __ffs(err_reg);
80 ;
81 81
82 err_src = j;
83 /* Read the stderrlog_main_source from clk domain */ 82 /* Read the stderrlog_main_source from clk domain */
84 std_err_main_addr = base + *(l3_targ[i] + err_src); 83 l3_targ_base = base + *(l3_targ[i] + err_src);
85 std_err_main = readl(std_err_main_addr); 84 std_err_main = __raw_readl(l3_targ_base +
85 L3_TARG_STDERRLOG_MAIN);
86 masterid = __raw_readl(l3_targ_base +
87 L3_TARG_STDERRLOG_MSTADDR);
86 88
87 switch (std_err_main & CUSTOM_ERROR) { 89 switch (std_err_main & CUSTOM_ERROR) {
88 case STANDARD_ERROR: 90 case STANDARD_ERROR:
89 source_name = 91 target_name =
90 l3_targ_stderrlog_main_name[i][err_src]; 92 l3_targ_inst_name[i][err_src];
91 93 WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n",
92 slave_addr = std_err_main_addr + 94 target_name,
93 L3_SLAVE_ADDRESS_OFFSET; 95 __raw_readl(l3_targ_base +
94 WARN(true, "L3 standard error: SOURCE:%s at address 0x%x\n", 96 L3_TARG_STDERRLOG_SLVOFSLSB));
95 source_name, readl(slave_addr));
96 /* clear the std error log*/ 97 /* clear the std error log*/
97 clear = std_err_main | CLEAR_STDERR_LOG; 98 clear = std_err_main | CLEAR_STDERR_LOG;
98 writel(clear, std_err_main_addr); 99 writel(clear, l3_targ_base +
100 L3_TARG_STDERRLOG_MAIN);
99 break; 101 break;
100 102
101 case CUSTOM_ERROR: 103 case CUSTOM_ERROR:
102 source_name = 104 target_name =
103 l3_targ_stderrlog_main_name[i][err_src]; 105 l3_targ_inst_name[i][err_src];
104 106 for (k = 0; k < NUM_OF_L3_MASTERS; k++) {
105 WARN(true, "CUSTOM SRESP error with SOURCE:%s\n", 107 if (masterid == l3_masters[k].id)
106 source_name); 108 master_name =
109 l3_masters[k].name;
110 }
111 WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n",
112 master_name, target_name);
107 /* clear the std error log*/ 113 /* clear the std error log*/
108 clear = std_err_main | CLEAR_STDERR_LOG; 114 clear = std_err_main | CLEAR_STDERR_LOG;
109 writel(clear, std_err_main_addr); 115 writel(clear, l3_targ_base +
116 L3_TARG_STDERRLOG_MAIN);
110 break; 117 break;
111 118
112 default: 119 default:
@@ -120,12 +127,11 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
120 return IRQ_HANDLED; 127 return IRQ_HANDLED;
121} 128}
122 129
123static int __init omap4_l3_probe(struct platform_device *pdev) 130static int __devinit omap4_l3_probe(struct platform_device *pdev)
124{ 131{
125 static struct omap4_l3 *l3; 132 static struct omap4_l3 *l3;
126 struct resource *res; 133 struct resource *res;
127 int ret; 134 int ret;
128 int irq;
129 135
130 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 136 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
131 if (!l3) 137 if (!l3)
@@ -177,27 +183,25 @@ static int __init omap4_l3_probe(struct platform_device *pdev)
177 /* 183 /*
178 * Setup interrupt Handlers 184 * Setup interrupt Handlers
179 */ 185 */
180 irq = platform_get_irq(pdev, 0); 186 l3->debug_irq = platform_get_irq(pdev, 0);
181 ret = request_irq(irq, 187 ret = request_irq(l3->debug_irq,
182 l3_interrupt_handler, 188 l3_interrupt_handler,
183 IRQF_DISABLED, "l3-dbg-irq", l3); 189 IRQF_DISABLED, "l3-dbg-irq", l3);
184 if (ret) { 190 if (ret) {
185 pr_crit("L3: request_irq failed to register for 0x%x\n", 191 pr_crit("L3: request_irq failed to register for 0x%x\n",
186 OMAP44XX_IRQ_L3_DBG); 192 OMAP44XX_IRQ_L3_DBG);
187 goto err3; 193 goto err3;
188 } 194 }
189 l3->debug_irq = irq;
190 195
191 irq = platform_get_irq(pdev, 1); 196 l3->app_irq = platform_get_irq(pdev, 1);
192 ret = request_irq(irq, 197 ret = request_irq(l3->app_irq,
193 l3_interrupt_handler, 198 l3_interrupt_handler,
194 IRQF_DISABLED, "l3-app-irq", l3); 199 IRQF_DISABLED, "l3-app-irq", l3);
195 if (ret) { 200 if (ret) {
196 pr_crit("L3: request_irq failed to register for 0x%x\n", 201 pr_crit("L3: request_irq failed to register for 0x%x\n",
197 OMAP44XX_IRQ_L3_APP); 202 OMAP44XX_IRQ_L3_APP);
198 goto err4; 203 goto err4;
199 } 204 }
200 l3->app_irq = irq;
201 205
202 return 0; 206 return 0;
203 207
@@ -214,9 +218,9 @@ err0:
214 return ret; 218 return ret;
215} 219}
216 220
217static int __exit omap4_l3_remove(struct platform_device *pdev) 221static int __devexit omap4_l3_remove(struct platform_device *pdev)
218{ 222{
219 struct omap4_l3 *l3 = platform_get_drvdata(pdev); 223 struct omap4_l3 *l3 = platform_get_drvdata(pdev);
220 224
221 free_irq(l3->app_irq, l3); 225 free_irq(l3->app_irq, l3);
222 free_irq(l3->debug_irq, l3); 226 free_irq(l3->debug_irq, l3);
@@ -228,16 +232,29 @@ static int __exit omap4_l3_remove(struct platform_device *pdev)
228 return 0; 232 return 0;
229} 233}
230 234
235#if defined(CONFIG_OF)
236static const struct of_device_id l3_noc_match[] = {
237 {.compatible = "ti,omap4-l3-noc", },
238 {},
239}
240MODULE_DEVICE_TABLE(of, l3_noc_match);
241#else
242#define l3_noc_match NULL
243#endif
244
231static struct platform_driver omap4_l3_driver = { 245static struct platform_driver omap4_l3_driver = {
232 .remove = __exit_p(omap4_l3_remove), 246 .probe = omap4_l3_probe,
247 .remove = __devexit_p(omap4_l3_remove),
233 .driver = { 248 .driver = {
234 .name = "omap_l3_noc", 249 .name = "omap_l3_noc",
250 .owner = THIS_MODULE,
251 .of_match_table = l3_noc_match,
235 }, 252 },
236}; 253};
237 254
238static int __init omap4_l3_init(void) 255static int __init omap4_l3_init(void)
239{ 256{
240 return platform_driver_probe(&omap4_l3_driver, omap4_l3_probe); 257 return platform_driver_register(&omap4_l3_driver);
241} 258}
242postcore_initcall_sync(omap4_l3_init); 259postcore_initcall_sync(omap4_l3_init);
243 260
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h b/arch/arm/mach-omap2/omap_l3_noc.h
index 359b83348aed..90b50984cd2e 100644
--- a/arch/arm/mach-omap2/omap_l3_noc.h
+++ b/arch/arm/mach-omap2/omap_l3_noc.h
@@ -1,132 +1,162 @@
1 /* 1/*
2 * OMAP4XXX L3 Interconnect error handling driver header 2 * OMAP4XXX L3 Interconnect error handling driver header
3 * 3 *
4 * Copyright (C) 2011 Texas Corporation 4 * Copyright (C) 2011 Texas Corporation
5 * Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * sricharan <r.sricharan@ti.com> 6 * sricharan <r.sricharan@ti.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA 21 * USA
22 */ 22 */
23#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H 23#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
24#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H 24#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
25 25
26/*
27 * L3 register offsets
28 */
29#define L3_MODULES 3 26#define L3_MODULES 3
30#define CLEAR_STDERR_LOG (1 << 31) 27#define CLEAR_STDERR_LOG (1 << 31)
31#define CUSTOM_ERROR 0x2 28#define CUSTOM_ERROR 0x2
32#define STANDARD_ERROR 0x0 29#define STANDARD_ERROR 0x0
33#define INBAND_ERROR 0x0 30#define INBAND_ERROR 0x0
34#define EMIF_KERRLOG_OFFSET 0x10
35#define L3_SLAVE_ADDRESS_OFFSET 0x14
36#define LOGICAL_ADDR_ERRORLOG 0x4
37#define L3_APPLICATION_ERROR 0x0 31#define L3_APPLICATION_ERROR 0x0
38#define L3_DEBUG_ERROR 0x1 32#define L3_DEBUG_ERROR 0x1
39 33
40u32 l3_flagmux[L3_MODULES] = { 34/* L3 TARG register offsets */
41 0x50C, 35#define L3_TARG_STDERRLOG_MAIN 0x48
42 0x100C, 36#define L3_TARG_STDERRLOG_SLVOFSLSB 0x5c
43 0X020C 37#define L3_TARG_STDERRLOG_MSTADDR 0x68
38#define L3_FLAGMUX_REGERR0 0xc
39
40#define NUM_OF_L3_MASTERS (sizeof(l3_masters)/sizeof(l3_masters[0]))
41
42static u32 l3_flagmux[L3_MODULES] = {
43 0x500,
44 0x1000,
45 0X0200
44}; 46};
45 47
46/* 48/* L3 Target standard Error register offsets */
47 * L3 Target standard Error register offsets 49static u32 l3_targ_inst_clk1[] = {
48 */ 50 0x100, /* DMM1 */
49u32 l3_targ_stderrlog_main_clk1[] = { 51 0x200, /* DMM2 */
50 0x148, /* DMM1 */ 52 0x300, /* ABE */
51 0x248, /* DMM2 */ 53 0x400, /* L4CFG */
52 0x348, /* ABE */ 54 0x600 /* CLK2 PWR DISC */
53 0x448, /* L4CFG */
54 0x648 /* CLK2 PWR DISC */
55}; 55};
56 56
57u32 l3_targ_stderrlog_main_clk2[] = { 57static u32 l3_targ_inst_clk2[] = {
58 0x548, /* CORTEX M3 */ 58 0x500, /* CORTEX M3 */
59 0x348, /* DSS */ 59 0x300, /* DSS */
60 0x148, /* GPMC */ 60 0x100, /* GPMC */
61 0x448, /* ISS */ 61 0x400, /* ISS */
62 0x748, /* IVAHD */ 62 0x700, /* IVAHD */
63 0xD48, /* missing in TRM corresponds to AES1*/ 63 0xD00, /* missing in TRM corresponds to AES1*/
64 0x948, /* L4 PER0*/ 64 0x900, /* L4 PER0*/
65 0x248, /* OCMRAM */ 65 0x200, /* OCMRAM */
66 0x148, /* missing in TRM corresponds to GPMC sERROR*/ 66 0x100, /* missing in TRM corresponds to GPMC sERROR*/
67 0x648, /* SGX */ 67 0x600, /* SGX */
68 0x848, /* SL2 */ 68 0x800, /* SL2 */
69 0x1648, /* C2C */ 69 0x1600, /* C2C */
70 0x1148, /* missing in TRM corresponds PWR DISC CLK1*/ 70 0x1100, /* missing in TRM corresponds PWR DISC CLK1*/
71 0xF48, /* missing in TRM corrsponds to SHA1*/ 71 0xF00, /* missing in TRM corrsponds to SHA1*/
72 0xE48, /* missing in TRM corresponds to AES2*/ 72 0xE00, /* missing in TRM corresponds to AES2*/
73 0xC48, /* L4 PER3 */ 73 0xC00, /* L4 PER3 */
74 0xA48, /* L4 PER1*/ 74 0xA00, /* L4 PER1*/
75 0xB48 /* L4 PER2*/ 75 0xB00 /* L4 PER2*/
76}; 76};
77 77
78u32 l3_targ_stderrlog_main_clk3[] = { 78static u32 l3_targ_inst_clk3[] = {
79 0x0148 /* EMUSS */ 79 0x0100 /* EMUSS */
80}; 80};
81 81
82char *l3_targ_stderrlog_main_name[L3_MODULES][18] = { 82static struct l3_masters_data {
83 u32 id;
84 char name[10];
85} l3_masters[] = {
86 { 0x0 , "MPU"},
87 { 0x10, "CS_ADP"},
88 { 0x14, "xxx"},
89 { 0x20, "DSP"},
90 { 0x30, "IVAHD"},
91 { 0x40, "ISS"},
92 { 0x44, "DucatiM3"},
93 { 0x48, "FaceDetect"},
94 { 0x50, "SDMA_Rd"},
95 { 0x54, "SDMA_Wr"},
96 { 0x58, "xxx"},
97 { 0x5C, "xxx"},
98 { 0x60, "SGX"},
99 { 0x70, "DSS"},
100 { 0x80, "C2C"},
101 { 0x88, "xxx"},
102 { 0x8C, "xxx"},
103 { 0x90, "HSI"},
104 { 0xA0, "MMC1"},
105 { 0xA4, "MMC2"},
106 { 0xA8, "MMC6"},
107 { 0xB0, "UNIPRO1"},
108 { 0xC0, "USBHOSTHS"},
109 { 0xC4, "USBOTGHS"},
110 { 0xC8, "USBHOSTFS"}
111};
112
113static char *l3_targ_inst_name[L3_MODULES][18] = {
83 { 114 {
84 "DMM1", 115 "DMM1",
85 "DMM2", 116 "DMM2",
86 "ABE", 117 "ABE",
87 "L4CFG", 118 "L4CFG",
88 "CLK2 PWR DISC", 119 "CLK2 PWR DISC",
89 }, 120 },
90 { 121 {
91 "CORTEX M3" , 122 "CORTEX M3" ,
92 "DSS ", 123 "DSS ",
93 "GPMC ", 124 "GPMC ",
94 "ISS ", 125 "ISS ",
95 "IVAHD ", 126 "IVAHD ",
96 "AES1", 127 "AES1",
97 "L4 PER0", 128 "L4 PER0",
98 "OCMRAM ", 129 "OCMRAM ",
99 "GPMC sERROR", 130 "GPMC sERROR",
100 "SGX ", 131 "SGX ",
101 "SL2 ", 132 "SL2 ",
102 "C2C ", 133 "C2C ",
103 "PWR DISC CLK1", 134 "PWR DISC CLK1",
104 "SHA1", 135 "SHA1",
105 "AES2", 136 "AES2",
106 "L4 PER3", 137 "L4 PER3",
107 "L4 PER1", 138 "L4 PER1",
108 "L4 PER2", 139 "L4 PER2",
109 }, 140 },
110 { 141 {
111 "EMUSS", 142 "EMUSS",
112 }, 143 },
113}; 144};
114 145
115u32 *l3_targ[L3_MODULES] = { 146static u32 *l3_targ[L3_MODULES] = {
116 l3_targ_stderrlog_main_clk1, 147 l3_targ_inst_clk1,
117 l3_targ_stderrlog_main_clk2, 148 l3_targ_inst_clk2,
118 l3_targ_stderrlog_main_clk3, 149 l3_targ_inst_clk3,
119}; 150};
120 151
121struct omap4_l3 { 152struct omap4_l3 {
122 struct device *dev; 153 struct device *dev;
123 struct clk *ick; 154 struct clk *ick;
124 155
125 /* memory base */ 156 /* memory base */
126 void __iomem *l3_base[4]; 157 void __iomem *l3_base[L3_MODULES];
127 158
128 int debug_irq; 159 int debug_irq;
129 int app_irq; 160 int app_irq;
130}; 161};
131
132#endif 162#endif
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
index 873c0e33b512..a05a62f9ee5b 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ b/arch/arm/mach-omap2/omap_l3_smx.c
@@ -1,26 +1,26 @@
1 /* 1/*
2 * OMAP3XXX L3 Interconnect Driver 2 * OMAP3XXX L3 Interconnect Driver
3 * 3 *
4 * Copyright (C) 2011 Texas Corporation 4 * Copyright (C) 2011 Texas Corporation
5 * Felipe Balbi <balbi@ti.com> 5 * Felipe Balbi <balbi@ti.com>
6 * Santosh Shilimkar <santosh.shilimkar@ti.com> 6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 * Sricharan <r.sricharan@ti.com> 7 * Sricharan <r.sricharan@ti.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA 22 * USA
23 */ 23 */
24 24
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
@@ -135,7 +135,7 @@ static char *omap3_l3_initiator_string(u8 initid)
135 } 135 }
136} 136}
137 137
138/** 138/*
139 * omap3_l3_block_irq - handles a register block's irq 139 * omap3_l3_block_irq - handles a register block's irq
140 * @l3: struct omap3_l3 * 140 * @l3: struct omap3_l3 *
141 * @base: register block base address 141 * @base: register block base address
@@ -150,30 +150,29 @@ static char *omap3_l3_initiator_string(u8 initid)
150static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3, 150static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3,
151 u64 error, int error_addr) 151 u64 error, int error_addr)
152{ 152{
153 u8 code = omap3_l3_decode_error_code(error); 153 u8 code = omap3_l3_decode_error_code(error);
154 u8 initid = omap3_l3_decode_initid(error); 154 u8 initid = omap3_l3_decode_initid(error);
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 WARN(true, "%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" : "", 161 multi ? "Multiple Errors" : "", address);
162 address);
163 162
164 return IRQ_HANDLED; 163 return IRQ_HANDLED;
165} 164}
166 165
167static irqreturn_t omap3_l3_app_irq(int irq, void *_l3) 166static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
168{ 167{
169 struct omap3_l3 *l3 = _l3; 168 struct omap3_l3 *l3 = _l3;
170 u64 status, clear; 169 u64 status, clear;
171 u64 error; 170 u64 error;
172 u64 error_addr; 171 u64 error_addr;
173 u64 err_source = 0; 172 u64 err_source = 0;
174 void __iomem *base; 173 void __iomem *base;
175 int int_type; 174 int int_type;
176 irqreturn_t ret = IRQ_NONE; 175 irqreturn_t ret = IRQ_NONE;
177 176
178 int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; 177 int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR;
179 if (!int_type) { 178 if (!int_type) {
@@ -191,14 +190,12 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
191 } 190 }
192 191
193 /* identify the error source */ 192 /* identify the error source */
194 for (err_source = 0; !(status & (1 << err_source)); err_source++) 193 err_source = __ffs(status);
195 ;
196 194
197 base = l3->rt + *(omap3_l3_bases[int_type] + err_source); 195 base = l3->rt + omap3_l3_bases[int_type][err_source];
198 error = omap3_l3_readll(base, L3_ERROR_LOG); 196 error = omap3_l3_readll(base, L3_ERROR_LOG);
199 if (error) { 197 if (error) {
200 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR); 198 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR);
201
202 ret |= omap3_l3_block_irq(l3, error, error_addr); 199 ret |= omap3_l3_block_irq(l3, error, error_addr);
203 } 200 }
204 201
@@ -215,9 +212,9 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
215 212
216static int __init omap3_l3_probe(struct platform_device *pdev) 213static int __init omap3_l3_probe(struct platform_device *pdev)
217{ 214{
218 struct omap3_l3 *l3; 215 struct omap3_l3 *l3;
219 struct resource *res; 216 struct resource *res;
220 int ret; 217 int ret;
221 218
222 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 219 l3 = kzalloc(sizeof(*l3), GFP_KERNEL);
223 if (!l3) 220 if (!l3)
diff --git a/arch/arm/mach-omap2/omap_l3_smx.h b/arch/arm/mach-omap2/omap_l3_smx.h
index ba2ed9a850cc..4f3cebca4179 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.h
+++ b/arch/arm/mach-omap2/omap_l3_smx.h
@@ -1,26 +1,26 @@
1 /* 1/*
2 * OMAP3XXX L3 Interconnect Driver header 2 * OMAP3XXX L3 Interconnect Driver header
3 * 3 *
4 * Copyright (C) 2011 Texas Corporation 4 * Copyright (C) 2011 Texas Corporation
5 * Felipe Balbi <balbi@ti.com> 5 * Felipe Balbi <balbi@ti.com>
6 * Santosh Shilimkar <santosh.shilimkar@ti.com> 6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 * sricharan <r.sricharan@ti.com> 7 * sricharan <r.sricharan@ti.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA 22 * USA
23 */ 23 */
24#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H 24#ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
25#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H 25#define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
26 26
@@ -40,7 +40,7 @@
40#define L3_SI_CONTROL 0x020 40#define L3_SI_CONTROL 0x020
41#define L3_SI_FLAG_STATUS_0 0x510 41#define L3_SI_FLAG_STATUS_0 0x510
42 42
43const u64 shift = 1; 43static const u64 shift = 1;
44 44
45#define L3_STATUS_0_MPUIA_BRST (shift << 0) 45#define L3_STATUS_0_MPUIA_BRST (shift << 0)
46#define L3_STATUS_0_MPUIA_RSP (shift << 1) 46#define L3_STATUS_0_MPUIA_RSP (shift << 1)
@@ -78,32 +78,32 @@ const u64 shift = 1;
78#define L3_STATUS_0_L4EMUTA_REQ (shift << 60) 78#define L3_STATUS_0_L4EMUTA_REQ (shift << 60)
79#define L3_STATUS_0_MAD2DTA_REQ (shift << 61) 79#define L3_STATUS_0_MAD2DTA_REQ (shift << 61)
80 80
81#define L3_STATUS_0_TIMEOUT_MASK (L3_STATUS_0_MPUIA_BRST \ 81#define L3_STATUS_0_TIMEOUT_MASK (L3_STATUS_0_MPUIA_BRST \
82 | L3_STATUS_0_MPUIA_RSP \ 82 | L3_STATUS_0_MPUIA_RSP \
83 | L3_STATUS_0_IVAIA_BRST \ 83 | L3_STATUS_0_IVAIA_BRST \
84 | L3_STATUS_0_IVAIA_RSP \ 84 | L3_STATUS_0_IVAIA_RSP \
85 | L3_STATUS_0_SGXIA_BRST \ 85 | L3_STATUS_0_SGXIA_BRST \
86 | L3_STATUS_0_SGXIA_RSP \ 86 | L3_STATUS_0_SGXIA_RSP \
87 | L3_STATUS_0_CAMIA_BRST \ 87 | L3_STATUS_0_CAMIA_BRST \
88 | L3_STATUS_0_CAMIA_RSP \ 88 | L3_STATUS_0_CAMIA_RSP \
89 | L3_STATUS_0_DISPIA_BRST \ 89 | L3_STATUS_0_DISPIA_BRST \
90 | L3_STATUS_0_DISPIA_RSP \ 90 | L3_STATUS_0_DISPIA_RSP \
91 | L3_STATUS_0_DMARDIA_BRST \ 91 | L3_STATUS_0_DMARDIA_BRST \
92 | L3_STATUS_0_DMARDIA_RSP \ 92 | L3_STATUS_0_DMARDIA_RSP \
93 | L3_STATUS_0_DMAWRIA_BRST \ 93 | L3_STATUS_0_DMAWRIA_BRST \
94 | L3_STATUS_0_DMAWRIA_RSP \ 94 | L3_STATUS_0_DMAWRIA_RSP \
95 | L3_STATUS_0_USBOTGIA_BRST \ 95 | L3_STATUS_0_USBOTGIA_BRST \
96 | L3_STATUS_0_USBOTGIA_RSP \ 96 | L3_STATUS_0_USBOTGIA_RSP \
97 | L3_STATUS_0_USBHOSTIA_BRST \ 97 | L3_STATUS_0_USBHOSTIA_BRST \
98 | L3_STATUS_0_SMSTA_REQ \ 98 | L3_STATUS_0_SMSTA_REQ \
99 | L3_STATUS_0_GPMCTA_REQ \ 99 | L3_STATUS_0_GPMCTA_REQ \
100 | L3_STATUS_0_OCMRAMTA_REQ \ 100 | L3_STATUS_0_OCMRAMTA_REQ \
101 | L3_STATUS_0_OCMROMTA_REQ \ 101 | L3_STATUS_0_OCMROMTA_REQ \
102 | L3_STATUS_0_IVATA_REQ \ 102 | L3_STATUS_0_IVATA_REQ \
103 | L3_STATUS_0_SGXTA_REQ \ 103 | L3_STATUS_0_SGXTA_REQ \
104 | L3_STATUS_0_L4CORETA_REQ \ 104 | L3_STATUS_0_L4CORETA_REQ \
105 | L3_STATUS_0_L4PERTA_REQ \ 105 | L3_STATUS_0_L4PERTA_REQ \
106 | L3_STATUS_0_L4EMUTA_REQ \ 106 | L3_STATUS_0_L4EMUTA_REQ \
107 | L3_STATUS_0_MAD2DTA_REQ) 107 | L3_STATUS_0_MAD2DTA_REQ)
108 108
109#define L3_SI_FLAG_STATUS_1 0x530 109#define L3_SI_FLAG_STATUS_1 0x530
@@ -137,19 +137,19 @@ const u64 shift = 1;
137 137
138enum omap3_l3_initiator_id { 138enum omap3_l3_initiator_id {
139 /* LCD has 1 ID */ 139 /* LCD has 1 ID */
140 OMAP_L3_LCD = 29, 140 OMAP_L3_LCD = 29,
141 /* SAD2D has 1 ID */ 141 /* SAD2D has 1 ID */
142 OMAP_L3_SAD2D = 28, 142 OMAP_L3_SAD2D = 28,
143 /* MPU has 5 IDs */ 143 /* MPU has 5 IDs */
144 OMAP_L3_IA_MPU_SS_1 = 27, 144 OMAP_L3_IA_MPU_SS_1 = 27,
145 OMAP_L3_IA_MPU_SS_2 = 26, 145 OMAP_L3_IA_MPU_SS_2 = 26,
146 OMAP_L3_IA_MPU_SS_3 = 25, 146 OMAP_L3_IA_MPU_SS_3 = 25,
147 OMAP_L3_IA_MPU_SS_4 = 24, 147 OMAP_L3_IA_MPU_SS_4 = 24,
148 OMAP_L3_IA_MPU_SS_5 = 23, 148 OMAP_L3_IA_MPU_SS_5 = 23,
149 /* IVA2.2 SS has 3 IDs*/ 149 /* IVA2.2 SS has 3 IDs*/
150 OMAP_L3_IA_IVA_SS_1 = 22, 150 OMAP_L3_IA_IVA_SS_1 = 22,
151 OMAP_L3_IA_IVA_SS_2 = 21, 151 OMAP_L3_IA_IVA_SS_2 = 21,
152 OMAP_L3_IA_IVA_SS_3 = 20, 152 OMAP_L3_IA_IVA_SS_3 = 20,
153 /* IVA 2.2 SS DMA has 6 IDS */ 153 /* IVA 2.2 SS DMA has 6 IDS */
154 OMAP_L3_IA_IVA_SS_DMA_1 = 19, 154 OMAP_L3_IA_IVA_SS_DMA_1 = 19,
155 OMAP_L3_IA_IVA_SS_DMA_2 = 18, 155 OMAP_L3_IA_IVA_SS_DMA_2 = 18,
@@ -158,25 +158,25 @@ enum omap3_l3_initiator_id {
158 OMAP_L3_IA_IVA_SS_DMA_5 = 15, 158 OMAP_L3_IA_IVA_SS_DMA_5 = 15,
159 OMAP_L3_IA_IVA_SS_DMA_6 = 14, 159 OMAP_L3_IA_IVA_SS_DMA_6 = 14,
160 /* SGX has 1 ID */ 160 /* SGX has 1 ID */
161 OMAP_L3_IA_SGX = 13, 161 OMAP_L3_IA_SGX = 13,
162 /* CAM has 3 ID */ 162 /* CAM has 3 ID */
163 OMAP_L3_IA_CAM_1 = 12, 163 OMAP_L3_IA_CAM_1 = 12,
164 OMAP_L3_IA_CAM_2 = 11, 164 OMAP_L3_IA_CAM_2 = 11,
165 OMAP_L3_IA_CAM_3 = 10, 165 OMAP_L3_IA_CAM_3 = 10,
166 /* DAP has 1 ID */ 166 /* DAP has 1 ID */
167 OMAP_L3_IA_DAP = 9, 167 OMAP_L3_IA_DAP = 9,
168 /* SDMA WR has 2 IDs */ 168 /* SDMA WR has 2 IDs */
169 OMAP_L3_SDMA_WR_1 = 8, 169 OMAP_L3_SDMA_WR_1 = 8,
170 OMAP_L3_SDMA_WR_2 = 7, 170 OMAP_L3_SDMA_WR_2 = 7,
171 /* SDMA RD has 4 IDs */ 171 /* SDMA RD has 4 IDs */
172 OMAP_L3_SDMA_RD_1 = 6, 172 OMAP_L3_SDMA_RD_1 = 6,
173 OMAP_L3_SDMA_RD_2 = 5, 173 OMAP_L3_SDMA_RD_2 = 5,
174 OMAP_L3_SDMA_RD_3 = 4, 174 OMAP_L3_SDMA_RD_3 = 4,
175 OMAP_L3_SDMA_RD_4 = 3, 175 OMAP_L3_SDMA_RD_4 = 3,
176 /* HSUSB OTG has 1 ID */ 176 /* HSUSB OTG has 1 ID */
177 OMAP_L3_USBOTG = 2, 177 OMAP_L3_USBOTG = 2,
178 /* HSUSB HOST has 1 ID */ 178 /* HSUSB HOST has 1 ID */
179 OMAP_L3_USBHOST = 1, 179 OMAP_L3_USBHOST = 1,
180}; 180};
181 181
182enum omap3_l3_code { 182enum omap3_l3_code {
@@ -192,21 +192,21 @@ enum omap3_l3_code {
192}; 192};
193 193
194struct omap3_l3 { 194struct omap3_l3 {
195 struct device *dev; 195 struct device *dev;
196 struct clk *ick; 196 struct clk *ick;
197 197
198 /* memory base*/ 198 /* memory base*/
199 void __iomem *rt; 199 void __iomem *rt;
200 200
201 int debug_irq; 201 int debug_irq;
202 int app_irq; 202 int app_irq;
203 203
204 /* true when and inband functional error occurs */ 204 /* true when and inband functional error occurs */
205 unsigned inband:1; 205 unsigned inband:1;
206}; 206};
207 207
208/* offsets for l3 agents in order with the Flag status register */ 208/* offsets for l3 agents in order with the Flag status register */
209unsigned int __iomem omap3_l3_app_bases[] = { 209static unsigned int omap3_l3_app_bases[] = {
210 /* MPU IA */ 210 /* MPU IA */
211 0x1400, 211 0x1400,
212 0x1400, 212 0x1400,
@@ -305,7 +305,7 @@ unsigned int __iomem omap3_l3_app_bases[] = {
305 0, 305 0,
306}; 306};
307 307
308unsigned int __iomem omap3_l3_debug_bases[] = { 308static unsigned int omap3_l3_debug_bases[] = {
309 /* MPU DATA IA */ 309 /* MPU DATA IA */
310 0x1400, 310 0x1400,
311 /* RESERVED */ 311 /* RESERVED */
@@ -321,7 +321,7 @@ unsigned int __iomem omap3_l3_debug_bases[] = {
321 /* REST RESERVED */ 321 /* REST RESERVED */
322}; 322};
323 323
324u32 *omap3_l3_bases[] = { 324static u32 *omap3_l3_bases[] = {
325 omap3_l3_app_bases, 325 omap3_l3_app_bases,
326 omap3_l3_debug_bases, 326 omap3_l3_debug_bases,
327}; 327};
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 07d6140baa9d..f515a1a056d5 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -42,8 +42,11 @@
42 42
43#define OMAP4_SRI2C_SLAVE_ADDR 0x12 43#define OMAP4_SRI2C_SLAVE_ADDR 0x12
44#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 44#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55
45#define OMAP4_VDD_MPU_SR_CMD_REG 0x56
45#define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B 46#define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B
47#define OMAP4_VDD_IVA_SR_CMD_REG 0x5C
46#define OMAP4_VDD_CORE_SR_VOLT_REG 0x61 48#define OMAP4_VDD_CORE_SR_VOLT_REG 0x61
49#define OMAP4_VDD_CORE_SR_CMD_REG 0x62
47 50
48#define OMAP4_VP_CONFIG_ERROROFFSET 0x00 51#define OMAP4_VP_CONFIG_ERROROFFSET 0x00
49#define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01 52#define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01
@@ -95,6 +98,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
95 is_offset_valid = true; 98 is_offset_valid = true;
96 } 99 }
97 100
101 if (!vsel)
102 return 0;
98 /* 103 /*
99 * There is no specific formula for voltage to vsel 104 * There is no specific formula for voltage to vsel
100 * conversion above 1.3V. There are special hardcoded 105 * conversion above 1.3V. There are special hardcoded
@@ -106,9 +111,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
106 return 1350000; 111 return 1350000;
107 112
108 if (smps_offset & 0x8) 113 if (smps_offset & 0x8)
109 return ((((vsel - 1) * 125) + 7000)) * 100; 114 return ((((vsel - 1) * 1266) + 70900)) * 10;
110 else 115 else
111 return ((((vsel - 1) * 125) + 6000)) * 100; 116 return ((((vsel - 1) * 1266) + 60770)) * 10;
112} 117}
113 118
114static u8 twl6030_uv_to_vsel(unsigned long uv) 119static u8 twl6030_uv_to_vsel(unsigned long uv)
@@ -127,6 +132,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
127 is_offset_valid = true; 132 is_offset_valid = true;
128 } 133 }
129 134
135 if (!uv)
136 return 0x00;
130 /* 137 /*
131 * There is no specific formula for voltage to vsel 138 * There is no specific formula for voltage to vsel
132 * conversion above 1.3V. There are special hardcoded 139 * conversion above 1.3V. There are special hardcoded
@@ -134,16 +141,21 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
134 * hardcoding only for 1.35 V which is used for 1GH OPP for 141 * hardcoding only for 1.35 V which is used for 1GH OPP for
135 * OMAP4430. 142 * OMAP4430.
136 */ 143 */
137 if (uv == 1350000) 144 if (uv > twl6030_vsel_to_uv(0x39)) {
145 if (uv == 1350000)
146 return 0x3A;
147 pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n",
148 __func__, uv, twl6030_vsel_to_uv(0x39));
138 return 0x3A; 149 return 0x3A;
150 }
139 151
140 if (smps_offset & 0x8) 152 if (smps_offset & 0x8)
141 return DIV_ROUND_UP(uv - 700000, 12500) + 1; 153 return DIV_ROUND_UP(uv - 709000, 12660) + 1;
142 else 154 else
143 return DIV_ROUND_UP(uv - 600000, 12500) + 1; 155 return DIV_ROUND_UP(uv - 607700, 12660) + 1;
144} 156}
145 157
146static struct omap_volt_pmic_info omap3_mpu_volt_info = { 158static struct omap_voltdm_pmic omap3_mpu_pmic = {
147 .slew_rate = 4000, 159 .slew_rate = 4000,
148 .step_size = 12500, 160 .step_size = 12500,
149 .on_volt = 1200000, 161 .on_volt = 1200000,
@@ -158,12 +170,13 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
158 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, 170 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
159 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 171 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
160 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 172 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
161 .pmic_reg = OMAP3_VDD_MPU_SR_CONTROL_REG, 173 .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG,
174 .i2c_high_speed = true,
162 .vsel_to_uv = twl4030_vsel_to_uv, 175 .vsel_to_uv = twl4030_vsel_to_uv,
163 .uv_to_vsel = twl4030_uv_to_vsel, 176 .uv_to_vsel = twl4030_uv_to_vsel,
164}; 177};
165 178
166static struct omap_volt_pmic_info omap3_core_volt_info = { 179static struct omap_voltdm_pmic omap3_core_pmic = {
167 .slew_rate = 4000, 180 .slew_rate = 4000,
168 .step_size = 12500, 181 .step_size = 12500,
169 .on_volt = 1200000, 182 .on_volt = 1200000,
@@ -178,18 +191,19 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
178 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, 191 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
179 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 192 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
180 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 193 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
181 .pmic_reg = OMAP3_VDD_CORE_SR_CONTROL_REG, 194 .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG,
195 .i2c_high_speed = true,
182 .vsel_to_uv = twl4030_vsel_to_uv, 196 .vsel_to_uv = twl4030_vsel_to_uv,
183 .uv_to_vsel = twl4030_uv_to_vsel, 197 .uv_to_vsel = twl4030_uv_to_vsel,
184}; 198};
185 199
186static struct omap_volt_pmic_info omap4_mpu_volt_info = { 200static struct omap_voltdm_pmic omap4_mpu_pmic = {
187 .slew_rate = 4000, 201 .slew_rate = 4000,
188 .step_size = 12500, 202 .step_size = 12660,
189 .on_volt = 1350000, 203 .on_volt = 1375000,
190 .onlp_volt = 1350000, 204 .onlp_volt = 1375000,
191 .ret_volt = 837500, 205 .ret_volt = 830000,
192 .off_volt = 600000, 206 .off_volt = 0,
193 .volt_setup_time = 0, 207 .volt_setup_time = 0,
194 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 208 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
195 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 209 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -198,18 +212,20 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
198 .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, 212 .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
199 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 213 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
200 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 214 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
201 .pmic_reg = OMAP4_VDD_MPU_SR_VOLT_REG, 215 .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG,
216 .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG,
217 .i2c_high_speed = true,
202 .vsel_to_uv = twl6030_vsel_to_uv, 218 .vsel_to_uv = twl6030_vsel_to_uv,
203 .uv_to_vsel = twl6030_uv_to_vsel, 219 .uv_to_vsel = twl6030_uv_to_vsel,
204}; 220};
205 221
206static struct omap_volt_pmic_info omap4_iva_volt_info = { 222static struct omap_voltdm_pmic omap4_iva_pmic = {
207 .slew_rate = 4000, 223 .slew_rate = 4000,
208 .step_size = 12500, 224 .step_size = 12660,
209 .on_volt = 1100000, 225 .on_volt = 1188000,
210 .onlp_volt = 1100000, 226 .onlp_volt = 1188000,
211 .ret_volt = 837500, 227 .ret_volt = 830000,
212 .off_volt = 600000, 228 .off_volt = 0,
213 .volt_setup_time = 0, 229 .volt_setup_time = 0,
214 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 230 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
215 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 231 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -218,18 +234,20 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
218 .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, 234 .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
219 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 235 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
220 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 236 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
221 .pmic_reg = OMAP4_VDD_IVA_SR_VOLT_REG, 237 .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG,
238 .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG,
239 .i2c_high_speed = true,
222 .vsel_to_uv = twl6030_vsel_to_uv, 240 .vsel_to_uv = twl6030_vsel_to_uv,
223 .uv_to_vsel = twl6030_uv_to_vsel, 241 .uv_to_vsel = twl6030_uv_to_vsel,
224}; 242};
225 243
226static struct omap_volt_pmic_info omap4_core_volt_info = { 244static struct omap_voltdm_pmic omap4_core_pmic = {
227 .slew_rate = 4000, 245 .slew_rate = 4000,
228 .step_size = 12500, 246 .step_size = 12660,
229 .on_volt = 1100000, 247 .on_volt = 1200000,
230 .onlp_volt = 1100000, 248 .onlp_volt = 1200000,
231 .ret_volt = 837500, 249 .ret_volt = 830000,
232 .off_volt = 600000, 250 .off_volt = 0,
233 .volt_setup_time = 0, 251 .volt_setup_time = 0,
234 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 252 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
235 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 253 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -238,7 +256,8 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
238 .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, 256 .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
239 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 257 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
240 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 258 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
241 .pmic_reg = OMAP4_VDD_CORE_SR_VOLT_REG, 259 .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG,
260 .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG,
242 .vsel_to_uv = twl6030_vsel_to_uv, 261 .vsel_to_uv = twl6030_vsel_to_uv,
243 .uv_to_vsel = twl6030_uv_to_vsel, 262 .uv_to_vsel = twl6030_uv_to_vsel,
244}; 263};
@@ -250,14 +269,14 @@ int __init omap4_twl_init(void)
250 if (!cpu_is_omap44xx()) 269 if (!cpu_is_omap44xx())
251 return -ENODEV; 270 return -ENODEV;
252 271
253 voltdm = omap_voltage_domain_lookup("mpu"); 272 voltdm = voltdm_lookup("mpu");
254 omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info); 273 omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic);
255 274
256 voltdm = omap_voltage_domain_lookup("iva"); 275 voltdm = voltdm_lookup("iva");
257 omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info); 276 omap_voltage_register_pmic(voltdm, &omap4_iva_pmic);
258 277
259 voltdm = omap_voltage_domain_lookup("core"); 278 voltdm = voltdm_lookup("core");
260 omap_voltage_register_pmic(voltdm, &omap4_core_volt_info); 279 omap_voltage_register_pmic(voltdm, &omap4_core_pmic);
261 280
262 return 0; 281 return 0;
263} 282}
@@ -270,10 +289,10 @@ int __init omap3_twl_init(void)
270 return -ENODEV; 289 return -ENODEV;
271 290
272 if (cpu_is_omap3630()) { 291 if (cpu_is_omap3630()) {
273 omap3_mpu_volt_info.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN; 292 omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
274 omap3_mpu_volt_info.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX; 293 omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
275 omap3_core_volt_info.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN; 294 omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
276 omap3_core_volt_info.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX; 295 omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
277 } 296 }
278 297
279 /* 298 /*
@@ -288,11 +307,11 @@ int __init omap3_twl_init(void)
288 if (!twl_sr_enable_autoinit) 307 if (!twl_sr_enable_autoinit)
289 omap3_twl_set_sr_bit(true); 308 omap3_twl_set_sr_bit(true);
290 309
291 voltdm = omap_voltage_domain_lookup("mpu"); 310 voltdm = voltdm_lookup("mpu_iva");
292 omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info); 311 omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
293 312
294 voltdm = omap_voltage_domain_lookup("core"); 313 voltdm = voltdm_lookup("core");
295 omap_voltage_register_pmic(voltdm, &omap3_core_volt_info); 314 omap_voltage_register_pmic(voltdm, &omap3_core_pmic);
296 315
297 return 0; 316 return 0;
298} 317}
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index ab8b35b780b5..9262a6b47702 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -69,7 +69,7 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
69 opp_def->hwmod_name, i); 69 opp_def->hwmod_name, i);
70 return -EINVAL; 70 return -EINVAL;
71 } 71 }
72 dev = &oh->od->pdev.dev; 72 dev = &oh->od->pdev->dev;
73 73
74 r = opp_add(dev, opp_def->freq, opp_def->u_volt); 74 r = opp_add(dev, opp_def->freq, opp_def->u_volt);
75 if (r) { 75 if (r) {
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 472bf22d5e84..2ab7a9e17fe2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -26,54 +26,21 @@
26 26
27static struct omap_device_pm_latency *pm_lats; 27static struct omap_device_pm_latency *pm_lats;
28 28
29static struct device *mpu_dev; 29static int _init_omap_device(char *name)
30static struct device *iva_dev;
31static struct device *l3_dev;
32static struct device *dsp_dev;
33
34struct device *omap2_get_mpuss_device(void)
35{
36 WARN_ON_ONCE(!mpu_dev);
37 return mpu_dev;
38}
39
40struct device *omap2_get_iva_device(void)
41{
42 WARN_ON_ONCE(!iva_dev);
43 return iva_dev;
44}
45
46struct device *omap2_get_l3_device(void)
47{
48 WARN_ON_ONCE(!l3_dev);
49 return l3_dev;
50}
51
52struct device *omap4_get_dsp_device(void)
53{
54 WARN_ON_ONCE(!dsp_dev);
55 return dsp_dev;
56}
57EXPORT_SYMBOL(omap4_get_dsp_device);
58
59/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
60static int _init_omap_device(char *name, struct device **new_dev)
61{ 30{
62 struct omap_hwmod *oh; 31 struct omap_hwmod *oh;
63 struct omap_device *od; 32 struct platform_device *pdev;
64 33
65 oh = omap_hwmod_lookup(name); 34 oh = omap_hwmod_lookup(name);
66 if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", 35 if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
67 __func__, name)) 36 __func__, name))
68 return -ENODEV; 37 return -ENODEV;
69 38
70 od = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); 39 pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false);
71 if (WARN(IS_ERR(od), "%s: could not build omap_device for %s\n", 40 if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n",
72 __func__, name)) 41 __func__, name))
73 return -ENODEV; 42 return -ENODEV;
74 43
75 *new_dev = &od->pdev.dev;
76
77 return 0; 44 return 0;
78} 45}
79 46
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
82 */ 49 */
83static void omap2_init_processor_devices(void) 50static void omap2_init_processor_devices(void)
84{ 51{
85 _init_omap_device("mpu", &mpu_dev); 52 _init_omap_device("mpu");
86 if (omap3_has_iva()) 53 if (omap3_has_iva())
87 _init_omap_device("iva", &iva_dev); 54 _init_omap_device("iva");
88 55
89 if (cpu_is_omap44xx()) { 56 if (cpu_is_omap44xx()) {
90 _init_omap_device("l3_main_1", &l3_dev); 57 _init_omap_device("l3_main_1");
91 _init_omap_device("dsp", &dsp_dev); 58 _init_omap_device("dsp");
92 _init_omap_device("iva", &iva_dev); 59 _init_omap_device("iva");
93 } else { 60 } else {
94 _init_omap_device("l3_main", &l3_dev); 61 _init_omap_device("l3_main");
95 } 62 }
96} 63}
97 64
@@ -136,8 +103,8 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
136 103
137 ret = pwrdm_set_next_pwrst(pwrdm, state); 104 ret = pwrdm_set_next_pwrst(pwrdm, state);
138 if (ret) { 105 if (ret) {
139 printk(KERN_ERR "Unable to set state of powerdomain: %s\n", 106 pr_err("%s: unable to set state of powerdomain: %s\n",
140 pwrdm->name); 107 __func__, pwrdm->name);
141 goto err; 108 goto err;
142 } 109 }
143 110
@@ -161,37 +128,44 @@ err:
161} 128}
162 129
163/* 130/*
164 * This API is to be called during init to put the various voltage 131 * This API is to be called during init to set the various voltage
165 * domains to the voltage as per the opp table. Typically we boot up 132 * domains to the voltage as per the opp table. Typically we boot up
166 * at the nominal voltage. So this function finds out the rate of 133 * at the nominal voltage. So this function finds out the rate of
167 * the clock associated with the voltage domain, finds out the correct 134 * the clock associated with the voltage domain, finds out the correct
168 * opp entry and puts the voltage domain to the voltage specifies 135 * opp entry and sets the voltage domain to the voltage specified
169 * in the opp entry 136 * in the opp entry
170 */ 137 */
171static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, 138static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
172 struct device *dev) 139 const char *oh_name)
173{ 140{
174 struct voltagedomain *voltdm; 141 struct voltagedomain *voltdm;
175 struct clk *clk; 142 struct clk *clk;
176 struct opp *opp; 143 struct opp *opp;
177 unsigned long freq, bootup_volt; 144 unsigned long freq, bootup_volt;
145 struct device *dev;
146
147 if (!vdd_name || !clk_name || !oh_name) {
148 pr_err("%s: invalid parameters\n", __func__);
149 goto exit;
150 }
178 151
179 if (!vdd_name || !clk_name || !dev) { 152 dev = omap_device_get_by_hwmod_name(oh_name);
180 printk(KERN_ERR "%s: Invalid parameters!\n", __func__); 153 if (IS_ERR(dev)) {
154 pr_err("%s: Unable to get dev pointer for hwmod %s\n",
155 __func__, oh_name);
181 goto exit; 156 goto exit;
182 } 157 }
183 158
184 voltdm = omap_voltage_domain_lookup(vdd_name); 159 voltdm = voltdm_lookup(vdd_name);
185 if (IS_ERR(voltdm)) { 160 if (IS_ERR(voltdm)) {
186 printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n", 161 pr_err("%s: unable to get vdd pointer for vdd_%s\n",
187 __func__, vdd_name); 162 __func__, vdd_name);
188 goto exit; 163 goto exit;
189 } 164 }
190 165
191 clk = clk_get(NULL, clk_name); 166 clk = clk_get(NULL, clk_name);
192 if (IS_ERR(clk)) { 167 if (IS_ERR(clk)) {
193 printk(KERN_ERR "%s: unable to get clk %s\n", 168 pr_err("%s: unable to get clk %s\n", __func__, clk_name);
194 __func__, clk_name);
195 goto exit; 169 goto exit;
196 } 170 }
197 171
@@ -200,24 +174,23 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
200 174
201 opp = opp_find_freq_ceil(dev, &freq); 175 opp = opp_find_freq_ceil(dev, &freq);
202 if (IS_ERR(opp)) { 176 if (IS_ERR(opp)) {
203 printk(KERN_ERR "%s: unable to find boot up OPP for vdd_%s\n", 177 pr_err("%s: unable to find boot up OPP for vdd_%s\n",
204 __func__, vdd_name); 178 __func__, vdd_name);
205 goto exit; 179 goto exit;
206 } 180 }
207 181
208 bootup_volt = opp_get_voltage(opp); 182 bootup_volt = opp_get_voltage(opp);
209 if (!bootup_volt) { 183 if (!bootup_volt) {
210 printk(KERN_ERR "%s: unable to find voltage corresponding" 184 pr_err("%s: unable to find voltage corresponding "
211 "to the bootup OPP for vdd_%s\n", __func__, vdd_name); 185 "to the bootup OPP for vdd_%s\n", __func__, vdd_name);
212 goto exit; 186 goto exit;
213 } 187 }
214 188
215 omap_voltage_scale_vdd(voltdm, bootup_volt); 189 voltdm_scale(voltdm, bootup_volt);
216 return 0; 190 return 0;
217 191
218exit: 192exit:
219 printk(KERN_ERR "%s: Unable to put vdd_%s to its init voltage\n\n", 193 pr_err("%s: unable to set vdd_%s\n", __func__, vdd_name);
220 __func__, vdd_name);
221 return -EINVAL; 194 return -EINVAL;
222} 195}
223 196
@@ -226,8 +199,8 @@ static void __init omap3_init_voltages(void)
226 if (!cpu_is_omap34xx()) 199 if (!cpu_is_omap34xx())
227 return; 200 return;
228 201
229 omap2_set_init_voltage("mpu", "dpll1_ck", mpu_dev); 202 omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
230 omap2_set_init_voltage("core", "l3_ick", l3_dev); 203 omap2_set_init_voltage("core", "l3_ick", "l3_main");
231} 204}
232 205
233static void __init omap4_init_voltages(void) 206static void __init omap4_init_voltages(void)
@@ -235,14 +208,15 @@ static void __init omap4_init_voltages(void)
235 if (!cpu_is_omap44xx()) 208 if (!cpu_is_omap44xx())
236 return; 209 return;
237 210
238 omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev); 211 omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
239 omap2_set_init_voltage("core", "l3_div_ck", l3_dev); 212 omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
240 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev); 213 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
241} 214}
242 215
243static int __init omap2_common_pm_init(void) 216static int __init omap2_common_pm_init(void)
244{ 217{
245 omap2_init_processor_devices(); 218 if (!of_have_populated_dt())
219 omap2_init_processor_devices();
246 omap_pm_if_init(); 220 omap_pm_if_init();
247 221
248 return 0; 222 return 0;
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index bf089e743ed9..cf0c216132ab 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -53,8 +53,6 @@
53#include "powerdomain.h" 53#include "powerdomain.h"
54#include "clockdomain.h" 54#include "clockdomain.h"
55 55
56static int omap2_pm_debug;
57
58#ifdef CONFIG_SUSPEND 56#ifdef CONFIG_SUSPEND
59static suspend_state_t suspend_state = PM_SUSPEND_ON; 57static suspend_state_t suspend_state = PM_SUSPEND_ON;
60static inline bool is_suspending(void) 58static inline bool is_suspending(void)
@@ -96,7 +94,6 @@ static int omap2_fclks_active(void)
96static void omap2_enter_full_retention(void) 94static void omap2_enter_full_retention(void)
97{ 95{
98 u32 l; 96 u32 l;
99 struct timespec ts_preidle, ts_postidle, ts_idle;
100 97
101 /* There is 1 reference hold for all children of the oscillator 98 /* There is 1 reference hold for all children of the oscillator
102 * clock, the following will remove it. If no one else uses the 99 * clock, the following will remove it. If no one else uses the
@@ -124,10 +121,6 @@ static void omap2_enter_full_retention(void)
124 121
125 omap2_gpio_prepare_for_idle(0); 122 omap2_gpio_prepare_for_idle(0);
126 123
127 if (omap2_pm_debug) {
128 getnstimeofday(&ts_preidle);
129 }
130
131 /* One last check for pending IRQs to avoid extra latency due 124 /* One last check for pending IRQs to avoid extra latency due
132 * to sleeping unnecessarily. */ 125 * to sleeping unnecessarily. */
133 if (omap_irq_pending()) 126 if (omap_irq_pending())
@@ -155,13 +148,6 @@ static void omap2_enter_full_retention(void)
155 console_unlock(); 148 console_unlock();
156 149
157no_sleep: 150no_sleep:
158 if (omap2_pm_debug) {
159 unsigned long long tmp;
160
161 getnstimeofday(&ts_postidle);
162 ts_idle = timespec_sub(ts_postidle, ts_preidle);
163 tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC;
164 }
165 omap2_gpio_resume_after_idle(); 151 omap2_gpio_resume_after_idle();
166 152
167 clk_enable(osc_ck); 153 clk_enable(osc_ck);
@@ -219,7 +205,6 @@ static int omap2_allow_mpu_retention(void)
219static void omap2_enter_mpu_retention(void) 205static void omap2_enter_mpu_retention(void)
220{ 206{
221 int only_idle = 0; 207 int only_idle = 0;
222 struct timespec ts_preidle, ts_postidle, ts_idle;
223 208
224 /* Putting MPU into the WFI state while a transfer is active 209 /* Putting MPU into the WFI state while a transfer is active
225 * seems to cause the I2C block to timeout. Why? Good question. */ 210 * seems to cause the I2C block to timeout. Why? Good question. */
@@ -246,19 +231,7 @@ static void omap2_enter_mpu_retention(void)
246 only_idle = 1; 231 only_idle = 1;
247 } 232 }
248 233
249 if (omap2_pm_debug) {
250 getnstimeofday(&ts_preidle);
251 }
252
253 omap2_sram_idle(); 234 omap2_sram_idle();
254
255 if (omap2_pm_debug) {
256 unsigned long long tmp;
257
258 getnstimeofday(&ts_postidle);
259 ts_idle = timespec_sub(ts_postidle, ts_preidle);
260 tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC;
261 }
262} 235}
263 236
264static int omap2_can_sleep(void) 237static int omap2_can_sleep(void)
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 7255d9bce868..c8cbd00a41af 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -55,7 +55,7 @@
55static suspend_state_t suspend_state = PM_SUSPEND_ON; 55static suspend_state_t suspend_state = PM_SUSPEND_ON;
56static inline bool is_suspending(void) 56static inline bool is_suspending(void)
57{ 57{
58 return (suspend_state != PM_SUSPEND_ON); 58 return (suspend_state != PM_SUSPEND_ON) && console_suspend_enabled;
59} 59}
60#else 60#else
61static inline bool is_suspending(void) 61static inline bool is_suspending(void)
diff --git a/arch/arm/mach-omap2/powerdomain-common.c b/arch/arm/mach-omap2/powerdomain-common.c
index 171fccd208c7..f97afff68d6d 100644
--- a/arch/arm/mach-omap2/powerdomain-common.c
+++ b/arch/arm/mach-omap2/powerdomain-common.c
@@ -1,9 +1,8 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/powerdomain-common.c 2 * Common powerdomain framework functions
3 * Contains common powerdomain framework functions
4 * 3 *
5 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010-2011 Texas Instruments, Inc.
6 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
7 * 6 *
8 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley 7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
9 * 8 *
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index ef71fdd40fc4..5164d587ef52 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP powerdomain control 2 * OMAP powerdomain control
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -77,13 +77,11 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
77static int _pwrdm_register(struct powerdomain *pwrdm) 77static int _pwrdm_register(struct powerdomain *pwrdm)
78{ 78{
79 int i; 79 int i;
80 struct voltagedomain *voltdm;
80 81
81 if (!pwrdm || !pwrdm->name) 82 if (!pwrdm || !pwrdm->name)
82 return -EINVAL; 83 return -EINVAL;
83 84
84 if (!omap_chip_is(pwrdm->omap_chip))
85 return -EINVAL;
86
87 if (cpu_is_omap44xx() && 85 if (cpu_is_omap44xx() &&
88 pwrdm->prcm_partition == OMAP4430_INVALID_PRCM_PARTITION) { 86 pwrdm->prcm_partition == OMAP4430_INVALID_PRCM_PARTITION) {
89 pr_err("powerdomain: %s: missing OMAP4 PRCM partition ID\n", 87 pr_err("powerdomain: %s: missing OMAP4 PRCM partition ID\n",
@@ -94,6 +92,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
94 if (_pwrdm_lookup(pwrdm->name)) 92 if (_pwrdm_lookup(pwrdm->name))
95 return -EEXIST; 93 return -EEXIST;
96 94
95 voltdm = voltdm_lookup(pwrdm->voltdm.name);
96 if (!voltdm) {
97 pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
98 pwrdm->name, pwrdm->voltdm.name);
99 return -EINVAL;
100 }
101 pwrdm->voltdm.ptr = voltdm;
102 INIT_LIST_HEAD(&pwrdm->voltdm_node);
103 voltdm_add_pwrdm(voltdm, pwrdm);
104
97 list_add(&pwrdm->node, &pwrdm_list); 105 list_add(&pwrdm->node, &pwrdm_list);
98 106
99 /* Initialize the powerdomain's state counter */ 107 /* Initialize the powerdomain's state counter */
@@ -194,36 +202,76 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
194/* Public functions */ 202/* Public functions */
195 203
196/** 204/**
197 * pwrdm_init - set up the powerdomain layer 205 * pwrdm_register_platform_funcs - register powerdomain implementation fns
198 * @pwrdms: array of struct powerdomain pointers to register 206 * @po: func pointers for arch specific implementations
199 * @custom_funcs: func pointers for arch specific implementations
200 * 207 *
201 * Loop through the array of powerdomains @pwrdms, registering all 208 * Register the list of function pointers used to implement the
202 * that are available on the current CPU. Also, program all 209 * powerdomain functions on different OMAP SoCs. Should be called
203 * powerdomain target state as ON; this is to prevent domains from 210 * before any other pwrdm_register*() function. Returns -EINVAL if
204 * hitting low power states (if bootloader has target states set to 211 * @po is null, -EEXIST if platform functions have already been
205 * something other than ON) and potentially even losing context while 212 * registered, or 0 upon success.
206 * PM is not fully initialized. The PM late init code can then program
207 * the desired target state for all the power domains. No return
208 * value.
209 */ 213 */
210void pwrdm_init(struct powerdomain **pwrdms, struct pwrdm_ops *custom_funcs) 214int pwrdm_register_platform_funcs(struct pwrdm_ops *po)
215{
216 if (!po)
217 return -EINVAL;
218
219 if (arch_pwrdm)
220 return -EEXIST;
221
222 arch_pwrdm = po;
223
224 return 0;
225}
226
227/**
228 * pwrdm_register_pwrdms - register SoC powerdomains
229 * @ps: pointer to an array of struct powerdomain to register
230 *
231 * Register the powerdomains available on a particular OMAP SoC. Must
232 * be called after pwrdm_register_platform_funcs(). May be called
233 * multiple times. Returns -EACCES if called before
234 * pwrdm_register_platform_funcs(); -EINVAL if the argument @ps is
235 * null; or 0 upon success.
236 */
237int pwrdm_register_pwrdms(struct powerdomain **ps)
211{ 238{
212 struct powerdomain **p = NULL; 239 struct powerdomain **p = NULL;
213 struct powerdomain *temp_p;
214 240
215 if (!custom_funcs) 241 if (!arch_pwrdm)
216 WARN(1, "powerdomain: No custom pwrdm functions registered\n"); 242 return -EEXIST;
217 else
218 arch_pwrdm = custom_funcs;
219 243
220 if (pwrdms) { 244 if (!ps)
221 for (p = pwrdms; *p; p++) 245 return -EINVAL;
222 _pwrdm_register(*p); 246
223 } 247 for (p = ps; *p; p++)
248 _pwrdm_register(*p);
249
250 return 0;
251}
252
253/**
254 * pwrdm_complete_init - set up the powerdomain layer
255 *
256 * Do whatever is necessary to initialize registered powerdomains and
257 * powerdomain code. Currently, this programs the next power state
258 * for each powerdomain to ON. This prevents powerdomains from
259 * unexpectedly losing context or entering high wakeup latency modes
260 * with non-power-management-enabled kernels. Must be called after
261 * pwrdm_register_pwrdms(). Returns -EACCES if called before
262 * pwrdm_register_pwrdms(), or 0 upon success.
263 */
264int pwrdm_complete_init(void)
265{
266 struct powerdomain *temp_p;
267
268 if (list_empty(&pwrdm_list))
269 return -EACCES;
224 270
225 list_for_each_entry(temp_p, &pwrdm_list, node) 271 list_for_each_entry(temp_p, &pwrdm_list, node)
226 pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON); 272 pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON);
273
274 return 0;
227} 275}
228 276
229/** 277/**
@@ -390,6 +438,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
390} 438}
391 439
392/** 440/**
441 * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
442 * @pwrdm: struct powerdomain *
443 *
444 * Return a pointer to the struct voltageomain that the specified powerdomain
445 * @pwrdm exists in.
446 */
447struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
448{
449 return pwrdm->voltdm.ptr;
450}
451
452/**
393 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain 453 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
394 * @pwrdm: struct powerdomain * 454 * @pwrdm: struct powerdomain *
395 * 455 *
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index d23d979b9c34..42e6dd8f2a78 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -24,6 +24,8 @@
24 24
25#include <plat/cpu.h> 25#include <plat/cpu.h>
26 26
27#include "voltage.h"
28
27/* Powerdomain basic power states */ 29/* Powerdomain basic power states */
28#define PWRDM_POWER_OFF 0x0 30#define PWRDM_POWER_OFF 0x0
29#define PWRDM_POWER_RET 0x1 31#define PWRDM_POWER_RET 0x1
@@ -78,7 +80,7 @@ struct powerdomain;
78/** 80/**
79 * struct powerdomain - OMAP powerdomain 81 * struct powerdomain - OMAP powerdomain
80 * @name: Powerdomain name 82 * @name: Powerdomain name
81 * @omap_chip: represents the OMAP chip types containing this pwrdm 83 * @voltdm: voltagedomain containing this powerdomain
82 * @prcm_offs: the address offset from CM_BASE/PRM_BASE 84 * @prcm_offs: the address offset from CM_BASE/PRM_BASE
83 * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs 85 * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
84 * @pwrsts: Possible powerdomain power states 86 * @pwrsts: Possible powerdomain power states
@@ -89,6 +91,7 @@ struct powerdomain;
89 * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON 91 * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
90 * @pwrdm_clkdms: Clockdomains in this powerdomain 92 * @pwrdm_clkdms: Clockdomains in this powerdomain
91 * @node: list_head linking all powerdomains 93 * @node: list_head linking all powerdomains
94 * @voltdm_node: list_head linking all powerdomains in a voltagedomain
92 * @state: 95 * @state:
93 * @state_counter: 96 * @state_counter:
94 * @timer: 97 * @timer:
@@ -98,7 +101,10 @@ struct powerdomain;
98 */ 101 */
99struct powerdomain { 102struct powerdomain {
100 const char *name; 103 const char *name;
101 const struct omap_chip_id omap_chip; 104 union {
105 const char *name;
106 struct voltagedomain *ptr;
107 } voltdm;
102 const s16 prcm_offs; 108 const s16 prcm_offs;
103 const u8 pwrsts; 109 const u8 pwrsts;
104 const u8 pwrsts_logic_ret; 110 const u8 pwrsts_logic_ret;
@@ -109,6 +115,7 @@ struct powerdomain {
109 const u8 prcm_partition; 115 const u8 prcm_partition;
110 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS]; 116 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
111 struct list_head node; 117 struct list_head node;
118 struct list_head voltdm_node;
112 int state; 119 int state;
113 unsigned state_counter[PWRDM_MAX_PWRSTS]; 120 unsigned state_counter[PWRDM_MAX_PWRSTS];
114 unsigned ret_logic_off_counter; 121 unsigned ret_logic_off_counter;
@@ -162,7 +169,9 @@ struct pwrdm_ops {
162 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm); 169 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
163}; 170};
164 171
165void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs); 172int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs);
173int pwrdm_register_pwrdms(struct powerdomain **pwrdm_list);
174int pwrdm_complete_init(void);
166 175
167struct powerdomain *pwrdm_lookup(const char *name); 176struct powerdomain *pwrdm_lookup(const char *name);
168 177
@@ -176,6 +185,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
176int pwrdm_for_each_clkdm(struct powerdomain *pwrdm, 185int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
177 int (*fn)(struct powerdomain *pwrdm, 186 int (*fn)(struct powerdomain *pwrdm,
178 struct clockdomain *clkdm)); 187 struct clockdomain *clkdm));
188struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
179 189
180int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); 190int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
181 191
@@ -210,7 +220,8 @@ int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
210u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm); 220u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
211bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); 221bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
212 222
213extern void omap2xxx_powerdomains_init(void); 223extern void omap242x_powerdomains_init(void);
224extern void omap243x_powerdomains_init(void);
214extern void omap3xxx_powerdomains_init(void); 225extern void omap3xxx_powerdomains_init(void);
215extern void omap44xx_powerdomains_init(void); 226extern void omap44xx_powerdomains_init(void);
216 227
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
index cf600e22bf8e..6a17e4ca1d79 100644
--- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2 and OMAP3 powerdomain control 2 * OMAP2 and OMAP3 powerdomain control
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley 7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
index 4210c3399769..d3a5399091ad 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 common powerdomain definitions 2 * OMAP2/3 common powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
@@ -12,20 +12,6 @@
12 */ 12 */
13 13
14/* 14/*
15 * To Do List
16 * -> Move the Sleep/Wakeup dependencies from Power Domain framework to
17 * Clock Domain Framework
18 */
19
20/*
21 * This file contains all of the powerdomains that have some element
22 * of software control for the OMAP24xx and OMAP34xx chips.
23 *
24 * This is not an exhaustive listing of powerdomains on the chips; only
25 * powerdomains that can be controlled in software.
26 */
27
28/*
29 * The names for the DSP/IVA2 powerdomains are confusing. 15 * The names for the DSP/IVA2 powerdomains are confusing.
30 * 16 *
31 * Most OMAP chips have an on-board DSP. 17 * Most OMAP chips have an on-board DSP.
@@ -59,8 +45,6 @@
59struct powerdomain gfx_omap2_pwrdm = { 45struct powerdomain gfx_omap2_pwrdm = {
60 .name = "gfx_pwrdm", 46 .name = "gfx_pwrdm",
61 .prcm_offs = GFX_MOD, 47 .prcm_offs = GFX_MOD,
62 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
63 CHIP_IS_OMAP3430ES1),
64 .pwrsts = PWRSTS_OFF_RET_ON, 48 .pwrsts = PWRSTS_OFF_RET_ON,
65 .pwrsts_logic_ret = PWRSTS_RET, 49 .pwrsts_logic_ret = PWRSTS_RET,
66 .banks = 1, 50 .banks = 1,
@@ -70,11 +54,12 @@ struct powerdomain gfx_omap2_pwrdm = {
70 .pwrsts_mem_on = { 54 .pwrsts_mem_on = {
71 [0] = PWRSTS_ON, /* MEMONSTATE */ 55 [0] = PWRSTS_ON, /* MEMONSTATE */
72 }, 56 },
57 .voltdm = { .name = "core" },
73}; 58};
74 59
75struct powerdomain wkup_omap2_pwrdm = { 60struct powerdomain wkup_omap2_pwrdm = {
76 .name = "wkup_pwrdm", 61 .name = "wkup_pwrdm",
77 .prcm_offs = WKUP_MOD, 62 .prcm_offs = WKUP_MOD,
78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
79 .pwrsts = PWRSTS_ON, 63 .pwrsts = PWRSTS_ON,
64 .voltdm = { .name = "wakeup" },
80}; 65};
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_data.c
index cc389fb2005d..2385c1f009ee 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2XXX powerdomain definitions 2 * OMAP2XXX powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
@@ -28,7 +28,6 @@
28static struct powerdomain dsp_pwrdm = { 28static struct powerdomain dsp_pwrdm = {
29 .name = "dsp_pwrdm", 29 .name = "dsp_pwrdm",
30 .prcm_offs = OMAP24XX_DSP_MOD, 30 .prcm_offs = OMAP24XX_DSP_MOD,
31 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
32 .pwrsts = PWRSTS_OFF_RET_ON, 31 .pwrsts = PWRSTS_OFF_RET_ON,
33 .pwrsts_logic_ret = PWRSTS_RET, 32 .pwrsts_logic_ret = PWRSTS_RET,
34 .banks = 1, 33 .banks = 1,
@@ -38,12 +37,12 @@ static struct powerdomain dsp_pwrdm = {
38 .pwrsts_mem_on = { 37 .pwrsts_mem_on = {
39 [0] = PWRSTS_ON, 38 [0] = PWRSTS_ON,
40 }, 39 },
40 .voltdm = { .name = "core" },
41}; 41};
42 42
43static struct powerdomain mpu_24xx_pwrdm = { 43static struct powerdomain mpu_24xx_pwrdm = {
44 .name = "mpu_pwrdm", 44 .name = "mpu_pwrdm",
45 .prcm_offs = MPU_MOD, 45 .prcm_offs = MPU_MOD,
46 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
47 .pwrsts = PWRSTS_OFF_RET_ON, 46 .pwrsts = PWRSTS_OFF_RET_ON,
48 .pwrsts_logic_ret = PWRSTS_OFF_RET, 47 .pwrsts_logic_ret = PWRSTS_OFF_RET,
49 .banks = 1, 48 .banks = 1,
@@ -53,12 +52,12 @@ static struct powerdomain mpu_24xx_pwrdm = {
53 .pwrsts_mem_on = { 52 .pwrsts_mem_on = {
54 [0] = PWRSTS_ON, 53 [0] = PWRSTS_ON,
55 }, 54 },
55 .voltdm = { .name = "core" },
56}; 56};
57 57
58static struct powerdomain core_24xx_pwrdm = { 58static struct powerdomain core_24xx_pwrdm = {
59 .name = "core_pwrdm", 59 .name = "core_pwrdm",
60 .prcm_offs = CORE_MOD, 60 .prcm_offs = CORE_MOD,
61 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
62 .pwrsts = PWRSTS_OFF_RET_ON, 61 .pwrsts = PWRSTS_OFF_RET_ON,
63 .banks = 3, 62 .banks = 3,
64 .pwrsts_mem_ret = { 63 .pwrsts_mem_ret = {
@@ -71,6 +70,7 @@ static struct powerdomain core_24xx_pwrdm = {
71 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */ 70 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
72 [2] = PWRSTS_OFF_RET_ON, /* MEM3ONSTATE */ 71 [2] = PWRSTS_OFF_RET_ON, /* MEM3ONSTATE */
73 }, 72 },
73 .voltdm = { .name = "core" },
74}; 74};
75 75
76 76
@@ -78,14 +78,11 @@ static struct powerdomain core_24xx_pwrdm = {
78 * 2430-specific powerdomains 78 * 2430-specific powerdomains
79 */ 79 */
80 80
81#ifdef CONFIG_SOC_OMAP2430
82
83/* XXX 2430 KILLDOMAINWKUP bit? No current users apparently */ 81/* XXX 2430 KILLDOMAINWKUP bit? No current users apparently */
84 82
85static struct powerdomain mdm_pwrdm = { 83static struct powerdomain mdm_pwrdm = {
86 .name = "mdm_pwrdm", 84 .name = "mdm_pwrdm",
87 .prcm_offs = OMAP2430_MDM_MOD, 85 .prcm_offs = OMAP2430_MDM_MOD,
88 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
89 .pwrsts = PWRSTS_OFF_RET_ON, 86 .pwrsts = PWRSTS_OFF_RET_ON,
90 .pwrsts_logic_ret = PWRSTS_RET, 87 .pwrsts_logic_ret = PWRSTS_RET,
91 .banks = 1, 88 .banks = 1,
@@ -95,29 +92,44 @@ static struct powerdomain mdm_pwrdm = {
95 .pwrsts_mem_on = { 92 .pwrsts_mem_on = {
96 [0] = PWRSTS_ON, /* MEMONSTATE */ 93 [0] = PWRSTS_ON, /* MEMONSTATE */
97 }, 94 },
95 .voltdm = { .name = "core" },
98}; 96};
99 97
100#endif /* CONFIG_SOC_OMAP2430 */ 98/*
101 99 *
102/* As powerdomains are added or removed above, this list must also be changed */ 100 */
103static struct powerdomain *powerdomains_omap2xxx[] __initdata = {
104 101
102static struct powerdomain *powerdomains_omap24xx[] __initdata = {
105 &wkup_omap2_pwrdm, 103 &wkup_omap2_pwrdm,
106 &gfx_omap2_pwrdm, 104 &gfx_omap2_pwrdm,
107
108#ifdef CONFIG_ARCH_OMAP2
109 &dsp_pwrdm, 105 &dsp_pwrdm,
110 &mpu_24xx_pwrdm, 106 &mpu_24xx_pwrdm,
111 &core_24xx_pwrdm, 107 &core_24xx_pwrdm,
112#endif 108 NULL
109};
113 110
114#ifdef CONFIG_SOC_OMAP2430 111static struct powerdomain *powerdomains_omap2430[] __initdata = {
115 &mdm_pwrdm, 112 &mdm_pwrdm,
116#endif
117 NULL 113 NULL
118}; 114};
119 115
120void __init omap2xxx_powerdomains_init(void) 116void __init omap242x_powerdomains_init(void)
117{
118 if (!cpu_is_omap2420())
119 return;
120
121 pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
122 pwrdm_register_pwrdms(powerdomains_omap24xx);
123 pwrdm_complete_init();
124}
125
126void __init omap243x_powerdomains_init(void)
121{ 127{
122 pwrdm_init(powerdomains_omap2xxx, &omap2_pwrdm_operations); 128 if (!cpu_is_omap2430())
129 return;
130
131 pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
132 pwrdm_register_pwrdms(powerdomains_omap24xx);
133 pwrdm_register_pwrdms(powerdomains_omap2430);
134 pwrdm_complete_init();
123} 135}
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index 469a920a74dc..8ef26daeed68 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP3 powerdomain definitions 2 * OMAP3 powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
@@ -14,6 +14,8 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <plat/cpu.h>
18
17#include "powerdomain.h" 19#include "powerdomain.h"
18#include "powerdomains2xxx_3xxx_data.h" 20#include "powerdomains2xxx_3xxx_data.h"
19 21
@@ -27,8 +29,6 @@
27 * 34XX-specific powerdomains, dependencies 29 * 34XX-specific powerdomains, dependencies
28 */ 30 */
29 31
30#ifdef CONFIG_ARCH_OMAP3
31
32/* 32/*
33 * Powerdomains 33 * Powerdomains
34 */ 34 */
@@ -36,7 +36,6 @@
36static struct powerdomain iva2_pwrdm = { 36static struct powerdomain iva2_pwrdm = {
37 .name = "iva2_pwrdm", 37 .name = "iva2_pwrdm",
38 .prcm_offs = OMAP3430_IVA2_MOD, 38 .prcm_offs = OMAP3430_IVA2_MOD,
39 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
40 .pwrsts = PWRSTS_OFF_RET_ON, 39 .pwrsts = PWRSTS_OFF_RET_ON,
41 .pwrsts_logic_ret = PWRSTS_OFF_RET, 40 .pwrsts_logic_ret = PWRSTS_OFF_RET,
42 .banks = 4, 41 .banks = 4,
@@ -52,12 +51,12 @@ static struct powerdomain iva2_pwrdm = {
52 [2] = PWRSTS_OFF_ON, 51 [2] = PWRSTS_OFF_ON,
53 [3] = PWRSTS_ON, 52 [3] = PWRSTS_ON,
54 }, 53 },
54 .voltdm = { .name = "mpu_iva" },
55}; 55};
56 56
57static struct powerdomain mpu_3xxx_pwrdm = { 57static struct powerdomain mpu_3xxx_pwrdm = {
58 .name = "mpu_pwrdm", 58 .name = "mpu_pwrdm",
59 .prcm_offs = MPU_MOD, 59 .prcm_offs = MPU_MOD,
60 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
61 .pwrsts = PWRSTS_OFF_RET_ON, 60 .pwrsts = PWRSTS_OFF_RET_ON,
62 .pwrsts_logic_ret = PWRSTS_OFF_RET, 61 .pwrsts_logic_ret = PWRSTS_OFF_RET,
63 .flags = PWRDM_HAS_MPU_QUIRK, 62 .flags = PWRDM_HAS_MPU_QUIRK,
@@ -68,6 +67,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
68 .pwrsts_mem_on = { 67 .pwrsts_mem_on = {
69 [0] = PWRSTS_OFF_ON, 68 [0] = PWRSTS_OFF_ON,
70 }, 69 },
70 .voltdm = { .name = "mpu_iva" },
71}; 71};
72 72
73/* 73/*
@@ -83,10 +83,6 @@ static struct powerdomain mpu_3xxx_pwrdm = {
83static struct powerdomain core_3xxx_pre_es3_1_pwrdm = { 83static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
84 .name = "core_pwrdm", 84 .name = "core_pwrdm",
85 .prcm_offs = CORE_MOD, 85 .prcm_offs = CORE_MOD,
86 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1 |
87 CHIP_IS_OMAP3430ES2 |
88 CHIP_IS_OMAP3430ES3_0 |
89 CHIP_IS_OMAP3630ES1),
90 .pwrsts = PWRSTS_OFF_RET_ON, 86 .pwrsts = PWRSTS_OFF_RET_ON,
91 .pwrsts_logic_ret = PWRSTS_OFF_RET, 87 .pwrsts_logic_ret = PWRSTS_OFF_RET,
92 .banks = 2, 88 .banks = 2,
@@ -98,13 +94,12 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
98 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */ 94 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
99 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */ 95 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
100 }, 96 },
97 .voltdm = { .name = "core" },
101}; 98};
102 99
103static struct powerdomain core_3xxx_es3_1_pwrdm = { 100static struct powerdomain core_3xxx_es3_1_pwrdm = {
104 .name = "core_pwrdm", 101 .name = "core_pwrdm",
105 .prcm_offs = CORE_MOD, 102 .prcm_offs = CORE_MOD,
106 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1 |
107 CHIP_GE_OMAP3630ES1_1),
108 .pwrsts = PWRSTS_OFF_RET_ON, 103 .pwrsts = PWRSTS_OFF_RET_ON,
109 .pwrsts_logic_ret = PWRSTS_OFF_RET, 104 .pwrsts_logic_ret = PWRSTS_OFF_RET,
110 /* 105 /*
@@ -121,11 +116,11 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
121 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */ 116 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
122 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */ 117 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
123 }, 118 },
119 .voltdm = { .name = "core" },
124}; 120};
125 121
126static struct powerdomain dss_pwrdm = { 122static struct powerdomain dss_pwrdm = {
127 .name = "dss_pwrdm", 123 .name = "dss_pwrdm",
128 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
129 .prcm_offs = OMAP3430_DSS_MOD, 124 .prcm_offs = OMAP3430_DSS_MOD,
130 .pwrsts = PWRSTS_OFF_RET_ON, 125 .pwrsts = PWRSTS_OFF_RET_ON,
131 .pwrsts_logic_ret = PWRSTS_RET, 126 .pwrsts_logic_ret = PWRSTS_RET,
@@ -136,6 +131,7 @@ static struct powerdomain dss_pwrdm = {
136 .pwrsts_mem_on = { 131 .pwrsts_mem_on = {
137 [0] = PWRSTS_ON, /* MEMONSTATE */ 132 [0] = PWRSTS_ON, /* MEMONSTATE */
138 }, 133 },
134 .voltdm = { .name = "core" },
139}; 135};
140 136
141/* 137/*
@@ -146,7 +142,6 @@ static struct powerdomain dss_pwrdm = {
146static struct powerdomain sgx_pwrdm = { 142static struct powerdomain sgx_pwrdm = {
147 .name = "sgx_pwrdm", 143 .name = "sgx_pwrdm",
148 .prcm_offs = OMAP3430ES2_SGX_MOD, 144 .prcm_offs = OMAP3430ES2_SGX_MOD,
149 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
150 /* XXX This is accurate for 3430 SGX, but what about GFX? */ 145 /* XXX This is accurate for 3430 SGX, but what about GFX? */
151 .pwrsts = PWRSTS_OFF_ON, 146 .pwrsts = PWRSTS_OFF_ON,
152 .pwrsts_logic_ret = PWRSTS_RET, 147 .pwrsts_logic_ret = PWRSTS_RET,
@@ -157,11 +152,11 @@ static struct powerdomain sgx_pwrdm = {
157 .pwrsts_mem_on = { 152 .pwrsts_mem_on = {
158 [0] = PWRSTS_ON, /* MEMONSTATE */ 153 [0] = PWRSTS_ON, /* MEMONSTATE */
159 }, 154 },
155 .voltdm = { .name = "core" },
160}; 156};
161 157
162static struct powerdomain cam_pwrdm = { 158static struct powerdomain cam_pwrdm = {
163 .name = "cam_pwrdm", 159 .name = "cam_pwrdm",
164 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
165 .prcm_offs = OMAP3430_CAM_MOD, 160 .prcm_offs = OMAP3430_CAM_MOD,
166 .pwrsts = PWRSTS_OFF_RET_ON, 161 .pwrsts = PWRSTS_OFF_RET_ON,
167 .pwrsts_logic_ret = PWRSTS_RET, 162 .pwrsts_logic_ret = PWRSTS_RET,
@@ -172,12 +167,12 @@ static struct powerdomain cam_pwrdm = {
172 .pwrsts_mem_on = { 167 .pwrsts_mem_on = {
173 [0] = PWRSTS_ON, /* MEMONSTATE */ 168 [0] = PWRSTS_ON, /* MEMONSTATE */
174 }, 169 },
170 .voltdm = { .name = "core" },
175}; 171};
176 172
177static struct powerdomain per_pwrdm = { 173static struct powerdomain per_pwrdm = {
178 .name = "per_pwrdm", 174 .name = "per_pwrdm",
179 .prcm_offs = OMAP3430_PER_MOD, 175 .prcm_offs = OMAP3430_PER_MOD,
180 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
181 .pwrsts = PWRSTS_OFF_RET_ON, 176 .pwrsts = PWRSTS_OFF_RET_ON,
182 .pwrsts_logic_ret = PWRSTS_OFF_RET, 177 .pwrsts_logic_ret = PWRSTS_OFF_RET,
183 .banks = 1, 178 .banks = 1,
@@ -187,26 +182,26 @@ static struct powerdomain per_pwrdm = {
187 .pwrsts_mem_on = { 182 .pwrsts_mem_on = {
188 [0] = PWRSTS_ON, /* MEMONSTATE */ 183 [0] = PWRSTS_ON, /* MEMONSTATE */
189 }, 184 },
185 .voltdm = { .name = "core" },
190}; 186};
191 187
192static struct powerdomain emu_pwrdm = { 188static struct powerdomain emu_pwrdm = {
193 .name = "emu_pwrdm", 189 .name = "emu_pwrdm",
194 .prcm_offs = OMAP3430_EMU_MOD, 190 .prcm_offs = OMAP3430_EMU_MOD,
195 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 191 .voltdm = { .name = "core" },
196}; 192};
197 193
198static struct powerdomain neon_pwrdm = { 194static struct powerdomain neon_pwrdm = {
199 .name = "neon_pwrdm", 195 .name = "neon_pwrdm",
200 .prcm_offs = OMAP3430_NEON_MOD, 196 .prcm_offs = OMAP3430_NEON_MOD,
201 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
202 .pwrsts = PWRSTS_OFF_RET_ON, 197 .pwrsts = PWRSTS_OFF_RET_ON,
203 .pwrsts_logic_ret = PWRSTS_RET, 198 .pwrsts_logic_ret = PWRSTS_RET,
199 .voltdm = { .name = "mpu_iva" },
204}; 200};
205 201
206static struct powerdomain usbhost_pwrdm = { 202static struct powerdomain usbhost_pwrdm = {
207 .name = "usbhost_pwrdm", 203 .name = "usbhost_pwrdm",
208 .prcm_offs = OMAP3430ES2_USBHOST_MOD, 204 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
209 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
210 .pwrsts = PWRSTS_OFF_RET_ON, 205 .pwrsts = PWRSTS_OFF_RET_ON,
211 .pwrsts_logic_ret = PWRSTS_RET, 206 .pwrsts_logic_ret = PWRSTS_RET,
212 /* 207 /*
@@ -223,65 +218,103 @@ static struct powerdomain usbhost_pwrdm = {
223 .pwrsts_mem_on = { 218 .pwrsts_mem_on = {
224 [0] = PWRSTS_ON, /* MEMONSTATE */ 219 [0] = PWRSTS_ON, /* MEMONSTATE */
225 }, 220 },
221 .voltdm = { .name = "core" },
226}; 222};
227 223
228static struct powerdomain dpll1_pwrdm = { 224static struct powerdomain dpll1_pwrdm = {
229 .name = "dpll1_pwrdm", 225 .name = "dpll1_pwrdm",
230 .prcm_offs = MPU_MOD, 226 .prcm_offs = MPU_MOD,
231 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 227 .voltdm = { .name = "mpu_iva" },
232}; 228};
233 229
234static struct powerdomain dpll2_pwrdm = { 230static struct powerdomain dpll2_pwrdm = {
235 .name = "dpll2_pwrdm", 231 .name = "dpll2_pwrdm",
236 .prcm_offs = OMAP3430_IVA2_MOD, 232 .prcm_offs = OMAP3430_IVA2_MOD,
237 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 233 .voltdm = { .name = "mpu_iva" },
238}; 234};
239 235
240static struct powerdomain dpll3_pwrdm = { 236static struct powerdomain dpll3_pwrdm = {
241 .name = "dpll3_pwrdm", 237 .name = "dpll3_pwrdm",
242 .prcm_offs = PLL_MOD, 238 .prcm_offs = PLL_MOD,
243 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 239 .voltdm = { .name = "core" },
244}; 240};
245 241
246static struct powerdomain dpll4_pwrdm = { 242static struct powerdomain dpll4_pwrdm = {
247 .name = "dpll4_pwrdm", 243 .name = "dpll4_pwrdm",
248 .prcm_offs = PLL_MOD, 244 .prcm_offs = PLL_MOD,
249 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 245 .voltdm = { .name = "core" },
250}; 246};
251 247
252static struct powerdomain dpll5_pwrdm = { 248static struct powerdomain dpll5_pwrdm = {
253 .name = "dpll5_pwrdm", 249 .name = "dpll5_pwrdm",
254 .prcm_offs = PLL_MOD, 250 .prcm_offs = PLL_MOD,
255 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), 251 .voltdm = { .name = "core" },
256}; 252};
257 253
258/* As powerdomains are added or removed above, this list must also be changed */ 254/* As powerdomains are added or removed above, this list must also be changed */
259static struct powerdomain *powerdomains_omap3xxx[] __initdata = { 255static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
260
261 &wkup_omap2_pwrdm, 256 &wkup_omap2_pwrdm,
262 &gfx_omap2_pwrdm,
263 &iva2_pwrdm, 257 &iva2_pwrdm,
264 &mpu_3xxx_pwrdm, 258 &mpu_3xxx_pwrdm,
265 &neon_pwrdm, 259 &neon_pwrdm,
266 &core_3xxx_pre_es3_1_pwrdm,
267 &core_3xxx_es3_1_pwrdm,
268 &cam_pwrdm, 260 &cam_pwrdm,
269 &dss_pwrdm, 261 &dss_pwrdm,
270 &per_pwrdm, 262 &per_pwrdm,
271 &emu_pwrdm, 263 &emu_pwrdm,
272 &sgx_pwrdm,
273 &usbhost_pwrdm,
274 &dpll1_pwrdm, 264 &dpll1_pwrdm,
275 &dpll2_pwrdm, 265 &dpll2_pwrdm,
276 &dpll3_pwrdm, 266 &dpll3_pwrdm,
277 &dpll4_pwrdm, 267 &dpll4_pwrdm,
268 NULL
269};
270
271static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
272 &gfx_omap2_pwrdm,
273 &core_3xxx_pre_es3_1_pwrdm,
274 NULL
275};
276
277/* also includes 3630ES1.0 */
278static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
279 &core_3xxx_pre_es3_1_pwrdm,
280 &sgx_pwrdm,
281 &usbhost_pwrdm,
278 &dpll5_pwrdm, 282 &dpll5_pwrdm,
279#endif
280 NULL 283 NULL
281}; 284};
282 285
286/* also includes 3630ES1.1+ */
287static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
288 &core_3xxx_es3_1_pwrdm,
289 &sgx_pwrdm,
290 &usbhost_pwrdm,
291 &dpll5_pwrdm,
292 NULL
293};
283 294
284void __init omap3xxx_powerdomains_init(void) 295void __init omap3xxx_powerdomains_init(void)
285{ 296{
286 pwrdm_init(powerdomains_omap3xxx, &omap3_pwrdm_operations); 297 unsigned int rev;
298
299 if (!cpu_is_omap34xx())
300 return;
301
302 pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
303 pwrdm_register_pwrdms(powerdomains_omap3430_common);
304
305 rev = omap_rev();
306
307 if (rev == OMAP3430_REV_ES1_0)
308 pwrdm_register_pwrdms(powerdomains_omap3430es1);
309 else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
310 rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
311 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
312 else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
313 rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
314 rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
315 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
316 else
317 WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
318
319 pwrdm_complete_init();
287} 320}
diff --git a/arch/arm/mach-omap2/powerdomains44xx_data.c b/arch/arm/mach-omap2/powerdomains44xx_data.c
index 247e79495115..704664c0e259 100644
--- a/arch/arm/mach-omap2/powerdomains44xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains44xx_data.c
@@ -33,9 +33,9 @@
33/* core_44xx_pwrdm: CORE power domain */ 33/* core_44xx_pwrdm: CORE power domain */
34static struct powerdomain core_44xx_pwrdm = { 34static struct powerdomain core_44xx_pwrdm = {
35 .name = "core_pwrdm", 35 .name = "core_pwrdm",
36 .voltdm = { .name = "core" },
36 .prcm_offs = OMAP4430_PRM_CORE_INST, 37 .prcm_offs = OMAP4430_PRM_CORE_INST,
37 .prcm_partition = OMAP4430_PRM_PARTITION, 38 .prcm_partition = OMAP4430_PRM_PARTITION,
38 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
39 .pwrsts = PWRSTS_RET_ON, 39 .pwrsts = PWRSTS_RET_ON,
40 .pwrsts_logic_ret = PWRSTS_OFF_RET, 40 .pwrsts_logic_ret = PWRSTS_OFF_RET,
41 .banks = 5, 41 .banks = 5,
@@ -59,9 +59,9 @@ static struct powerdomain core_44xx_pwrdm = {
59/* gfx_44xx_pwrdm: 3D accelerator power domain */ 59/* gfx_44xx_pwrdm: 3D accelerator power domain */
60static struct powerdomain gfx_44xx_pwrdm = { 60static struct powerdomain gfx_44xx_pwrdm = {
61 .name = "gfx_pwrdm", 61 .name = "gfx_pwrdm",
62 .voltdm = { .name = "core" },
62 .prcm_offs = OMAP4430_PRM_GFX_INST, 63 .prcm_offs = OMAP4430_PRM_GFX_INST,
63 .prcm_partition = OMAP4430_PRM_PARTITION, 64 .prcm_partition = OMAP4430_PRM_PARTITION,
64 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
65 .pwrsts = PWRSTS_OFF_ON, 65 .pwrsts = PWRSTS_OFF_ON,
66 .banks = 1, 66 .banks = 1,
67 .pwrsts_mem_ret = { 67 .pwrsts_mem_ret = {
@@ -76,9 +76,9 @@ static struct powerdomain gfx_44xx_pwrdm = {
76/* abe_44xx_pwrdm: Audio back end power domain */ 76/* abe_44xx_pwrdm: Audio back end power domain */
77static struct powerdomain abe_44xx_pwrdm = { 77static struct powerdomain abe_44xx_pwrdm = {
78 .name = "abe_pwrdm", 78 .name = "abe_pwrdm",
79 .voltdm = { .name = "iva" },
79 .prcm_offs = OMAP4430_PRM_ABE_INST, 80 .prcm_offs = OMAP4430_PRM_ABE_INST,
80 .prcm_partition = OMAP4430_PRM_PARTITION, 81 .prcm_partition = OMAP4430_PRM_PARTITION,
81 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
82 .pwrsts = PWRSTS_OFF_RET_ON, 82 .pwrsts = PWRSTS_OFF_RET_ON,
83 .pwrsts_logic_ret = PWRSTS_OFF, 83 .pwrsts_logic_ret = PWRSTS_OFF,
84 .banks = 2, 84 .banks = 2,
@@ -96,9 +96,9 @@ static struct powerdomain abe_44xx_pwrdm = {
96/* dss_44xx_pwrdm: Display subsystem power domain */ 96/* dss_44xx_pwrdm: Display subsystem power domain */
97static struct powerdomain dss_44xx_pwrdm = { 97static struct powerdomain dss_44xx_pwrdm = {
98 .name = "dss_pwrdm", 98 .name = "dss_pwrdm",
99 .voltdm = { .name = "core" },
99 .prcm_offs = OMAP4430_PRM_DSS_INST, 100 .prcm_offs = OMAP4430_PRM_DSS_INST,
100 .prcm_partition = OMAP4430_PRM_PARTITION, 101 .prcm_partition = OMAP4430_PRM_PARTITION,
101 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
102 .pwrsts = PWRSTS_OFF_RET_ON, 102 .pwrsts = PWRSTS_OFF_RET_ON,
103 .pwrsts_logic_ret = PWRSTS_OFF, 103 .pwrsts_logic_ret = PWRSTS_OFF,
104 .banks = 1, 104 .banks = 1,
@@ -114,9 +114,9 @@ static struct powerdomain dss_44xx_pwrdm = {
114/* tesla_44xx_pwrdm: Tesla processor power domain */ 114/* tesla_44xx_pwrdm: Tesla processor power domain */
115static struct powerdomain tesla_44xx_pwrdm = { 115static struct powerdomain tesla_44xx_pwrdm = {
116 .name = "tesla_pwrdm", 116 .name = "tesla_pwrdm",
117 .voltdm = { .name = "iva" },
117 .prcm_offs = OMAP4430_PRM_TESLA_INST, 118 .prcm_offs = OMAP4430_PRM_TESLA_INST,
118 .prcm_partition = OMAP4430_PRM_PARTITION, 119 .prcm_partition = OMAP4430_PRM_PARTITION,
119 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
120 .pwrsts = PWRSTS_OFF_RET_ON, 120 .pwrsts = PWRSTS_OFF_RET_ON,
121 .pwrsts_logic_ret = PWRSTS_OFF_RET, 121 .pwrsts_logic_ret = PWRSTS_OFF_RET,
122 .banks = 3, 122 .banks = 3,
@@ -136,9 +136,9 @@ static struct powerdomain tesla_44xx_pwrdm = {
136/* wkup_44xx_pwrdm: Wake-up power domain */ 136/* wkup_44xx_pwrdm: Wake-up power domain */
137static struct powerdomain wkup_44xx_pwrdm = { 137static struct powerdomain wkup_44xx_pwrdm = {
138 .name = "wkup_pwrdm", 138 .name = "wkup_pwrdm",
139 .voltdm = { .name = "wakeup" },
139 .prcm_offs = OMAP4430_PRM_WKUP_INST, 140 .prcm_offs = OMAP4430_PRM_WKUP_INST,
140 .prcm_partition = OMAP4430_PRM_PARTITION, 141 .prcm_partition = OMAP4430_PRM_PARTITION,
141 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
142 .pwrsts = PWRSTS_ON, 142 .pwrsts = PWRSTS_ON,
143 .banks = 1, 143 .banks = 1,
144 .pwrsts_mem_ret = { 144 .pwrsts_mem_ret = {
@@ -152,9 +152,9 @@ static struct powerdomain wkup_44xx_pwrdm = {
152/* cpu0_44xx_pwrdm: MPU0 processor and Neon coprocessor power domain */ 152/* cpu0_44xx_pwrdm: MPU0 processor and Neon coprocessor power domain */
153static struct powerdomain cpu0_44xx_pwrdm = { 153static struct powerdomain cpu0_44xx_pwrdm = {
154 .name = "cpu0_pwrdm", 154 .name = "cpu0_pwrdm",
155 .voltdm = { .name = "mpu" },
155 .prcm_offs = OMAP4430_PRCM_MPU_CPU0_INST, 156 .prcm_offs = OMAP4430_PRCM_MPU_CPU0_INST,
156 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION, 157 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
157 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
158 .pwrsts = PWRSTS_OFF_RET_ON, 158 .pwrsts = PWRSTS_OFF_RET_ON,
159 .pwrsts_logic_ret = PWRSTS_OFF_RET, 159 .pwrsts_logic_ret = PWRSTS_OFF_RET,
160 .banks = 1, 160 .banks = 1,
@@ -169,9 +169,9 @@ static struct powerdomain cpu0_44xx_pwrdm = {
169/* cpu1_44xx_pwrdm: MPU1 processor and Neon coprocessor power domain */ 169/* cpu1_44xx_pwrdm: MPU1 processor and Neon coprocessor power domain */
170static struct powerdomain cpu1_44xx_pwrdm = { 170static struct powerdomain cpu1_44xx_pwrdm = {
171 .name = "cpu1_pwrdm", 171 .name = "cpu1_pwrdm",
172 .voltdm = { .name = "mpu" },
172 .prcm_offs = OMAP4430_PRCM_MPU_CPU1_INST, 173 .prcm_offs = OMAP4430_PRCM_MPU_CPU1_INST,
173 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION, 174 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
174 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
175 .pwrsts = PWRSTS_OFF_RET_ON, 175 .pwrsts = PWRSTS_OFF_RET_ON,
176 .pwrsts_logic_ret = PWRSTS_OFF_RET, 176 .pwrsts_logic_ret = PWRSTS_OFF_RET,
177 .banks = 1, 177 .banks = 1,
@@ -186,9 +186,9 @@ static struct powerdomain cpu1_44xx_pwrdm = {
186/* emu_44xx_pwrdm: Emulation power domain */ 186/* emu_44xx_pwrdm: Emulation power domain */
187static struct powerdomain emu_44xx_pwrdm = { 187static struct powerdomain emu_44xx_pwrdm = {
188 .name = "emu_pwrdm", 188 .name = "emu_pwrdm",
189 .voltdm = { .name = "wakeup" },
189 .prcm_offs = OMAP4430_PRM_EMU_INST, 190 .prcm_offs = OMAP4430_PRM_EMU_INST,
190 .prcm_partition = OMAP4430_PRM_PARTITION, 191 .prcm_partition = OMAP4430_PRM_PARTITION,
191 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
192 .pwrsts = PWRSTS_OFF_ON, 192 .pwrsts = PWRSTS_OFF_ON,
193 .banks = 1, 193 .banks = 1,
194 .pwrsts_mem_ret = { 194 .pwrsts_mem_ret = {
@@ -202,9 +202,9 @@ static struct powerdomain emu_44xx_pwrdm = {
202/* mpu_44xx_pwrdm: Modena processor and the Neon coprocessor power domain */ 202/* mpu_44xx_pwrdm: Modena processor and the Neon coprocessor power domain */
203static struct powerdomain mpu_44xx_pwrdm = { 203static struct powerdomain mpu_44xx_pwrdm = {
204 .name = "mpu_pwrdm", 204 .name = "mpu_pwrdm",
205 .voltdm = { .name = "mpu" },
205 .prcm_offs = OMAP4430_PRM_MPU_INST, 206 .prcm_offs = OMAP4430_PRM_MPU_INST,
206 .prcm_partition = OMAP4430_PRM_PARTITION, 207 .prcm_partition = OMAP4430_PRM_PARTITION,
207 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
208 .pwrsts = PWRSTS_RET_ON, 208 .pwrsts = PWRSTS_RET_ON,
209 .pwrsts_logic_ret = PWRSTS_OFF_RET, 209 .pwrsts_logic_ret = PWRSTS_OFF_RET,
210 .banks = 3, 210 .banks = 3,
@@ -223,9 +223,9 @@ static struct powerdomain mpu_44xx_pwrdm = {
223/* ivahd_44xx_pwrdm: IVA-HD power domain */ 223/* ivahd_44xx_pwrdm: IVA-HD power domain */
224static struct powerdomain ivahd_44xx_pwrdm = { 224static struct powerdomain ivahd_44xx_pwrdm = {
225 .name = "ivahd_pwrdm", 225 .name = "ivahd_pwrdm",
226 .voltdm = { .name = "iva" },
226 .prcm_offs = OMAP4430_PRM_IVAHD_INST, 227 .prcm_offs = OMAP4430_PRM_IVAHD_INST,
227 .prcm_partition = OMAP4430_PRM_PARTITION, 228 .prcm_partition = OMAP4430_PRM_PARTITION,
228 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
229 .pwrsts = PWRSTS_OFF_RET_ON, 229 .pwrsts = PWRSTS_OFF_RET_ON,
230 .pwrsts_logic_ret = PWRSTS_OFF, 230 .pwrsts_logic_ret = PWRSTS_OFF,
231 .banks = 4, 231 .banks = 4,
@@ -247,9 +247,9 @@ static struct powerdomain ivahd_44xx_pwrdm = {
247/* cam_44xx_pwrdm: Camera subsystem power domain */ 247/* cam_44xx_pwrdm: Camera subsystem power domain */
248static struct powerdomain cam_44xx_pwrdm = { 248static struct powerdomain cam_44xx_pwrdm = {
249 .name = "cam_pwrdm", 249 .name = "cam_pwrdm",
250 .voltdm = { .name = "core" },
250 .prcm_offs = OMAP4430_PRM_CAM_INST, 251 .prcm_offs = OMAP4430_PRM_CAM_INST,
251 .prcm_partition = OMAP4430_PRM_PARTITION, 252 .prcm_partition = OMAP4430_PRM_PARTITION,
252 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
253 .pwrsts = PWRSTS_OFF_ON, 253 .pwrsts = PWRSTS_OFF_ON,
254 .banks = 1, 254 .banks = 1,
255 .pwrsts_mem_ret = { 255 .pwrsts_mem_ret = {
@@ -264,9 +264,9 @@ static struct powerdomain cam_44xx_pwrdm = {
264/* l3init_44xx_pwrdm: L3 initators pheripherals power domain */ 264/* l3init_44xx_pwrdm: L3 initators pheripherals power domain */
265static struct powerdomain l3init_44xx_pwrdm = { 265static struct powerdomain l3init_44xx_pwrdm = {
266 .name = "l3init_pwrdm", 266 .name = "l3init_pwrdm",
267 .voltdm = { .name = "core" },
267 .prcm_offs = OMAP4430_PRM_L3INIT_INST, 268 .prcm_offs = OMAP4430_PRM_L3INIT_INST,
268 .prcm_partition = OMAP4430_PRM_PARTITION, 269 .prcm_partition = OMAP4430_PRM_PARTITION,
269 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
270 .pwrsts = PWRSTS_RET_ON, 270 .pwrsts = PWRSTS_RET_ON,
271 .pwrsts_logic_ret = PWRSTS_OFF_RET, 271 .pwrsts_logic_ret = PWRSTS_OFF_RET,
272 .banks = 1, 272 .banks = 1,
@@ -282,9 +282,9 @@ static struct powerdomain l3init_44xx_pwrdm = {
282/* l4per_44xx_pwrdm: Target peripherals power domain */ 282/* l4per_44xx_pwrdm: Target peripherals power domain */
283static struct powerdomain l4per_44xx_pwrdm = { 283static struct powerdomain l4per_44xx_pwrdm = {
284 .name = "l4per_pwrdm", 284 .name = "l4per_pwrdm",
285 .voltdm = { .name = "core" },
285 .prcm_offs = OMAP4430_PRM_L4PER_INST, 286 .prcm_offs = OMAP4430_PRM_L4PER_INST,
286 .prcm_partition = OMAP4430_PRM_PARTITION, 287 .prcm_partition = OMAP4430_PRM_PARTITION,
287 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
288 .pwrsts = PWRSTS_RET_ON, 288 .pwrsts = PWRSTS_RET_ON,
289 .pwrsts_logic_ret = PWRSTS_OFF_RET, 289 .pwrsts_logic_ret = PWRSTS_OFF_RET,
290 .banks = 2, 290 .banks = 2,
@@ -305,18 +305,18 @@ static struct powerdomain l4per_44xx_pwrdm = {
305 */ 305 */
306static struct powerdomain always_on_core_44xx_pwrdm = { 306static struct powerdomain always_on_core_44xx_pwrdm = {
307 .name = "always_on_core_pwrdm", 307 .name = "always_on_core_pwrdm",
308 .voltdm = { .name = "core" },
308 .prcm_offs = OMAP4430_PRM_ALWAYS_ON_INST, 309 .prcm_offs = OMAP4430_PRM_ALWAYS_ON_INST,
309 .prcm_partition = OMAP4430_PRM_PARTITION, 310 .prcm_partition = OMAP4430_PRM_PARTITION,
310 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
311 .pwrsts = PWRSTS_ON, 311 .pwrsts = PWRSTS_ON,
312}; 312};
313 313
314/* cefuse_44xx_pwrdm: Customer efuse controller power domain */ 314/* cefuse_44xx_pwrdm: Customer efuse controller power domain */
315static struct powerdomain cefuse_44xx_pwrdm = { 315static struct powerdomain cefuse_44xx_pwrdm = {
316 .name = "cefuse_pwrdm", 316 .name = "cefuse_pwrdm",
317 .voltdm = { .name = "core" },
317 .prcm_offs = OMAP4430_PRM_CEFUSE_INST, 318 .prcm_offs = OMAP4430_PRM_CEFUSE_INST,
318 .prcm_partition = OMAP4430_PRM_PARTITION, 319 .prcm_partition = OMAP4430_PRM_PARTITION,
319 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
320 .pwrsts = PWRSTS_OFF_ON, 320 .pwrsts = PWRSTS_OFF_ON,
321 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 321 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
322}; 322};
@@ -352,5 +352,7 @@ static struct powerdomain *powerdomains_omap44xx[] __initdata = {
352 352
353void __init omap44xx_powerdomains_init(void) 353void __init omap44xx_powerdomains_init(void)
354{ 354{
355 pwrdm_init(powerdomains_omap44xx, &omap4_pwrdm_operations); 355 pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
356 pwrdm_register_pwrdms(powerdomains_omap44xx);
357 pwrdm_complete_init();
356} 358}
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 2e40a5cf0163..8db5f035eb0a 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -151,17 +151,10 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
151 151
152void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) 152void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
153{ 153{
154 /* Static mapping, never released */ 154 if (omap2_globals->prm)
155 if (omap2_globals->prm) { 155 prm_base = omap2_globals->prm;
156 prm_base = ioremap(omap2_globals->prm, SZ_8K); 156 if (omap2_globals->cm)
157 WARN_ON(!prm_base); 157 cm_base = omap2_globals->cm;
158 } 158 if (omap2_globals->cm2)
159 if (omap2_globals->cm) { 159 cm2_base = omap2_globals->cm2;
160 cm_base = ioremap(omap2_globals->cm, SZ_8K);
161 WARN_ON(!cm_base);
162 }
163 if (omap2_globals->cm2) {
164 cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
165 WARN_ON(!cm2_base);
166 }
167} 160}
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 051213fbc346..f02d87f68e54 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -20,6 +20,8 @@
20#include <plat/cpu.h> 20#include <plat/cpu.h>
21#include <plat/prcm.h> 21#include <plat/prcm.h>
22 22
23#include "vp.h"
24
23#include "prm2xxx_3xxx.h" 25#include "prm2xxx_3xxx.h"
24#include "cm2xxx_3xxx.h" 26#include "cm2xxx_3xxx.h"
25#include "prm-regbits-24xx.h" 27#include "prm-regbits-24xx.h"
@@ -156,3 +158,57 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
156 158
157 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 159 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
158} 160}
161
162/* PRM VP */
163
164/*
165 * struct omap3_vp - OMAP3 VP register access description.
166 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
167 */
168struct omap3_vp {
169 u32 tranxdone_status;
170};
171
172static struct omap3_vp omap3_vp[] = {
173 [OMAP3_VP_VDD_MPU_ID] = {
174 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
175 },
176 [OMAP3_VP_VDD_CORE_ID] = {
177 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
178 },
179};
180
181#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
182
183u32 omap3_prm_vp_check_txdone(u8 vp_id)
184{
185 struct omap3_vp *vp = &omap3_vp[vp_id];
186 u32 irqstatus;
187
188 irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
189 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
190 return irqstatus & vp->tranxdone_status;
191}
192
193void omap3_prm_vp_clear_txdone(u8 vp_id)
194{
195 struct omap3_vp *vp = &omap3_vp[vp_id];
196
197 omap2_prm_write_mod_reg(vp->tranxdone_status,
198 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
199}
200
201u32 omap3_prm_vcvp_read(u8 offset)
202{
203 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
204}
205
206void omap3_prm_vcvp_write(u32 val, u8 offset)
207{
208 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
209}
210
211u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
212{
213 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
214}
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index a1fc62a39dbb..cef533df0861 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -303,7 +303,19 @@ extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
303extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 303extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
304extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 304extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
305 305
306/* OMAP3-specific VP functions */
307u32 omap3_prm_vp_check_txdone(u8 vp_id);
308void omap3_prm_vp_clear_txdone(u8 vp_id);
309
310/*
311 * OMAP3 access functions for voltage controller (VC) and
312 * voltage proccessor (VP) in the PRM.
313 */
314extern u32 omap3_prm_vcvp_read(u8 offset);
315extern void omap3_prm_vcvp_write(u32 val, u8 offset);
316extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
306#endif /* CONFIG_ARCH_OMAP4 */ 317#endif /* CONFIG_ARCH_OMAP4 */
318
307#endif 319#endif
308 320
309/* 321/*
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 00165558fc4d..495a31a7e8a7 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -21,8 +21,11 @@
21#include <plat/cpu.h> 21#include <plat/cpu.h>
22#include <plat/prcm.h> 22#include <plat/prcm.h>
23 23
24#include "vp.h"
24#include "prm44xx.h" 25#include "prm44xx.h"
25#include "prm-regbits-44xx.h" 26#include "prm-regbits-44xx.h"
27#include "prcm44xx.h"
28#include "prminst44xx.h"
26 29
27/* PRM low-level functions */ 30/* PRM low-level functions */
28 31
@@ -50,3 +53,71 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
50 53
51 return v; 54 return v;
52} 55}
56
57/* PRM VP */
58
59/*
60 * struct omap4_vp - OMAP4 VP register access description.
61 * @irqstatus_mpu: offset to IRQSTATUS_MPU register for VP
62 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
63 */
64struct omap4_vp {
65 u32 irqstatus_mpu;
66 u32 tranxdone_status;
67};
68
69static struct omap4_vp omap4_vp[] = {
70 [OMAP4_VP_VDD_MPU_ID] = {
71 .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
72 .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
73 },
74 [OMAP4_VP_VDD_IVA_ID] = {
75 .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
76 .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
77 },
78 [OMAP4_VP_VDD_CORE_ID] = {
79 .irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
80 .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
81 },
82};
83
84u32 omap4_prm_vp_check_txdone(u8 vp_id)
85{
86 struct omap4_vp *vp = &omap4_vp[vp_id];
87 u32 irqstatus;
88
89 irqstatus = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
90 OMAP4430_PRM_OCP_SOCKET_INST,
91 vp->irqstatus_mpu);
92 return irqstatus & vp->tranxdone_status;
93}
94
95void omap4_prm_vp_clear_txdone(u8 vp_id)
96{
97 struct omap4_vp *vp = &omap4_vp[vp_id];
98
99 omap4_prminst_write_inst_reg(vp->tranxdone_status,
100 OMAP4430_PRM_PARTITION,
101 OMAP4430_PRM_OCP_SOCKET_INST,
102 vp->irqstatus_mpu);
103};
104
105u32 omap4_prm_vcvp_read(u8 offset)
106{
107 return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
108 OMAP4430_PRM_DEVICE_INST, offset);
109}
110
111void omap4_prm_vcvp_write(u32 val, u8 offset)
112{
113 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION,
114 OMAP4430_PRM_DEVICE_INST, offset);
115}
116
117u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
118{
119 return omap4_prminst_rmw_inst_reg_bits(mask, bits,
120 OMAP4430_PRM_PARTITION,
121 OMAP4430_PRM_DEVICE_INST,
122 offset);
123}
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 7dfa379b625d..3d66ccd849d2 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -751,6 +751,18 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
751extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx); 751extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
752extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx); 752extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
753 753
754/* OMAP4-specific VP functions */
755u32 omap4_prm_vp_check_txdone(u8 vp_id);
756void omap4_prm_vp_clear_txdone(u8 vp_id);
757
758/*
759 * OMAP4 access functions for voltage controller (VC) and
760 * voltage proccessor (VP) in the PRM.
761 */
762extern u32 omap4_prm_vcvp_read(u8 offset);
763extern void omap4_prm_vcvp_write(u32 val, u8 offset);
764extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
765
754# endif 766# endif
755 767
756#endif 768#endif
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index da6f3a63b5d5..8f2782874771 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -117,15 +117,10 @@ int omap2_sdrc_get_params(unsigned long r,
117 117
118void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 118void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
119{ 119{
120 /* Static mapping, never released */ 120 if (omap2_globals->sdrc)
121 if (omap2_globals->sdrc) { 121 omap2_sdrc_base = omap2_globals->sdrc;
122 omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K); 122 if (omap2_globals->sms)
123 WARN_ON(!omap2_sdrc_base); 123 omap2_sms_base = omap2_globals->sms;
124 }
125 if (omap2_globals->sms) {
126 omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
127 WARN_ON(!omap2_sms_base);
128 }
129} 124}
130 125
131/** 126/**
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 466fc722fa0f..9992dbfdfdb3 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -107,28 +107,6 @@ struct omap_uart_state {
107static LIST_HEAD(uart_list); 107static LIST_HEAD(uart_list);
108static u8 num_uarts; 108static u8 num_uarts;
109 109
110static int uart_idle_hwmod(struct omap_device *od)
111{
112 omap_hwmod_idle(od->hwmods[0]);
113
114 return 0;
115}
116
117static int uart_enable_hwmod(struct omap_device *od)
118{
119 omap_hwmod_enable(od->hwmods[0]);
120
121 return 0;
122}
123
124static struct omap_device_pm_latency omap_uart_latency[] = {
125 {
126 .deactivate_func = uart_idle_hwmod,
127 .activate_func = uart_enable_hwmod,
128 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
129 },
130};
131
132static inline unsigned int __serial_read_reg(struct uart_port *up, 110static inline unsigned int __serial_read_reg(struct uart_port *up,
133 int offset) 111 int offset)
134{ 112{
@@ -711,7 +689,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
711{ 689{
712 struct omap_uart_state *uart; 690 struct omap_uart_state *uart;
713 struct omap_hwmod *oh; 691 struct omap_hwmod *oh;
714 struct omap_device *od; 692 struct platform_device *pdev;
715 void *pdata = NULL; 693 void *pdata = NULL;
716 u32 pdata_size = 0; 694 u32 pdata_size = 0;
717 char *name; 695 char *name;
@@ -799,20 +777,19 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
799 if (WARN_ON(!oh)) 777 if (WARN_ON(!oh))
800 return; 778 return;
801 779
802 od = omap_device_build(name, uart->num, oh, pdata, pdata_size, 780 pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
803 omap_uart_latency, 781 NULL, 0, false);
804 ARRAY_SIZE(omap_uart_latency), false); 782 WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
805 WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n",
806 name, oh->name); 783 name, oh->name);
807 784
808 omap_device_disable_idle_on_suspend(od); 785 omap_device_disable_idle_on_suspend(pdev);
809 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); 786 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
810 787
811 uart->irq = oh->mpu_irqs[0].irq; 788 uart->irq = oh->mpu_irqs[0].irq;
812 uart->regshift = 2; 789 uart->regshift = 2;
813 uart->mapbase = oh->slaves[0]->addr->pa_start; 790 uart->mapbase = oh->slaves[0]->addr->pa_start;
814 uart->membase = omap_hwmod_get_mpu_rt_va(oh); 791 uart->membase = omap_hwmod_get_mpu_rt_va(oh);
815 uart->pdev = &od->pdev; 792 uart->pdev = pdev;
816 793
817 oh->dev_attr = uart; 794 oh->dev_attr = uart;
818 795
@@ -846,8 +823,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
846 823
847 if ((cpu_is_omap34xx() && uart->padconf) || 824 if ((cpu_is_omap34xx() && uart->padconf) ||
848 (uart->wk_en && uart->wk_mask)) { 825 (uart->wk_en && uart->wk_mask)) {
849 device_init_wakeup(&od->pdev.dev, true); 826 device_init_wakeup(&pdev->dev, true);
850 DEV_CREATE_FILE(&od->pdev.dev, &dev_attr_sleep_timeout); 827 DEV_CREATE_FILE(&pdev->dev, &dev_attr_sleep_timeout);
851 } 828 }
852 829
853 /* Enable the MDR1 errata for OMAP3 */ 830 /* Enable the MDR1 errata for OMAP3 */
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index f438cf4d847b..53d9d0a5b39d 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -15,7 +15,7 @@
15 15
16static int sr_class3_enable(struct voltagedomain *voltdm) 16static int sr_class3_enable(struct voltagedomain *voltdm)
17{ 17{
18 unsigned long volt = omap_voltage_get_nom_volt(voltdm); 18 unsigned long volt = voltdm_get_voltage(voltdm);
19 19
20 if (!volt) { 20 if (!volt) {
21 pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n", 21 pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
@@ -32,7 +32,7 @@ static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
32 omap_vp_disable(voltdm); 32 omap_vp_disable(voltdm);
33 sr_disable(voltdm); 33 sr_disable(voltdm);
34 if (is_volt_reset) 34 if (is_volt_reset)
35 omap_voltage_reset(voltdm); 35 voltdm_reset(voltdm);
36 36
37 return 0; 37 return 0;
38} 38}
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 34c01a7de810..bb606c9709b2 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
62 62
63static struct omap_sr_class_data *sr_class; 63static struct omap_sr_class_data *sr_class;
64static struct omap_sr_pmic_data *sr_pmic_data; 64static struct omap_sr_pmic_data *sr_pmic_data;
65static struct dentry *sr_dbg_dir;
65 66
66static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value) 67static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
67{ 68{
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev)
826 struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); 827 struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
827 struct omap_sr_data *pdata = pdev->dev.platform_data; 828 struct omap_sr_data *pdata = pdev->dev.platform_data;
828 struct resource *mem, *irq; 829 struct resource *mem, *irq;
829 struct dentry *vdd_dbg_dir, *nvalue_dir; 830 struct dentry *nvalue_dir;
830 struct omap_volt_data *volt_data; 831 struct omap_volt_data *volt_data;
831 int i, ret = 0; 832 int i, ret = 0;
833 char *name;
832 834
833 if (!sr_info) { 835 if (!sr_info) {
834 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", 836 dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
899 } 901 }
900 902
901 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); 903 dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
904 if (!sr_dbg_dir) {
905 sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
906 if (!sr_dbg_dir) {
907 ret = PTR_ERR(sr_dbg_dir);
908 pr_err("%s:sr debugfs dir creation failed(%d)\n",
909 __func__, ret);
910 goto err_iounmap;
911 }
912 }
902 913
903 /* 914 name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
904 * If the voltage domain debugfs directory is not created, do 915 if (!name) {
905 * not try to create rest of the debugfs entries. 916 dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n",
906 */ 917 __func__);
907 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); 918 ret = -ENOMEM;
908 if (!vdd_dbg_dir) {
909 ret = -EINVAL;
910 goto err_iounmap; 919 goto err_iounmap;
911 } 920 }
912 921 sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
913 sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); 922 kfree(name);
914 if (IS_ERR(sr_info->dbg_dir)) { 923 if (IS_ERR(sr_info->dbg_dir)) {
915 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 924 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
916 __func__); 925 __func__);
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 10d3c5ee8018..9f43fcc05d3e 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -31,14 +31,6 @@
31 31
32static bool sr_enable_on_init; 32static bool sr_enable_on_init;
33 33
34static struct omap_device_pm_latency omap_sr_latency[] = {
35 {
36 .deactivate_func = omap_device_idle_hwmods,
37 .activate_func = omap_device_enable_hwmods,
38 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
39 },
40};
41
42/* Read EFUSE values from control registers for OMAP3430 */ 34/* Read EFUSE values from control registers for OMAP3430 */
43static void __init sr_set_nvalues(struct omap_volt_data *volt_data, 35static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
44 struct omap_sr_data *sr_data) 36 struct omap_sr_data *sr_data)
@@ -80,7 +72,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
80static int sr_dev_init(struct omap_hwmod *oh, void *user) 72static int sr_dev_init(struct omap_hwmod *oh, void *user)
81{ 73{
82 struct omap_sr_data *sr_data; 74 struct omap_sr_data *sr_data;
83 struct omap_device *od; 75 struct platform_device *pdev;
84 struct omap_volt_data *volt_data; 76 struct omap_volt_data *volt_data;
85 char *name = "smartreflex"; 77 char *name = "smartreflex";
86 static int i; 78 static int i;
@@ -102,7 +94,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
102 sr_data->senn_mod = 0x1; 94 sr_data->senn_mod = 0x1;
103 sr_data->senp_mod = 0x1; 95 sr_data->senp_mod = 0x1;
104 96
105 sr_data->voltdm = omap_voltage_domain_lookup(oh->vdd_name); 97 sr_data->voltdm = voltdm_lookup(oh->vdd_name);
106 if (IS_ERR(sr_data->voltdm)) { 98 if (IS_ERR(sr_data->voltdm)) {
107 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 99 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
108 __func__, oh->vdd_name); 100 __func__, oh->vdd_name);
@@ -120,10 +112,9 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
120 112
121 sr_data->enable_on_init = sr_enable_on_init; 113 sr_data->enable_on_init = sr_enable_on_init;
122 114
123 od = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data), 115 pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
124 omap_sr_latency, 116 NULL, 0, 0);
125 ARRAY_SIZE(omap_sr_latency), 0); 117 if (IS_ERR(pdev))
126 if (IS_ERR(od))
127 pr_warning("%s: Could not build omap_device for %s: %s.\n\n", 118 pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
128 __func__, name, oh->name); 119 __func__, name, oh->name);
129exit: 120exit:
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index cf1de7d2630d..e49fc7be2229 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -35,6 +35,7 @@
35#include <linux/irq.h> 35#include <linux/irq.h>
36#include <linux/clocksource.h> 36#include <linux/clocksource.h>
37#include <linux/clockchips.h> 37#include <linux/clockchips.h>
38#include <linux/slab.h>
38 39
39#include <asm/mach/time.h> 40#include <asm/mach/time.h>
40#include <plat/dmtimer.h> 41#include <plat/dmtimer.h>
@@ -42,6 +43,10 @@
42#include <asm/sched_clock.h> 43#include <asm/sched_clock.h>
43#include <plat/common.h> 44#include <plat/common.h>
44#include <plat/omap_hwmod.h> 45#include <plat/omap_hwmod.h>
46#include <plat/omap_device.h>
47#include <plat/omap-pm.h>
48
49#include "powerdomain.h"
45 50
46/* Parent clocks, eventually these will come from the clock framework */ 51/* Parent clocks, eventually these will come from the clock framework */
47 52
@@ -67,7 +72,7 @@
67/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ 72/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
68#define MAX_GPTIMER_ID 12 73#define MAX_GPTIMER_ID 12
69 74
70u32 sys_timer_reserved; 75static u32 sys_timer_reserved;
71 76
72/* Clockevent code */ 77/* Clockevent code */
73 78
@@ -78,7 +83,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
78{ 83{
79 struct clock_event_device *evt = &clockevent_gpt; 84 struct clock_event_device *evt = &clockevent_gpt;
80 85
81 __omap_dm_timer_write_status(clkev.io_base, OMAP_TIMER_INT_OVERFLOW); 86 __omap_dm_timer_write_status(&clkev, OMAP_TIMER_INT_OVERFLOW);
82 87
83 evt->event_handler(evt); 88 evt->event_handler(evt);
84 return IRQ_HANDLED; 89 return IRQ_HANDLED;
@@ -93,7 +98,7 @@ static struct irqaction omap2_gp_timer_irq = {
93static int omap2_gp_timer_set_next_event(unsigned long cycles, 98static int omap2_gp_timer_set_next_event(unsigned long cycles,
94 struct clock_event_device *evt) 99 struct clock_event_device *evt)
95{ 100{
96 __omap_dm_timer_load_start(clkev.io_base, OMAP_TIMER_CTRL_ST, 101 __omap_dm_timer_load_start(&clkev, OMAP_TIMER_CTRL_ST,
97 0xffffffff - cycles, 1); 102 0xffffffff - cycles, 1);
98 103
99 return 0; 104 return 0;
@@ -104,16 +109,16 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
104{ 109{
105 u32 period; 110 u32 period;
106 111
107 __omap_dm_timer_stop(clkev.io_base, 1, clkev.rate); 112 __omap_dm_timer_stop(&clkev, 1, clkev.rate);
108 113
109 switch (mode) { 114 switch (mode) {
110 case CLOCK_EVT_MODE_PERIODIC: 115 case CLOCK_EVT_MODE_PERIODIC:
111 period = clkev.rate / HZ; 116 period = clkev.rate / HZ;
112 period -= 1; 117 period -= 1;
113 /* Looks like we need to first set the load value separately */ 118 /* Looks like we need to first set the load value separately */
114 __omap_dm_timer_write(clkev.io_base, OMAP_TIMER_LOAD_REG, 119 __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG,
115 0xffffffff - period, 1); 120 0xffffffff - period, 1);
116 __omap_dm_timer_load_start(clkev.io_base, 121 __omap_dm_timer_load_start(&clkev,
117 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, 122 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
118 0xffffffff - period, 1); 123 0xffffffff - period, 1);
119 break; 124 break;
@@ -189,7 +194,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
189 clk_put(src); 194 clk_put(src);
190 } 195 }
191 } 196 }
192 __omap_dm_timer_reset(timer->io_base, 1, 1); 197 __omap_dm_timer_init_regs(timer);
198 __omap_dm_timer_reset(timer, 1, 1);
193 timer->posted = 1; 199 timer->posted = 1;
194 200
195 timer->rate = clk_get_rate(timer->fclk); 201 timer->rate = clk_get_rate(timer->fclk);
@@ -210,7 +216,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
210 omap2_gp_timer_irq.dev_id = (void *)&clkev; 216 omap2_gp_timer_irq.dev_id = (void *)&clkev;
211 setup_irq(clkev.irq, &omap2_gp_timer_irq); 217 setup_irq(clkev.irq, &omap2_gp_timer_irq);
212 218
213 __omap_dm_timer_int_enable(clkev.io_base, OMAP_TIMER_INT_OVERFLOW); 219 __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW);
214 220
215 clockevent_gpt.mult = div_sc(clkev.rate, NSEC_PER_SEC, 221 clockevent_gpt.mult = div_sc(clkev.rate, NSEC_PER_SEC,
216 clockevent_gpt.shift); 222 clockevent_gpt.shift);
@@ -251,7 +257,7 @@ static struct omap_dm_timer clksrc;
251static DEFINE_CLOCK_DATA(cd); 257static DEFINE_CLOCK_DATA(cd);
252static cycle_t clocksource_read_cycles(struct clocksource *cs) 258static cycle_t clocksource_read_cycles(struct clocksource *cs)
253{ 259{
254 return (cycle_t)__omap_dm_timer_read_counter(clksrc.io_base, 1); 260 return (cycle_t)__omap_dm_timer_read_counter(&clksrc, 1);
255} 261}
256 262
257static struct clocksource clocksource_gpt = { 263static struct clocksource clocksource_gpt = {
@@ -266,7 +272,7 @@ static void notrace dmtimer_update_sched_clock(void)
266{ 272{
267 u32 cyc; 273 u32 cyc;
268 274
269 cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1); 275 cyc = __omap_dm_timer_read_counter(&clksrc, 1);
270 276
271 update_sched_clock(&cd, cyc, (u32)~0); 277 update_sched_clock(&cd, cyc, (u32)~0);
272} 278}
@@ -276,7 +282,7 @@ unsigned long long notrace sched_clock(void)
276 u32 cyc = 0; 282 u32 cyc = 0;
277 283
278 if (clksrc.reserved) 284 if (clksrc.reserved)
279 cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1); 285 cyc = __omap_dm_timer_read_counter(&clksrc, 1);
280 286
281 return cyc_to_sched_clock(&cd, cyc, (u32)~0); 287 return cyc_to_sched_clock(&cd, cyc, (u32)~0);
282} 288}
@@ -293,7 +299,7 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
293 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", 299 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
294 gptimer_id, clksrc.rate); 300 gptimer_id, clksrc.rate);
295 301
296 __omap_dm_timer_load_start(clksrc.io_base, 302 __omap_dm_timer_load_start(&clksrc,
297 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1); 303 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
298 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate); 304 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
299 305
@@ -341,3 +347,167 @@ static void __init omap4_timer_init(void)
341} 347}
342OMAP_SYS_TIMER(4) 348OMAP_SYS_TIMER(4)
343#endif 349#endif
350
351/**
352 * omap2_dm_timer_set_src - change the timer input clock source
353 * @pdev: timer platform device pointer
354 * @source: array index of parent clock source
355 */
356static int omap2_dm_timer_set_src(struct platform_device *pdev, int source)
357{
358 int ret;
359 struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
360 struct clk *fclk, *parent;
361 char *parent_name = NULL;
362
363 fclk = clk_get(&pdev->dev, "fck");
364 if (IS_ERR_OR_NULL(fclk)) {
365 dev_err(&pdev->dev, "%s: %d: clk_get() FAILED\n",
366 __func__, __LINE__);
367 return -EINVAL;
368 }
369
370 switch (source) {
371 case OMAP_TIMER_SRC_SYS_CLK:
372 parent_name = "sys_ck";
373 break;
374
375 case OMAP_TIMER_SRC_32_KHZ:
376 parent_name = "32k_ck";
377 break;
378
379 case OMAP_TIMER_SRC_EXT_CLK:
380 if (pdata->timer_ip_version == OMAP_TIMER_IP_VERSION_1) {
381 parent_name = "alt_ck";
382 break;
383 }
384 dev_err(&pdev->dev, "%s: %d: invalid clk src.\n",
385 __func__, __LINE__);
386 clk_put(fclk);
387 return -EINVAL;
388 }
389
390 parent = clk_get(&pdev->dev, parent_name);
391 if (IS_ERR_OR_NULL(parent)) {
392 dev_err(&pdev->dev, "%s: %d: clk_get() %s FAILED\n",
393 __func__, __LINE__, parent_name);
394 clk_put(fclk);
395 return -EINVAL;
396 }
397
398 ret = clk_set_parent(fclk, parent);
399 if (IS_ERR_VALUE(ret)) {
400 dev_err(&pdev->dev, "%s: clk_set_parent() to %s FAILED\n",
401 __func__, parent_name);
402 ret = -EINVAL;
403 }
404
405 clk_put(parent);
406 clk_put(fclk);
407
408 return ret;
409}
410
411struct omap_device_pm_latency omap2_dmtimer_latency[] = {
412 {
413 .deactivate_func = omap_device_idle_hwmods,
414 .activate_func = omap_device_enable_hwmods,
415 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
416 },
417};
418
419/**
420 * omap_timer_init - build and register timer device with an
421 * associated timer hwmod
422 * @oh: timer hwmod pointer to be used to build timer device
423 * @user: parameter that can be passed from calling hwmod API
424 *
425 * Called by omap_hwmod_for_each_by_class to register each of the timer
426 * devices present in the system. The number of timer devices is known
427 * by parsing through the hwmod database for a given class name. At the
428 * end of function call memory is allocated for timer device and it is
429 * registered to the framework ready to be proved by the driver.
430 */
431static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
432{
433 int id;
434 int ret = 0;
435 char *name = "omap_timer";
436 struct dmtimer_platform_data *pdata;
437 struct platform_device *pdev;
438 struct omap_timer_capability_dev_attr *timer_dev_attr;
439 struct powerdomain *pwrdm;
440
441 pr_debug("%s: %s\n", __func__, oh->name);
442
443 /* on secure device, do not register secure timer */
444 timer_dev_attr = oh->dev_attr;
445 if (omap_type() != OMAP2_DEVICE_TYPE_GP && timer_dev_attr)
446 if (timer_dev_attr->timer_capability == OMAP_TIMER_SECURE)
447 return ret;
448
449 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
450 if (!pdata) {
451 pr_err("%s: No memory for [%s]\n", __func__, oh->name);
452 return -ENOMEM;
453 }
454
455 /*
456 * Extract the IDs from name field in hwmod database
457 * and use the same for constructing ids' for the
458 * timer devices. In a way, we are avoiding usage of
459 * static variable witin the function to do the same.
460 * CAUTION: We have to be careful and make sure the
461 * name in hwmod database does not change in which case
462 * we might either make corresponding change here or
463 * switch back static variable mechanism.
464 */
465 sscanf(oh->name, "timer%2d", &id);
466
467 pdata->set_timer_src = omap2_dm_timer_set_src;
468 pdata->timer_ip_version = oh->class->rev;
469
470 /* Mark clocksource and clockevent timers as reserved */
471 if ((sys_timer_reserved >> (id - 1)) & 0x1)
472 pdata->reserved = 1;
473
474 pwrdm = omap_hwmod_get_pwrdm(oh);
475 pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
476#ifdef CONFIG_PM
477 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
478#endif
479 pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
480 omap2_dmtimer_latency,
481 ARRAY_SIZE(omap2_dmtimer_latency),
482 0);
483
484 if (IS_ERR(pdev)) {
485 pr_err("%s: Can't build omap_device for %s: %s.\n",
486 __func__, name, oh->name);
487 ret = -EINVAL;
488 }
489
490 kfree(pdata);
491
492 return ret;
493}
494
495/**
496 * omap2_dm_timer_init - top level regular device initialization
497 *
498 * Uses dedicated hwmod api to parse through hwmod database for
499 * given class name and then build and register the timer device.
500 */
501static int __init omap2_dm_timer_init(void)
502{
503 int ret;
504
505 ret = omap_hwmod_for_each_by_class("timer", omap_timer_init, NULL);
506 if (unlikely(ret)) {
507 pr_err("%s: device registration failed.\n", __func__);
508 return -EINVAL;
509 }
510
511 return 0;
512}
513arch_initcall(omap2_dm_timer_init);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index a65145b02a55..47fb5d607630 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
60 60
61static u64 musb_dmamask = DMA_BIT_MASK(32); 61static u64 musb_dmamask = DMA_BIT_MASK(32);
62 62
63static struct omap_device_pm_latency omap_musb_latency[] = {
64 {
65 .deactivate_func = omap_device_idle_hwmods,
66 .activate_func = omap_device_enable_hwmods,
67 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
68 },
69};
70
71static void usb_musb_mux_init(struct omap_musb_board_data *board_data) 63static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
72{ 64{
73 switch (board_data->interface_type) { 65 switch (board_data->interface_type) {
@@ -115,7 +107,6 @@ static struct omap_musb_board_data musb_default_board_data = {
115void __init usb_musb_init(struct omap_musb_board_data *musb_board_data) 107void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
116{ 108{
117 struct omap_hwmod *oh; 109 struct omap_hwmod *oh;
118 struct omap_device *od;
119 struct platform_device *pdev; 110 struct platform_device *pdev;
120 struct device *dev; 111 struct device *dev;
121 int bus_id = -1; 112 int bus_id = -1;
@@ -137,9 +128,6 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
137 musb_plat.mode = board_data->mode; 128 musb_plat.mode = board_data->mode;
138 musb_plat.extvbus = board_data->extvbus; 129 musb_plat.extvbus = board_data->extvbus;
139 130
140 if (cpu_is_omap44xx())
141 omap4430_phy_init(dev);
142
143 if (cpu_is_omap3517() || cpu_is_omap3505()) { 131 if (cpu_is_omap3517() || cpu_is_omap3505()) {
144 oh_name = "am35x_otg_hs"; 132 oh_name = "am35x_otg_hs";
145 name = "musb-am35x"; 133 name = "musb-am35x";
@@ -148,22 +136,19 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
148 name = "musb-omap2430"; 136 name = "musb-omap2430";
149 } 137 }
150 138
151 oh = omap_hwmod_lookup(oh_name); 139 oh = omap_hwmod_lookup(oh_name);
152 if (!oh) { 140 if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
153 pr_err("Could not look up %s\n", oh_name); 141 __func__, oh_name))
154 return; 142 return;
155 }
156 143
157 od = omap_device_build(name, bus_id, oh, &musb_plat, 144 pdev = omap_device_build(name, bus_id, oh, &musb_plat,
158 sizeof(musb_plat), omap_musb_latency, 145 sizeof(musb_plat), NULL, 0, false);
159 ARRAY_SIZE(omap_musb_latency), false); 146 if (IS_ERR(pdev)) {
160 if (IS_ERR(od)) {
161 pr_err("Could not build omap_device for %s %s\n", 147 pr_err("Could not build omap_device for %s %s\n",
162 name, oh_name); 148 name, oh_name);
163 return; 149 return;
164 } 150 }
165 151
166 pdev = &od->pdev;
167 dev = &pdev->dev; 152 dev = &pdev->dev;
168 get_device(dev); 153 get_device(dev);
169 dev->dma_mask = &musb_dmamask; 154 dev->dma_mask = &musb_dmamask;
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
new file mode 100644
index 000000000000..031d116fbf10
--- /dev/null
+++ b/arch/arm/mach-omap2/vc.c
@@ -0,0 +1,367 @@
1/*
2 * OMAP Voltage Controller (VC) interface
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <linux/kernel.h>
11#include <linux/delay.h>
12#include <linux/init.h>
13
14#include <plat/cpu.h>
15
16#include "voltage.h"
17#include "vc.h"
18#include "prm-regbits-34xx.h"
19#include "prm-regbits-44xx.h"
20#include "prm44xx.h"
21
22/**
23 * struct omap_vc_channel_cfg - describe the cfg_channel bitfield
24 * @sa: bit for slave address
25 * @rav: bit for voltage configuration register
26 * @rac: bit for command configuration register
27 * @racen: enable bit for RAC
28 * @cmd: bit for command value set selection
29 *
30 * Channel configuration bits, common for OMAP3+
31 * OMAP3 register: PRM_VC_CH_CONF
32 * OMAP4 register: PRM_VC_CFG_CHANNEL
33 * OMAP5 register: PRM_VC_SMPS_<voltdm>_CONFIG
34 */
35struct omap_vc_channel_cfg {
36 u8 sa;
37 u8 rav;
38 u8 rac;
39 u8 racen;
40 u8 cmd;
41};
42
43static struct omap_vc_channel_cfg vc_default_channel_cfg = {
44 .sa = BIT(0),
45 .rav = BIT(1),
46 .rac = BIT(2),
47 .racen = BIT(3),
48 .cmd = BIT(4),
49};
50
51/*
52 * On OMAP3+, all VC channels have the above default bitfield
53 * configuration, except the OMAP4 MPU channel. This appears
54 * to be a freak accident as every other VC channel has the
55 * default configuration, thus creating a mutant channel config.
56 */
57static struct omap_vc_channel_cfg vc_mutant_channel_cfg = {
58 .sa = BIT(0),
59 .rav = BIT(2),
60 .rac = BIT(3),
61 .racen = BIT(4),
62 .cmd = BIT(1),
63};
64
65static struct omap_vc_channel_cfg *vc_cfg_bits;
66#define CFG_CHANNEL_MASK 0x1f
67
68/**
69 * omap_vc_config_channel - configure VC channel to PMIC mappings
70 * @voltdm: pointer to voltagdomain defining the desired VC channel
71 *
72 * Configures the VC channel to PMIC mappings for the following
73 * PMIC settings
74 * - i2c slave address (SA)
75 * - voltage configuration address (RAV)
76 * - command configuration address (RAC) and enable bit (RACEN)
77 * - command values for ON, ONLP, RET and OFF (CMD)
78 *
79 * This function currently only allows flexible configuration of the
80 * non-default channel. Starting with OMAP4, there are more than 2
81 * channels, with one defined as the default (on OMAP4, it's MPU.)
82 * Only the non-default channel can be configured.
83 */
84static int omap_vc_config_channel(struct voltagedomain *voltdm)
85{
86 struct omap_vc_channel *vc = voltdm->vc;
87
88 /*
89 * For default channel, the only configurable bit is RACEN.
90 * All others must stay at zero (see function comment above.)
91 */
92 if (vc->flags & OMAP_VC_CHANNEL_DEFAULT)
93 vc->cfg_channel &= vc_cfg_bits->racen;
94
95 voltdm->rmw(CFG_CHANNEL_MASK << vc->cfg_channel_sa_shift,
96 vc->cfg_channel << vc->cfg_channel_sa_shift,
97 vc->cfg_channel_reg);
98
99 return 0;
100}
101
102/* Voltage scale and accessory APIs */
103int omap_vc_pre_scale(struct voltagedomain *voltdm,
104 unsigned long target_volt,
105 u8 *target_vsel, u8 *current_vsel)
106{
107 struct omap_vc_channel *vc = voltdm->vc;
108 u32 vc_cmdval;
109
110 /* Check if sufficient pmic info is available for this vdd */
111 if (!voltdm->pmic) {
112 pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
113 __func__, voltdm->name);
114 return -EINVAL;
115 }
116
117 if (!voltdm->pmic->uv_to_vsel) {
118 pr_err("%s: PMIC function to convert voltage in uV to"
119 "vsel not registered. Hence unable to scale voltage"
120 "for vdd_%s\n", __func__, voltdm->name);
121 return -ENODATA;
122 }
123
124 if (!voltdm->read || !voltdm->write) {
125 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
126 __func__, voltdm->name);
127 return -EINVAL;
128 }
129
130 *target_vsel = voltdm->pmic->uv_to_vsel(target_volt);
131 *current_vsel = voltdm->pmic->uv_to_vsel(voltdm->nominal_volt);
132
133 /* Setting the ON voltage to the new target voltage */
134 vc_cmdval = voltdm->read(vc->cmdval_reg);
135 vc_cmdval &= ~vc->common->cmd_on_mask;
136 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
137 voltdm->write(vc_cmdval, vc->cmdval_reg);
138
139 omap_vp_update_errorgain(voltdm, target_volt);
140
141 return 0;
142}
143
144void omap_vc_post_scale(struct voltagedomain *voltdm,
145 unsigned long target_volt,
146 u8 target_vsel, u8 current_vsel)
147{
148 u32 smps_steps = 0, smps_delay = 0;
149
150 smps_steps = abs(target_vsel - current_vsel);
151 /* SMPS slew rate / step size. 2us added as buffer. */
152 smps_delay = ((smps_steps * voltdm->pmic->step_size) /
153 voltdm->pmic->slew_rate) + 2;
154 udelay(smps_delay);
155}
156
157/* vc_bypass_scale - VC bypass method of voltage scaling */
158int omap_vc_bypass_scale(struct voltagedomain *voltdm,
159 unsigned long target_volt)
160{
161 struct omap_vc_channel *vc = voltdm->vc;
162 u32 loop_cnt = 0, retries_cnt = 0;
163 u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
164 u8 target_vsel, current_vsel;
165 int ret;
166
167 ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, &current_vsel);
168 if (ret)
169 return ret;
170
171 vc_valid = vc->common->valid;
172 vc_bypass_val_reg = vc->common->bypass_val_reg;
173 vc_bypass_value = (target_vsel << vc->common->data_shift) |
174 (vc->volt_reg_addr << vc->common->regaddr_shift) |
175 (vc->i2c_slave_addr << vc->common->slaveaddr_shift);
176
177 voltdm->write(vc_bypass_value, vc_bypass_val_reg);
178 voltdm->write(vc_bypass_value | vc_valid, vc_bypass_val_reg);
179
180 vc_bypass_value = voltdm->read(vc_bypass_val_reg);
181 /*
182 * Loop till the bypass command is acknowledged from the SMPS.
183 * NOTE: This is legacy code. The loop count and retry count needs
184 * to be revisited.
185 */
186 while (!(vc_bypass_value & vc_valid)) {
187 loop_cnt++;
188
189 if (retries_cnt > 10) {
190 pr_warning("%s: Retry count exceeded\n", __func__);
191 return -ETIMEDOUT;
192 }
193
194 if (loop_cnt > 50) {
195 retries_cnt++;
196 loop_cnt = 0;
197 udelay(10);
198 }
199 vc_bypass_value = voltdm->read(vc_bypass_val_reg);
200 }
201
202 omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel);
203 return 0;
204}
205
206static void __init omap3_vfsm_init(struct voltagedomain *voltdm)
207{
208 /*
209 * Voltage Manager FSM parameters init
210 * XXX This data should be passed in from the board file
211 */
212 voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET);
213 voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET);
214 voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET);
215}
216
217static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
218{
219 static bool is_initialized;
220
221 if (is_initialized)
222 return;
223
224 omap3_vfsm_init(voltdm);
225
226 is_initialized = true;
227}
228
229
230/* OMAP4 specific voltage init functions */
231static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
232{
233 static bool is_initialized;
234 u32 vc_val;
235
236 if (is_initialized)
237 return;
238
239 /* XXX These are magic numbers and do not belong! */
240 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
241 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
242
243 is_initialized = true;
244}
245
246/**
247 * omap_vc_i2c_init - initialize I2C interface to PMIC
248 * @voltdm: voltage domain containing VC data
249 *
250 * Use PMIC supplied seetings for I2C high-speed mode and
251 * master code (if set) and program the VC I2C configuration
252 * register.
253 *
254 * The VC I2C configuration is common to all VC channels,
255 * so this function only configures I2C for the first VC
256 * channel registers. All other VC channels will use the
257 * same configuration.
258 */
259static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
260{
261 struct omap_vc_channel *vc = voltdm->vc;
262 static bool initialized;
263 static bool i2c_high_speed;
264 u8 mcode;
265
266 if (initialized) {
267 if (voltdm->pmic->i2c_high_speed != i2c_high_speed)
268 pr_warn("%s: I2C config for all channels must match.",
269 __func__);
270 return;
271 }
272
273 i2c_high_speed = voltdm->pmic->i2c_high_speed;
274 if (i2c_high_speed)
275 voltdm->rmw(vc->common->i2c_cfg_hsen_mask,
276 vc->common->i2c_cfg_hsen_mask,
277 vc->common->i2c_cfg_reg);
278
279 mcode = voltdm->pmic->i2c_mcode;
280 if (mcode)
281 voltdm->rmw(vc->common->i2c_mcode_mask,
282 mcode << __ffs(vc->common->i2c_mcode_mask),
283 vc->common->i2c_cfg_reg);
284
285 initialized = true;
286}
287
288void __init omap_vc_init_channel(struct voltagedomain *voltdm)
289{
290 struct omap_vc_channel *vc = voltdm->vc;
291 u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
292 u32 val;
293
294 if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
295 pr_err("%s: PMIC info requried to configure vc for"
296 "vdd_%s not populated.Hence cannot initialize vc\n",
297 __func__, voltdm->name);
298 return;
299 }
300
301 if (!voltdm->read || !voltdm->write) {
302 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
303 __func__, voltdm->name);
304 return;
305 }
306
307 vc->cfg_channel = 0;
308 if (vc->flags & OMAP_VC_CHANNEL_CFG_MUTANT)
309 vc_cfg_bits = &vc_mutant_channel_cfg;
310 else
311 vc_cfg_bits = &vc_default_channel_cfg;
312
313 /* get PMIC/board specific settings */
314 vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
315 vc->volt_reg_addr = voltdm->pmic->volt_reg_addr;
316 vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr;
317 vc->setup_time = voltdm->pmic->volt_setup_time;
318
319 /* Configure the i2c slave address for this VC */
320 voltdm->rmw(vc->smps_sa_mask,
321 vc->i2c_slave_addr << __ffs(vc->smps_sa_mask),
322 vc->smps_sa_reg);
323 vc->cfg_channel |= vc_cfg_bits->sa;
324
325 /*
326 * Configure the PMIC register addresses.
327 */
328 voltdm->rmw(vc->smps_volra_mask,
329 vc->volt_reg_addr << __ffs(vc->smps_volra_mask),
330 vc->smps_volra_reg);
331 vc->cfg_channel |= vc_cfg_bits->rav;
332
333 if (vc->cmd_reg_addr) {
334 voltdm->rmw(vc->smps_cmdra_mask,
335 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
336 vc->smps_cmdra_reg);
337 vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen;
338 }
339
340 /* Set up the on, inactive, retention and off voltage */
341 on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt);
342 onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt);
343 ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt);
344 off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt);
345 val = ((on_vsel << vc->common->cmd_on_shift) |
346 (onlp_vsel << vc->common->cmd_onlp_shift) |
347 (ret_vsel << vc->common->cmd_ret_shift) |
348 (off_vsel << vc->common->cmd_off_shift));
349 voltdm->write(val, vc->cmdval_reg);
350 vc->cfg_channel |= vc_cfg_bits->cmd;
351
352 /* Channel configuration */
353 omap_vc_config_channel(voltdm);
354
355 /* Configure the setup times */
356 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
357 vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
358 voltdm->vfsm->voltsetup_reg);
359
360 omap_vc_i2c_init(voltdm);
361
362 if (cpu_is_omap34xx())
363 omap3_vc_init_channel(voltdm);
364 else if (cpu_is_omap44xx())
365 omap4_vc_init_channel(voltdm);
366}
367
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index e7767771de49..478bf6b432c4 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -19,12 +19,12 @@
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21 21
22struct voltagedomain;
23
22/** 24/**
23 * struct omap_vc_common_data - per-VC register/bitfield data 25 * struct omap_vc_common - per-VC register/bitfield data
24 * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register 26 * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
25 * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register 27 * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
26 * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
27 * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
28 * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start 28 * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
29 * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register 29 * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
30 * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register 30 * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
@@ -33,15 +33,16 @@
33 * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register 33 * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
34 * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register 34 * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
35 * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register 35 * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
36 * @i2c_cfg_reg: I2C configuration register offset
37 * @i2c_cfg_hsen_mask: high-speed mode bit field mask in I2C config register
38 * @i2c_mcode_mask: MCODE field mask for I2C config register
36 * 39 *
37 * XXX One of cmd_on_mask and cmd_on_shift are not needed 40 * XXX One of cmd_on_mask and cmd_on_shift are not needed
38 * XXX VALID should probably be a shift, not a mask 41 * XXX VALID should probably be a shift, not a mask
39 */ 42 */
40struct omap_vc_common_data { 43struct omap_vc_common {
41 u32 cmd_on_mask; 44 u32 cmd_on_mask;
42 u32 valid; 45 u32 valid;
43 u8 smps_sa_reg;
44 u8 smps_volra_reg;
45 u8 bypass_val_reg; 46 u8 bypass_val_reg;
46 u8 data_shift; 47 u8 data_shift;
47 u8 slaveaddr_shift; 48 u8 slaveaddr_shift;
@@ -50,34 +51,75 @@ struct omap_vc_common_data {
50 u8 cmd_onlp_shift; 51 u8 cmd_onlp_shift;
51 u8 cmd_ret_shift; 52 u8 cmd_ret_shift;
52 u8 cmd_off_shift; 53 u8 cmd_off_shift;
54 u8 i2c_cfg_reg;
55 u8 i2c_cfg_hsen_mask;
56 u8 i2c_mcode_mask;
53}; 57};
54 58
59/* omap_vc_channel.flags values */
60#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
61#define OMAP_VC_CHANNEL_CFG_MUTANT BIT(1)
62
55/** 63/**
56 * struct omap_vc_instance_data - VC per-instance data 64 * struct omap_vc_channel - VC per-instance data
57 * @vc_common: pointer to VC common data for this platform 65 * @i2c_slave_addr: I2C slave address of PMIC for this VC channel
58 * @smps_sa_mask: SA* bitmask in the PRM_VC_SMPS_SA register 66 * @volt_reg_addr: voltage configuration register address
59 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register 67 * @cmd_reg_addr: command configuration register address
60 * @smps_sa_shift: SA* field shift in the PRM_VC_SMPS_SA register 68 * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
61 * @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register 69 * @cfg_channel: current value of VC channel configuration register
70 * @i2c_high_speed: whether or not to use I2C high-speed mode
62 * 71 *
63 * XXX It is not necessary to have both a *_mask and a *_shift - 72 * @common: pointer to VC common data for this platform
64 * remove one 73 * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
74 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
75 * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
76 * @cmdval_reg: register for on/ret/off voltage level values for this channel
77 * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
78 * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
79 * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start
80 * @cfg_channel_reg: VC channel configuration register
81 * @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
82 * @flags: VC channel-specific flags (optional)
65 */ 83 */
66struct omap_vc_instance_data { 84struct omap_vc_channel {
67 const struct omap_vc_common_data *vc_common; 85 /* channel state */
86 u16 i2c_slave_addr;
87 u16 volt_reg_addr;
88 u16 cmd_reg_addr;
89 u16 setup_time;
90 u8 cfg_channel;
91 bool i2c_high_speed;
92
93 /* register access data */
94 const struct omap_vc_common *common;
68 u32 smps_sa_mask; 95 u32 smps_sa_mask;
69 u32 smps_volra_mask; 96 u32 smps_volra_mask;
97 u32 smps_cmdra_mask;
70 u8 cmdval_reg; 98 u8 cmdval_reg;
71 u8 smps_sa_shift; 99 u8 smps_sa_reg;
72 u8 smps_volra_shift; 100 u8 smps_volra_reg;
101 u8 smps_cmdra_reg;
102 u8 cfg_channel_reg;
103 u8 cfg_channel_sa_shift;
104 u8 flags;
73}; 105};
74 106
75extern struct omap_vc_instance_data omap3_vc1_data; 107extern struct omap_vc_channel omap3_vc_mpu;
76extern struct omap_vc_instance_data omap3_vc2_data; 108extern struct omap_vc_channel omap3_vc_core;
109
110extern struct omap_vc_channel omap4_vc_mpu;
111extern struct omap_vc_channel omap4_vc_iva;
112extern struct omap_vc_channel omap4_vc_core;
77 113
78extern struct omap_vc_instance_data omap4_vc_mpu_data; 114void omap_vc_init_channel(struct voltagedomain *voltdm);
79extern struct omap_vc_instance_data omap4_vc_iva_data; 115int omap_vc_pre_scale(struct voltagedomain *voltdm,
80extern struct omap_vc_instance_data omap4_vc_core_data; 116 unsigned long target_volt,
117 u8 *target_vsel, u8 *current_vsel);
118void omap_vc_post_scale(struct voltagedomain *voltdm,
119 unsigned long target_volt,
120 u8 target_vsel, u8 current_vsel);
121int omap_vc_bypass_scale(struct voltagedomain *voltdm,
122 unsigned long target_volt);
81 123
82#endif 124#endif
83 125
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index f37dc4bc379a..cfe348e1af0e 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -29,9 +29,7 @@
29 * VC data common to 34xx/36xx chips 29 * VC data common to 34xx/36xx chips
30 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. 30 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
31 */ 31 */
32static struct omap_vc_common_data omap3_vc_common = { 32static struct omap_vc_common omap3_vc_common = {
33 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET,
34 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
35 .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, 33 .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET,
36 .data_shift = OMAP3430_DATA_SHIFT, 34 .data_shift = OMAP3430_DATA_SHIFT,
37 .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, 35 .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT,
@@ -42,22 +40,33 @@ static struct omap_vc_common_data omap3_vc_common = {
42 .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT, 40 .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT,
43 .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT, 41 .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT,
44 .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT, 42 .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT,
43 .i2c_cfg_hsen_mask = OMAP3430_HSEN_MASK,
44 .i2c_cfg_reg = OMAP3_PRM_VC_I2C_CFG_OFFSET,
45 .i2c_mcode_mask = OMAP3430_MCODE_MASK,
45}; 46};
46 47
47struct omap_vc_instance_data omap3_vc1_data = { 48struct omap_vc_channel omap3_vc_mpu = {
48 .vc_common = &omap3_vc_common, 49 .common = &omap3_vc_common,
50 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET,
51 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
52 .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET,
53 .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET,
49 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, 54 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET,
50 .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
51 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, 55 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK,
52 .smps_volra_shift = OMAP3430_VOLRA0_SHIFT,
53 .smps_volra_mask = OMAP3430_VOLRA0_MASK, 56 .smps_volra_mask = OMAP3430_VOLRA0_MASK,
57 .smps_cmdra_mask = OMAP3430_CMDRA0_MASK,
58 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
54}; 59};
55 60
56struct omap_vc_instance_data omap3_vc2_data = { 61struct omap_vc_channel omap3_vc_core = {
57 .vc_common = &omap3_vc_common, 62 .common = &omap3_vc_common,
63 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET,
64 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
65 .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET,
66 .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET,
58 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, 67 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET,
59 .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
60 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, 68 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK,
61 .smps_volra_shift = OMAP3430_VOLRA1_SHIFT,
62 .smps_volra_mask = OMAP3430_VOLRA1_MASK, 69 .smps_volra_mask = OMAP3430_VOLRA1_MASK,
70 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
71 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
63}; 72};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index a98da8ddec52..2740a968145e 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -30,9 +30,7 @@
30 * VC data common to 44xx chips 30 * VC data common to 44xx chips
31 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. 31 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
32 */ 32 */
33static const struct omap_vc_common_data omap4_vc_common = { 33static const struct omap_vc_common omap4_vc_common = {
34 .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
35 .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
36 .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, 34 .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET,
37 .data_shift = OMAP4430_DATA_SHIFT, 35 .data_shift = OMAP4430_DATA_SHIFT,
38 .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, 36 .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT,
@@ -43,33 +41,49 @@ static const struct omap_vc_common_data omap4_vc_common = {
43 .cmd_onlp_shift = OMAP4430_ONLP_SHIFT, 41 .cmd_onlp_shift = OMAP4430_ONLP_SHIFT,
44 .cmd_ret_shift = OMAP4430_RET_SHIFT, 42 .cmd_ret_shift = OMAP4430_RET_SHIFT,
45 .cmd_off_shift = OMAP4430_OFF_SHIFT, 43 .cmd_off_shift = OMAP4430_OFF_SHIFT,
44 .i2c_cfg_reg = OMAP4_PRM_VC_CFG_I2C_MODE_OFFSET,
45 .i2c_cfg_hsen_mask = OMAP4430_HSMODEEN_MASK,
46 .i2c_mcode_mask = OMAP4430_HSMCODE_MASK,
46}; 47};
47 48
48/* VC instance data for each controllable voltage line */ 49/* VC instance data for each controllable voltage line */
49struct omap_vc_instance_data omap4_vc_mpu_data = { 50struct omap_vc_channel omap4_vc_mpu = {
50 .vc_common = &omap4_vc_common, 51 .flags = OMAP_VC_CHANNEL_DEFAULT | OMAP_VC_CHANNEL_CFG_MUTANT,
52 .common = &omap4_vc_common,
53 .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
54 .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
55 .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
56 .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
51 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, 57 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET,
52 .smps_sa_shift = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT,
53 .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, 58 .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK,
54 .smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT,
55 .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, 59 .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK,
60 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK,
61 .cfg_channel_sa_shift = OMAP4430_SA_VDD_MPU_L_SHIFT,
56}; 62};
57 63
58struct omap_vc_instance_data omap4_vc_iva_data = { 64struct omap_vc_channel omap4_vc_iva = {
59 .vc_common = &omap4_vc_common, 65 .common = &omap4_vc_common,
66 .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
67 .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
68 .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
69 .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
60 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, 70 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET,
61 .smps_sa_shift = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT,
62 .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, 71 .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK,
63 .smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT,
64 .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, 72 .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK,
73 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK,
74 .cfg_channel_sa_shift = OMAP4430_SA_VDD_IVA_L_SHIFT,
65}; 75};
66 76
67struct omap_vc_instance_data omap4_vc_core_data = { 77struct omap_vc_channel omap4_vc_core = {
68 .vc_common = &omap4_vc_common, 78 .common = &omap4_vc_common,
79 .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
80 .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
81 .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET,
82 .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
69 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, 83 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET,
70 .smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT,
71 .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, 84 .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK,
72 .smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT,
73 .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, 85 .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK,
86 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK,
87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
74}; 88};
75 89
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 9ef3789ded4b..64070ac1e761 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -21,10 +21,10 @@
21 21
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/clk.h>
25#include <linux/err.h> 24#include <linux/err.h>
26#include <linux/debugfs.h> 25#include <linux/debugfs.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/clk.h>
28 28
29#include <plat/common.h> 29#include <plat/common.h>
30 30
@@ -36,839 +36,88 @@
36#include "control.h" 36#include "control.h"
37 37
38#include "voltage.h" 38#include "voltage.h"
39#include "powerdomain.h"
39 40
40#include "vc.h" 41#include "vc.h"
41#include "vp.h" 42#include "vp.h"
42 43
43#define VOLTAGE_DIR_SIZE 16 44static LIST_HEAD(voltdm_list);
44
45
46static struct omap_vdd_info **vdd_info;
47
48/*
49 * Number of scalable voltage domains.
50 */
51static int nr_scalable_vdd;
52
53/* XXX document */
54static s16 prm_mod_offs;
55static s16 prm_irqst_ocp_mod_offs;
56
57static struct dentry *voltage_dir;
58
59/* Init function pointers */
60static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
61 unsigned long target_volt);
62
63static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
64{
65 return omap2_prm_read_mod_reg(mod, offset);
66}
67
68static void omap3_voltage_write_reg(u32 val, u16 mod, u8 offset)
69{
70 omap2_prm_write_mod_reg(val, mod, offset);
71}
72
73static u32 omap4_voltage_read_reg(u16 mod, u8 offset)
74{
75 return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
76 mod, offset);
77}
78
79static void omap4_voltage_write_reg(u32 val, u16 mod, u8 offset)
80{
81 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset);
82}
83
84static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
85{
86 char *sys_ck_name;
87 struct clk *sys_ck;
88 u32 sys_clk_speed, timeout_val, waittime;
89
90 /*
91 * XXX Clockfw should handle this, or this should be in a
92 * struct record
93 */
94 if (cpu_is_omap24xx() || cpu_is_omap34xx())
95 sys_ck_name = "sys_ck";
96 else if (cpu_is_omap44xx())
97 sys_ck_name = "sys_clkin_ck";
98 else
99 return -EINVAL;
100
101 /*
102 * Sys clk rate is require to calculate vp timeout value and
103 * smpswaittimemin and smpswaittimemax.
104 */
105 sys_ck = clk_get(NULL, sys_ck_name);
106 if (IS_ERR(sys_ck)) {
107 pr_warning("%s: Could not get the sys clk to calculate"
108 "various vdd_%s params\n", __func__, vdd->voltdm.name);
109 return -EINVAL;
110 }
111 sys_clk_speed = clk_get_rate(sys_ck);
112 clk_put(sys_ck);
113 /* Divide to avoid overflow */
114 sys_clk_speed /= 1000;
115
116 /* Generic voltage parameters */
117 vdd->volt_scale = vp_forceupdate_scale_voltage;
118 vdd->vp_enabled = false;
119
120 vdd->vp_rt_data.vpconfig_erroroffset =
121 (vdd->pmic_info->vp_erroroffset <<
122 vdd->vp_data->vp_common->vpconfig_erroroffset_shift);
123
124 timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
125 vdd->vp_rt_data.vlimitto_timeout = timeout_val;
126 vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
127 vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
128
129 waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
130 sys_clk_speed) / 1000;
131 vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
132 vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
133 vdd->vp_rt_data.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
134 vdd->vp_rt_data.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
135
136 return 0;
137}
138
139/* Voltage debugfs support */
140static int vp_volt_debug_get(void *data, u64 *val)
141{
142 struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
143 u8 vsel;
144
145 if (!vdd) {
146 pr_warning("Wrong paramater passed\n");
147 return -EINVAL;
148 }
149
150 vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
151
152 if (!vdd->pmic_info->vsel_to_uv) {
153 pr_warning("PMIC function to convert vsel to voltage"
154 "in uV not registerd\n");
155 return -EINVAL;
156 }
157
158 *val = vdd->pmic_info->vsel_to_uv(vsel);
159 return 0;
160}
161
162static int nom_volt_debug_get(void *data, u64 *val)
163{
164 struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
165
166 if (!vdd) {
167 pr_warning("Wrong paramater passed\n");
168 return -EINVAL;
169 }
170
171 *val = omap_voltage_get_nom_volt(&vdd->voltdm);
172
173 return 0;
174}
175
176DEFINE_SIMPLE_ATTRIBUTE(vp_volt_debug_fops, vp_volt_debug_get, NULL, "%llu\n");
177DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL,
178 "%llu\n");
179static void vp_latch_vsel(struct omap_vdd_info *vdd)
180{
181 u32 vpconfig;
182 unsigned long uvdc;
183 char vsel;
184
185 uvdc = omap_voltage_get_nom_volt(&vdd->voltdm);
186 if (!uvdc) {
187 pr_warning("%s: unable to find current voltage for vdd_%s\n",
188 __func__, vdd->voltdm.name);
189 return;
190 }
191
192 if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
193 pr_warning("%s: PMIC function to convert voltage in uV to"
194 " vsel not registered\n", __func__);
195 return;
196 }
197
198 vsel = vdd->pmic_info->uv_to_vsel(uvdc);
199
200 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
201 vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvoltage_mask |
202 vdd->vp_data->vp_common->vpconfig_initvdd);
203 vpconfig |= vsel << vdd->vp_data->vp_common->vpconfig_initvoltage_shift;
204
205 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
206
207 /* Trigger initVDD value copy to voltage processor */
208 vdd->write_reg((vpconfig | vdd->vp_data->vp_common->vpconfig_initvdd),
209 prm_mod_offs, vdd->vp_data->vpconfig);
210
211 /* Clear initVDD copy trigger bit */
212 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
213}
214
215/* Generic voltage init functions */
216static void __init vp_init(struct omap_vdd_info *vdd)
217{
218 u32 vp_val;
219
220 if (!vdd->read_reg || !vdd->write_reg) {
221 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
222 __func__, vdd->voltdm.name);
223 return;
224 }
225
226 vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
227 (vdd->vp_rt_data.vpconfig_errorgain <<
228 vdd->vp_data->vp_common->vpconfig_errorgain_shift) |
229 vdd->vp_data->vp_common->vpconfig_timeouten;
230 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vpconfig);
231
232 vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
233 vdd->vp_data->vp_common->vstepmin_smpswaittimemin_shift) |
234 (vdd->vp_rt_data.vstepmin_stepmin <<
235 vdd->vp_data->vp_common->vstepmin_stepmin_shift));
236 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmin);
237
238 vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
239 vdd->vp_data->vp_common->vstepmax_smpswaittimemax_shift) |
240 (vdd->vp_rt_data.vstepmax_stepmax <<
241 vdd->vp_data->vp_common->vstepmax_stepmax_shift));
242 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmax);
243
244 vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
245 vdd->vp_data->vp_common->vlimitto_vddmax_shift) |
246 (vdd->vp_rt_data.vlimitto_vddmin <<
247 vdd->vp_data->vp_common->vlimitto_vddmin_shift) |
248 (vdd->vp_rt_data.vlimitto_timeout <<
249 vdd->vp_data->vp_common->vlimitto_timeout_shift));
250 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
251}
252
253static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
254{
255 char *name;
256
257 name = kzalloc(VOLTAGE_DIR_SIZE, GFP_KERNEL);
258 if (!name) {
259 pr_warning("%s: Unable to allocate memory for debugfs"
260 " directory name for vdd_%s",
261 __func__, vdd->voltdm.name);
262 return;
263 }
264 strcpy(name, "vdd_");
265 strcat(name, vdd->voltdm.name);
266
267 vdd->debug_dir = debugfs_create_dir(name, voltage_dir);
268 kfree(name);
269 if (IS_ERR(vdd->debug_dir)) {
270 pr_warning("%s: Unable to create debugfs directory for"
271 " vdd_%s\n", __func__, vdd->voltdm.name);
272 vdd->debug_dir = NULL;
273 return;
274 }
275
276 (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir,
277 &(vdd->vp_rt_data.vpconfig_errorgain));
278 (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO,
279 vdd->debug_dir,
280 &(vdd->vp_rt_data.vstepmin_smpswaittimemin));
281 (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir,
282 &(vdd->vp_rt_data.vstepmin_stepmin));
283 (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO,
284 vdd->debug_dir,
285 &(vdd->vp_rt_data.vstepmax_smpswaittimemax));
286 (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir,
287 &(vdd->vp_rt_data.vstepmax_stepmax));
288 (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir,
289 &(vdd->vp_rt_data.vlimitto_vddmax));
290 (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir,
291 &(vdd->vp_rt_data.vlimitto_vddmin));
292 (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir,
293 &(vdd->vp_rt_data.vlimitto_timeout));
294 (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir,
295 (void *) vdd, &vp_volt_debug_fops);
296 (void) debugfs_create_file("curr_nominal_volt", S_IRUGO,
297 vdd->debug_dir, (void *) vdd,
298 &nom_volt_debug_fops);
299}
300
301/* Voltage scale and accessory APIs */
302static int _pre_volt_scale(struct omap_vdd_info *vdd,
303 unsigned long target_volt, u8 *target_vsel, u8 *current_vsel)
304{
305 struct omap_volt_data *volt_data;
306 const struct omap_vc_common_data *vc_common;
307 const struct omap_vp_common_data *vp_common;
308 u32 vc_cmdval, vp_errgain_val;
309
310 vc_common = vdd->vc_data->vc_common;
311 vp_common = vdd->vp_data->vp_common;
312
313 /* Check if suffiecient pmic info is available for this vdd */
314 if (!vdd->pmic_info) {
315 pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
316 __func__, vdd->voltdm.name);
317 return -EINVAL;
318 }
319
320 if (!vdd->pmic_info->uv_to_vsel) {
321 pr_err("%s: PMIC function to convert voltage in uV to"
322 "vsel not registered. Hence unable to scale voltage"
323 "for vdd_%s\n", __func__, vdd->voltdm.name);
324 return -ENODATA;
325 }
326
327 if (!vdd->read_reg || !vdd->write_reg) {
328 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
329 __func__, vdd->voltdm.name);
330 return -EINVAL;
331 }
332
333 /* Get volt_data corresponding to target_volt */
334 volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt);
335 if (IS_ERR(volt_data))
336 volt_data = NULL;
337
338 *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt);
339 *current_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
340
341 /* Setting the ON voltage to the new target voltage */
342 vc_cmdval = vdd->read_reg(prm_mod_offs, vdd->vc_data->cmdval_reg);
343 vc_cmdval &= ~vc_common->cmd_on_mask;
344 vc_cmdval |= (*target_vsel << vc_common->cmd_on_shift);
345 vdd->write_reg(vc_cmdval, prm_mod_offs, vdd->vc_data->cmdval_reg);
346
347 /* Setting vp errorgain based on the voltage */
348 if (volt_data) {
349 vp_errgain_val = vdd->read_reg(prm_mod_offs,
350 vdd->vp_data->vpconfig);
351 vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
352 vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask;
353 vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
354 vp_common->vpconfig_errorgain_shift;
355 vdd->write_reg(vp_errgain_val, prm_mod_offs,
356 vdd->vp_data->vpconfig);
357 }
358
359 return 0;
360}
361
362static void _post_volt_scale(struct omap_vdd_info *vdd,
363 unsigned long target_volt, u8 target_vsel, u8 current_vsel)
364{
365 u32 smps_steps = 0, smps_delay = 0;
366
367 smps_steps = abs(target_vsel - current_vsel);
368 /* SMPS slew rate / step size. 2us added as buffer. */
369 smps_delay = ((smps_steps * vdd->pmic_info->step_size) /
370 vdd->pmic_info->slew_rate) + 2;
371 udelay(smps_delay);
372
373 vdd->curr_volt = target_volt;
374}
375
376/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */
377static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
378 unsigned long target_volt)
379{
380 u32 loop_cnt = 0, retries_cnt = 0;
381 u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
382 u8 target_vsel, current_vsel;
383 int ret;
384
385 ret = _pre_volt_scale(vdd, target_volt, &target_vsel, &current_vsel);
386 if (ret)
387 return ret;
388
389 vc_valid = vdd->vc_data->vc_common->valid;
390 vc_bypass_val_reg = vdd->vc_data->vc_common->bypass_val_reg;
391 vc_bypass_value = (target_vsel << vdd->vc_data->vc_common->data_shift) |
392 (vdd->pmic_info->pmic_reg <<
393 vdd->vc_data->vc_common->regaddr_shift) |
394 (vdd->pmic_info->i2c_slave_addr <<
395 vdd->vc_data->vc_common->slaveaddr_shift);
396
397 vdd->write_reg(vc_bypass_value, prm_mod_offs, vc_bypass_val_reg);
398 vdd->write_reg(vc_bypass_value | vc_valid, prm_mod_offs,
399 vc_bypass_val_reg);
400
401 vc_bypass_value = vdd->read_reg(prm_mod_offs, vc_bypass_val_reg);
402 /*
403 * Loop till the bypass command is acknowledged from the SMPS.
404 * NOTE: This is legacy code. The loop count and retry count needs
405 * to be revisited.
406 */
407 while (!(vc_bypass_value & vc_valid)) {
408 loop_cnt++;
409
410 if (retries_cnt > 10) {
411 pr_warning("%s: Retry count exceeded\n", __func__);
412 return -ETIMEDOUT;
413 }
414
415 if (loop_cnt > 50) {
416 retries_cnt++;
417 loop_cnt = 0;
418 udelay(10);
419 }
420 vc_bypass_value = vdd->read_reg(prm_mod_offs,
421 vc_bypass_val_reg);
422 }
423
424 _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
425 return 0;
426}
427
428/* VP force update method of voltage scaling */
429static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
430 unsigned long target_volt)
431{
432 u32 vpconfig;
433 u8 target_vsel, current_vsel, prm_irqst_reg;
434 int ret, timeout = 0;
435
436 ret = _pre_volt_scale(vdd, target_volt, &target_vsel, &current_vsel);
437 if (ret)
438 return ret;
439
440 prm_irqst_reg = vdd->vp_data->prm_irqst_data->prm_irqst_reg;
441
442 /*
443 * Clear all pending TransactionDone interrupt/status. Typical latency
444 * is <3us
445 */
446 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
447 vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
448 prm_irqst_ocp_mod_offs, prm_irqst_reg);
449 if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
450 vdd->vp_data->prm_irqst_data->tranxdone_status))
451 break;
452 udelay(1);
453 }
454 if (timeout >= VP_TRANXDONE_TIMEOUT) {
455 pr_warning("%s: vdd_%s TRANXDONE timeout exceeded."
456 "Voltage change aborted", __func__, vdd->voltdm.name);
457 return -ETIMEDOUT;
458 }
459
460 /* Configure for VP-Force Update */
461 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
462 vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvdd |
463 vdd->vp_data->vp_common->vpconfig_forceupdate |
464 vdd->vp_data->vp_common->vpconfig_initvoltage_mask);
465 vpconfig |= ((target_vsel <<
466 vdd->vp_data->vp_common->vpconfig_initvoltage_shift));
467 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
468
469 /* Trigger initVDD value copy to voltage processor */
470 vpconfig |= vdd->vp_data->vp_common->vpconfig_initvdd;
471 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
472
473 /* Force update of voltage */
474 vpconfig |= vdd->vp_data->vp_common->vpconfig_forceupdate;
475 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
476
477 /*
478 * Wait for TransactionDone. Typical latency is <200us.
479 * Depends on SMPSWAITTIMEMIN/MAX and voltage change
480 */
481 timeout = 0;
482 omap_test_timeout((vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
483 vdd->vp_data->prm_irqst_data->tranxdone_status),
484 VP_TRANXDONE_TIMEOUT, timeout);
485 if (timeout >= VP_TRANXDONE_TIMEOUT)
486 pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
487 "TRANXDONE never got set after the voltage update\n",
488 __func__, vdd->voltdm.name);
489
490 _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
491
492 /*
493 * Disable TransactionDone interrupt , clear all status, clear
494 * control registers
495 */
496 timeout = 0;
497 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
498 vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
499 prm_irqst_ocp_mod_offs, prm_irqst_reg);
500 if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
501 vdd->vp_data->prm_irqst_data->tranxdone_status))
502 break;
503 udelay(1);
504 }
505
506 if (timeout >= VP_TRANXDONE_TIMEOUT)
507 pr_warning("%s: vdd_%s TRANXDONE timeout exceeded while trying"
508 "to clear the TRANXDONE status\n",
509 __func__, vdd->voltdm.name);
510
511 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
512 /* Clear initVDD copy trigger bit */
513 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_initvdd;
514 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
515 /* Clear force bit */
516 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_forceupdate;
517 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
518
519 return 0;
520}
521
522static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
523{
524 /*
525 * Voltage Manager FSM parameters init
526 * XXX This data should be passed in from the board file
527 */
528 vdd->write_reg(OMAP3_CLKSETUP, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
529 vdd->write_reg(OMAP3_VOLTOFFSET, prm_mod_offs,
530 OMAP3_PRM_VOLTOFFSET_OFFSET);
531 vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
532 OMAP3_PRM_VOLTSETUP2_OFFSET);
533}
534
535static void __init omap3_vc_init(struct omap_vdd_info *vdd)
536{
537 static bool is_initialized;
538 u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
539 u32 vc_val;
540
541 if (is_initialized)
542 return;
543
544 /* Set up the on, inactive, retention and off voltage */
545 on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
546 onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
547 ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
548 off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
549 vc_val = ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) |
550 (onlp_vsel << vdd->vc_data->vc_common->cmd_onlp_shift) |
551 (ret_vsel << vdd->vc_data->vc_common->cmd_ret_shift) |
552 (off_vsel << vdd->vc_data->vc_common->cmd_off_shift));
553 vdd->write_reg(vc_val, prm_mod_offs, vdd->vc_data->cmdval_reg);
554
555 /*
556 * Generic VC parameters init
557 * XXX This data should be abstracted out
558 */
559 vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, prm_mod_offs,
560 OMAP3_PRM_VC_CH_CONF_OFFSET);
561 vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
562 OMAP3_PRM_VC_I2C_CFG_OFFSET);
563
564 omap3_vfsm_init(vdd);
565
566 is_initialized = true;
567}
568
569
570/* OMAP4 specific voltage init functions */
571static void __init omap4_vc_init(struct omap_vdd_info *vdd)
572{
573 static bool is_initialized;
574 u32 vc_val;
575
576 if (is_initialized)
577 return;
578
579 /* TODO: Configure setup times and CMD_VAL values*/
580
581 /*
582 * Generic VC parameters init
583 * XXX This data should be abstracted out
584 */
585 vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK |
586 OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK |
587 OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
588 vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
589
590 /* XXX These are magic numbers and do not belong! */
591 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
592 vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
593
594 is_initialized = true;
595}
596
597static void __init omap_vc_init(struct omap_vdd_info *vdd)
598{
599 u32 vc_val;
600
601 if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
602 pr_err("%s: PMIC info requried to configure vc for"
603 "vdd_%s not populated.Hence cannot initialize vc\n",
604 __func__, vdd->voltdm.name);
605 return;
606 }
607
608 if (!vdd->read_reg || !vdd->write_reg) {
609 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
610 __func__, vdd->voltdm.name);
611 return;
612 }
613
614 /* Set up the SMPS_SA(i2c slave address in VC */
615 vc_val = vdd->read_reg(prm_mod_offs,
616 vdd->vc_data->vc_common->smps_sa_reg);
617 vc_val &= ~vdd->vc_data->smps_sa_mask;
618 vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_data->smps_sa_shift;
619 vdd->write_reg(vc_val, prm_mod_offs,
620 vdd->vc_data->vc_common->smps_sa_reg);
621
622 /* Setup the VOLRA(pmic reg addr) in VC */
623 vc_val = vdd->read_reg(prm_mod_offs,
624 vdd->vc_data->vc_common->smps_volra_reg);
625 vc_val &= ~vdd->vc_data->smps_volra_mask;
626 vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_data->smps_volra_shift;
627 vdd->write_reg(vc_val, prm_mod_offs,
628 vdd->vc_data->vc_common->smps_volra_reg);
629
630 /* Configure the setup times */
631 vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
632 vc_val &= ~vdd->vfsm->voltsetup_mask;
633 vc_val |= vdd->pmic_info->volt_setup_time <<
634 vdd->vfsm->voltsetup_shift;
635 vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
636
637 if (cpu_is_omap34xx())
638 omap3_vc_init(vdd);
639 else if (cpu_is_omap44xx())
640 omap4_vc_init(vdd);
641}
642
643static int __init omap_vdd_data_configure(struct omap_vdd_info *vdd)
644{
645 int ret = -EINVAL;
646
647 if (!vdd->pmic_info) {
648 pr_err("%s: PMIC info requried to configure vdd_%s not"
649 "populated.Hence cannot initialize vdd_%s\n",
650 __func__, vdd->voltdm.name, vdd->voltdm.name);
651 goto ovdc_out;
652 }
653
654 if (IS_ERR_VALUE(_config_common_vdd_data(vdd)))
655 goto ovdc_out;
656
657 if (cpu_is_omap34xx()) {
658 vdd->read_reg = omap3_voltage_read_reg;
659 vdd->write_reg = omap3_voltage_write_reg;
660 ret = 0;
661 } else if (cpu_is_omap44xx()) {
662 vdd->read_reg = omap4_voltage_read_reg;
663 vdd->write_reg = omap4_voltage_write_reg;
664 ret = 0;
665 }
666
667ovdc_out:
668 return ret;
669}
670 45
671/* Public functions */ 46/* Public functions */
672/** 47/**
673 * omap_voltage_get_nom_volt() - Gets the current non-auto-compensated voltage 48 * voltdm_get_voltage() - Gets the current non-auto-compensated voltage
674 * @voltdm: pointer to the VDD for which current voltage info is needed 49 * @voltdm: pointer to the voltdm for which current voltage info is needed
675 * 50 *
676 * API to get the current non-auto-compensated voltage for a VDD. 51 * API to get the current non-auto-compensated voltage for a voltage domain.
677 * Returns 0 in case of error else returns the current voltage for the VDD. 52 * Returns 0 in case of error else returns the current voltage.
678 */ 53 */
679unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm) 54unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
680{ 55{
681 struct omap_vdd_info *vdd;
682
683 if (!voltdm || IS_ERR(voltdm)) { 56 if (!voltdm || IS_ERR(voltdm)) {
684 pr_warning("%s: VDD specified does not exist!\n", __func__); 57 pr_warning("%s: VDD specified does not exist!\n", __func__);
685 return 0; 58 return 0;
686 } 59 }
687 60
688 vdd = container_of(voltdm, struct omap_vdd_info, voltdm); 61 return voltdm->nominal_volt;
689
690 return vdd->curr_volt;
691} 62}
692 63
693/** 64/**
694 * omap_vp_get_curr_volt() - API to get the current vp voltage. 65 * voltdm_scale() - API to scale voltage of a particular voltage domain.
695 * @voltdm: pointer to the VDD. 66 * @voltdm: pointer to the voltage domain which is to be scaled.
696 * 67 * @target_volt: The target voltage of the voltage domain
697 * This API returns the current voltage for the specified voltage processor
698 */
699unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
700{
701 struct omap_vdd_info *vdd;
702 u8 curr_vsel;
703
704 if (!voltdm || IS_ERR(voltdm)) {
705 pr_warning("%s: VDD specified does not exist!\n", __func__);
706 return 0;
707 }
708
709 vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
710 if (!vdd->read_reg) {
711 pr_err("%s: No read API for reading vdd_%s regs\n",
712 __func__, voltdm->name);
713 return 0;
714 }
715
716 curr_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
717
718 if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) {
719 pr_warning("%s: PMIC function to convert vsel to voltage"
720 "in uV not registerd\n", __func__);
721 return 0;
722 }
723
724 return vdd->pmic_info->vsel_to_uv(curr_vsel);
725}
726
727/**
728 * omap_vp_enable() - API to enable a particular VP
729 * @voltdm: pointer to the VDD whose VP is to be enabled.
730 *
731 * This API enables a particular voltage processor. Needed by the smartreflex
732 * class drivers.
733 */
734void omap_vp_enable(struct voltagedomain *voltdm)
735{
736 struct omap_vdd_info *vdd;
737 u32 vpconfig;
738
739 if (!voltdm || IS_ERR(voltdm)) {
740 pr_warning("%s: VDD specified does not exist!\n", __func__);
741 return;
742 }
743
744 vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
745 if (!vdd->read_reg || !vdd->write_reg) {
746 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
747 __func__, voltdm->name);
748 return;
749 }
750
751 /* If VP is already enabled, do nothing. Return */
752 if (vdd->vp_enabled)
753 return;
754
755 vp_latch_vsel(vdd);
756
757 /* Enable VP */
758 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
759 vpconfig |= vdd->vp_data->vp_common->vpconfig_vpenable;
760 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
761 vdd->vp_enabled = true;
762}
763
764/**
765 * omap_vp_disable() - API to disable a particular VP
766 * @voltdm: pointer to the VDD whose VP is to be disabled.
767 *
768 * This API disables a particular voltage processor. Needed by the smartreflex
769 * class drivers.
770 */
771void omap_vp_disable(struct voltagedomain *voltdm)
772{
773 struct omap_vdd_info *vdd;
774 u32 vpconfig;
775 int timeout;
776
777 if (!voltdm || IS_ERR(voltdm)) {
778 pr_warning("%s: VDD specified does not exist!\n", __func__);
779 return;
780 }
781
782 vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
783 if (!vdd->read_reg || !vdd->write_reg) {
784 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
785 __func__, voltdm->name);
786 return;
787 }
788
789 /* If VP is already disabled, do nothing. Return */
790 if (!vdd->vp_enabled) {
791 pr_warning("%s: Trying to disable VP for vdd_%s when"
792 "it is already disabled\n", __func__, voltdm->name);
793 return;
794 }
795
796 /* Disable VP */
797 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
798 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_vpenable;
799 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
800
801 /*
802 * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
803 */
804 omap_test_timeout((vdd->read_reg(prm_mod_offs, vdd->vp_data->vstatus)),
805 VP_IDLE_TIMEOUT, timeout);
806
807 if (timeout >= VP_IDLE_TIMEOUT)
808 pr_warning("%s: vdd_%s idle timedout\n",
809 __func__, voltdm->name);
810
811 vdd->vp_enabled = false;
812
813 return;
814}
815
816/**
817 * omap_voltage_scale_vdd() - API to scale voltage of a particular
818 * voltage domain.
819 * @voltdm: pointer to the VDD which is to be scaled.
820 * @target_volt: The target voltage of the voltage domain
821 * 68 *
822 * This API should be called by the kernel to do the voltage scaling 69 * This API should be called by the kernel to do the voltage scaling
823 * for a particular voltage domain during dvfs or any other situation. 70 * for a particular voltage domain during DVFS.
824 */ 71 */
825int omap_voltage_scale_vdd(struct voltagedomain *voltdm, 72int voltdm_scale(struct voltagedomain *voltdm,
826 unsigned long target_volt) 73 unsigned long target_volt)
827{ 74{
828 struct omap_vdd_info *vdd; 75 int ret;
829 76
830 if (!voltdm || IS_ERR(voltdm)) { 77 if (!voltdm || IS_ERR(voltdm)) {
831 pr_warning("%s: VDD specified does not exist!\n", __func__); 78 pr_warning("%s: VDD specified does not exist!\n", __func__);
832 return -EINVAL; 79 return -EINVAL;
833 } 80 }
834 81
835 vdd = container_of(voltdm, struct omap_vdd_info, voltdm); 82 if (!voltdm->scale) {
836
837 if (!vdd->volt_scale) {
838 pr_err("%s: No voltage scale API registered for vdd_%s\n", 83 pr_err("%s: No voltage scale API registered for vdd_%s\n",
839 __func__, voltdm->name); 84 __func__, voltdm->name);
840 return -ENODATA; 85 return -ENODATA;
841 } 86 }
842 87
843 return vdd->volt_scale(vdd, target_volt); 88 ret = voltdm->scale(voltdm, target_volt);
89 if (!ret)
90 voltdm->nominal_volt = target_volt;
91
92 return ret;
844} 93}
845 94
846/** 95/**
847 * omap_voltage_reset() - Resets the voltage of a particular voltage domain 96 * voltdm_reset() - Resets the voltage of a particular voltage domain
848 * to that of the current OPP. 97 * to that of the current OPP.
849 * @voltdm: pointer to the VDD whose voltage is to be reset. 98 * @voltdm: pointer to the voltage domain whose voltage is to be reset.
850 * 99 *
851 * This API finds out the correct voltage the voltage domain is supposed 100 * This API finds out the correct voltage the voltage domain is supposed
852 * to be at and resets the voltage to that level. Should be used especially 101 * to be at and resets the voltage to that level. Should be used especially
853 * while disabling any voltage compensation modules. 102 * while disabling any voltage compensation modules.
854 */ 103 */
855void omap_voltage_reset(struct voltagedomain *voltdm) 104void voltdm_reset(struct voltagedomain *voltdm)
856{ 105{
857 unsigned long target_uvdc; 106 unsigned long target_volt;
858 107
859 if (!voltdm || IS_ERR(voltdm)) { 108 if (!voltdm || IS_ERR(voltdm)) {
860 pr_warning("%s: VDD specified does not exist!\n", __func__); 109 pr_warning("%s: VDD specified does not exist!\n", __func__);
861 return; 110 return;
862 } 111 }
863 112
864 target_uvdc = omap_voltage_get_nom_volt(voltdm); 113 target_volt = voltdm_get_voltage(voltdm);
865 if (!target_uvdc) { 114 if (!target_volt) {
866 pr_err("%s: unable to find current voltage for vdd_%s\n", 115 pr_err("%s: unable to find current voltage for vdd_%s\n",
867 __func__, voltdm->name); 116 __func__, voltdm->name);
868 return; 117 return;
869 } 118 }
870 119
871 omap_voltage_scale_vdd(voltdm, target_uvdc); 120 voltdm_scale(voltdm, target_volt);
872} 121}
873 122
874/** 123/**
@@ -884,18 +133,14 @@ void omap_voltage_reset(struct voltagedomain *voltdm)
884 * 133 *
885 */ 134 */
886void omap_voltage_get_volttable(struct voltagedomain *voltdm, 135void omap_voltage_get_volttable(struct voltagedomain *voltdm,
887 struct omap_volt_data **volt_data) 136 struct omap_volt_data **volt_data)
888{ 137{
889 struct omap_vdd_info *vdd;
890
891 if (!voltdm || IS_ERR(voltdm)) { 138 if (!voltdm || IS_ERR(voltdm)) {
892 pr_warning("%s: VDD specified does not exist!\n", __func__); 139 pr_warning("%s: VDD specified does not exist!\n", __func__);
893 return; 140 return;
894 } 141 }
895 142
896 vdd = container_of(voltdm, struct omap_vdd_info, voltdm); 143 *volt_data = voltdm->volt_data;
897
898 *volt_data = vdd->volt_data;
899} 144}
900 145
901/** 146/**
@@ -914,9 +159,8 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
914 * domain or if there is no matching entry. 159 * domain or if there is no matching entry.
915 */ 160 */
916struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 161struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
917 unsigned long volt) 162 unsigned long volt)
918{ 163{
919 struct omap_vdd_info *vdd;
920 int i; 164 int i;
921 165
922 if (!voltdm || IS_ERR(voltdm)) { 166 if (!voltdm || IS_ERR(voltdm)) {
@@ -924,17 +168,15 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
924 return ERR_PTR(-EINVAL); 168 return ERR_PTR(-EINVAL);
925 } 169 }
926 170
927 vdd = container_of(voltdm, struct omap_vdd_info, voltdm); 171 if (!voltdm->volt_data) {
928
929 if (!vdd->volt_data) {
930 pr_warning("%s: voltage table does not exist for vdd_%s\n", 172 pr_warning("%s: voltage table does not exist for vdd_%s\n",
931 __func__, voltdm->name); 173 __func__, voltdm->name);
932 return ERR_PTR(-ENODATA); 174 return ERR_PTR(-ENODATA);
933 } 175 }
934 176
935 for (i = 0; vdd->volt_data[i].volt_nominal != 0; i++) { 177 for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
936 if (vdd->volt_data[i].volt_nominal == volt) 178 if (voltdm->volt_data[i].volt_nominal == volt)
937 return &vdd->volt_data[i]; 179 return &voltdm->volt_data[i];
938 } 180 }
939 181
940 pr_notice("%s: Unable to match the current voltage with the voltage" 182 pr_notice("%s: Unable to match the current voltage with the voltage"
@@ -947,54 +189,25 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
947 * omap_voltage_register_pmic() - API to register PMIC specific data 189 * omap_voltage_register_pmic() - API to register PMIC specific data
948 * @voltdm: pointer to the VDD for which the PMIC specific data is 190 * @voltdm: pointer to the VDD for which the PMIC specific data is
949 * to be registered 191 * to be registered
950 * @pmic_info: the structure containing pmic info 192 * @pmic: the structure containing pmic info
951 * 193 *
952 * This API is to be called by the SOC/PMIC file to specify the 194 * This API is to be called by the SOC/PMIC file to specify the
953 * pmic specific info as present in omap_volt_pmic_info structure. 195 * pmic specific info as present in omap_voltdm_pmic structure.
954 */ 196 */
955int omap_voltage_register_pmic(struct voltagedomain *voltdm, 197int omap_voltage_register_pmic(struct voltagedomain *voltdm,
956 struct omap_volt_pmic_info *pmic_info) 198 struct omap_voltdm_pmic *pmic)
957{ 199{
958 struct omap_vdd_info *vdd;
959
960 if (!voltdm || IS_ERR(voltdm)) { 200 if (!voltdm || IS_ERR(voltdm)) {
961 pr_warning("%s: VDD specified does not exist!\n", __func__); 201 pr_warning("%s: VDD specified does not exist!\n", __func__);
962 return -EINVAL; 202 return -EINVAL;
963 } 203 }
964 204
965 vdd = container_of(voltdm, struct omap_vdd_info, voltdm); 205 voltdm->pmic = pmic;
966
967 vdd->pmic_info = pmic_info;
968 206
969 return 0; 207 return 0;
970} 208}
971 209
972/** 210/**
973 * omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory
974 * corresponding to a voltage domain.
975 *
976 * @voltdm: pointer to the VDD whose debug directory is required.
977 *
978 * This API returns pointer to the debugfs directory corresponding
979 * to the voltage domain. Should be used by drivers requiring to
980 * add any debug entry for a particular voltage domain. Returns NULL
981 * in case of error.
982 */
983struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
984{
985 struct omap_vdd_info *vdd;
986
987 if (!voltdm || IS_ERR(voltdm)) {
988 pr_warning("%s: VDD specified does not exist!\n", __func__);
989 return NULL;
990 }
991
992 vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
993
994 return vdd->debug_dir;
995}
996
997/**
998 * omap_change_voltscale_method() - API to change the voltage scaling method. 211 * omap_change_voltscale_method() - API to change the voltage scaling method.
999 * @voltdm: pointer to the VDD whose voltage scaling method 212 * @voltdm: pointer to the VDD whose voltage scaling method
1000 * has to be changed. 213 * has to be changed.
@@ -1005,23 +218,19 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
1005 * defined in voltage.h 218 * defined in voltage.h
1006 */ 219 */
1007void omap_change_voltscale_method(struct voltagedomain *voltdm, 220void omap_change_voltscale_method(struct voltagedomain *voltdm,
1008 int voltscale_method) 221 int voltscale_method)
1009{ 222{
1010 struct omap_vdd_info *vdd;
1011
1012 if (!voltdm || IS_ERR(voltdm)) { 223 if (!voltdm || IS_ERR(voltdm)) {
1013 pr_warning("%s: VDD specified does not exist!\n", __func__); 224 pr_warning("%s: VDD specified does not exist!\n", __func__);
1014 return; 225 return;
1015 } 226 }
1016 227
1017 vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
1018
1019 switch (voltscale_method) { 228 switch (voltscale_method) {
1020 case VOLTSCALE_VPFORCEUPDATE: 229 case VOLTSCALE_VPFORCEUPDATE:
1021 vdd->volt_scale = vp_forceupdate_scale_voltage; 230 voltdm->scale = omap_vp_forceupdate_scale;
1022 return; 231 return;
1023 case VOLTSCALE_VCBYPASS: 232 case VOLTSCALE_VCBYPASS:
1024 vdd->volt_scale = vc_bypass_scale_voltage; 233 voltdm->scale = omap_vc_bypass_scale;
1025 return; 234 return;
1026 default: 235 default:
1027 pr_warning("%s: Trying to change the method of voltage scaling" 236 pr_warning("%s: Trying to change the method of voltage scaling"
@@ -1030,77 +239,192 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
1030} 239}
1031 240
1032/** 241/**
1033 * omap_voltage_domain_lookup() - API to get the voltage domain pointer 242 * omap_voltage_late_init() - Init the various voltage parameters
1034 * @name: Name of the voltage domain
1035 * 243 *
1036 * This API looks up in the global vdd_info struct for the 244 * This API is to be called in the later stages of the
1037 * existence of voltage domain <name>. If it exists, the API returns 245 * system boot to init the voltage controller and
1038 * a pointer to the voltage domain structure corresponding to the 246 * voltage processors.
1039 * VDD<name>. Else retuns error pointer.
1040 */ 247 */
1041struct voltagedomain *omap_voltage_domain_lookup(char *name) 248int __init omap_voltage_late_init(void)
1042{ 249{
1043 int i; 250 struct voltagedomain *voltdm;
1044 251
1045 if (!vdd_info) { 252 if (list_empty(&voltdm_list)) {
1046 pr_err("%s: Voltage driver init not yet happened.Faulting!\n", 253 pr_err("%s: Voltage driver support not added\n",
1047 __func__); 254 __func__);
1048 return ERR_PTR(-EINVAL); 255 return -EINVAL;
1049 } 256 }
1050 257
1051 if (!name) { 258 list_for_each_entry(voltdm, &voltdm_list, node) {
1052 pr_err("%s: No name to get the votage domain!\n", __func__); 259 struct clk *sys_ck;
1053 return ERR_PTR(-EINVAL); 260
261 if (!voltdm->scalable)
262 continue;
263
264 sys_ck = clk_get(NULL, voltdm->sys_clk.name);
265 if (IS_ERR(sys_ck)) {
266 pr_warning("%s: Could not get sys clk.\n", __func__);
267 return -EINVAL;
268 }
269 voltdm->sys_clk.rate = clk_get_rate(sys_ck);
270 WARN_ON(!voltdm->sys_clk.rate);
271 clk_put(sys_ck);
272
273 if (voltdm->vc) {
274 voltdm->scale = omap_vc_bypass_scale;
275 omap_vc_init_channel(voltdm);
276 }
277
278 if (voltdm->vp) {
279 voltdm->scale = omap_vp_forceupdate_scale;
280 omap_vp_init(voltdm);
281 }
1054 } 282 }
1055 283
1056 for (i = 0; i < nr_scalable_vdd; i++) { 284 return 0;
1057 if (!(strcmp(name, vdd_info[i]->voltdm.name))) 285}
1058 return &vdd_info[i]->voltdm; 286
287static struct voltagedomain *_voltdm_lookup(const char *name)
288{
289 struct voltagedomain *voltdm, *temp_voltdm;
290
291 voltdm = NULL;
292
293 list_for_each_entry(temp_voltdm, &voltdm_list, node) {
294 if (!strcmp(name, temp_voltdm->name)) {
295 voltdm = temp_voltdm;
296 break;
297 }
1059 } 298 }
1060 299
1061 return ERR_PTR(-EINVAL); 300 return voltdm;
1062} 301}
1063 302
1064/** 303/**
1065 * omap_voltage_late_init() - Init the various voltage parameters 304 * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
305 * @voltdm: struct voltagedomain * to add the powerdomain to
306 * @pwrdm: struct powerdomain * to associate with a voltagedomain
1066 * 307 *
1067 * This API is to be called in the later stages of the 308 * Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
1068 * system boot to init the voltage controller and 309 * enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
1069 * voltage processors. 310 * presented with invalid pointers; -ENOMEM if memory could not be allocated;
311 * or 0 upon success.
1070 */ 312 */
1071int __init omap_voltage_late_init(void) 313int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
1072{ 314{
1073 int i; 315 if (!voltdm || !pwrdm)
316 return -EINVAL;
1074 317
1075 if (!vdd_info) { 318 pr_debug("voltagedomain: associating powerdomain %s with voltagedomain "
1076 pr_err("%s: Voltage driver support not added\n", 319 "%s\n", pwrdm->name, voltdm->name);
1077 __func__); 320
321 list_add(&pwrdm->voltdm_node, &voltdm->pwrdm_list);
322
323 return 0;
324}
325
326/**
327 * voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
328 * @voltdm: struct voltagedomain * to iterate over
329 * @fn: callback function *
330 *
331 * Call the supplied function @fn for each powerdomain in the
332 * voltagedomain @voltdm. Returns -EINVAL if presented with invalid
333 * pointers; or passes along the last return value of the callback
334 * function, which should be 0 for success or anything else to
335 * indicate failure.
336 */
337int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
338 int (*fn)(struct voltagedomain *voltdm,
339 struct powerdomain *pwrdm))
340{
341 struct powerdomain *pwrdm;
342 int ret = 0;
343
344 if (!fn)
1078 return -EINVAL; 345 return -EINVAL;
1079 }
1080 346
1081 voltage_dir = debugfs_create_dir("voltage", NULL); 347 list_for_each_entry(pwrdm, &voltdm->pwrdm_list, voltdm_node)
1082 if (IS_ERR(voltage_dir)) 348 ret = (*fn)(voltdm, pwrdm);
1083 pr_err("%s: Unable to create voltage debugfs main dir\n", 349
1084 __func__); 350 return ret;
1085 for (i = 0; i < nr_scalable_vdd; i++) { 351}
1086 if (omap_vdd_data_configure(vdd_info[i])) 352
1087 continue; 353/**
1088 omap_vc_init(vdd_info[i]); 354 * voltdm_for_each - call function on each registered voltagedomain
1089 vp_init(vdd_info[i]); 355 * @fn: callback function *
1090 vdd_debugfs_init(vdd_info[i]); 356 *
357 * Call the supplied function @fn for each registered voltagedomain.
358 * The callback function @fn can return anything but 0 to bail out
359 * early from the iterator. Returns the last return value of the
360 * callback function, which should be 0 for success or anything else
361 * to indicate failure; or -EINVAL if the function pointer is null.
362 */
363int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
364 void *user)
365{
366 struct voltagedomain *temp_voltdm;
367 int ret = 0;
368
369 if (!fn)
370 return -EINVAL;
371
372 list_for_each_entry(temp_voltdm, &voltdm_list, node) {
373 ret = (*fn)(temp_voltdm, user);
374 if (ret)
375 break;
1091 } 376 }
1092 377
1093 return 0; 378 return ret;
1094} 379}
1095 380
1096/* XXX document */ 381static int _voltdm_register(struct voltagedomain *voltdm)
1097int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod,
1098 struct omap_vdd_info *omap_vdd_array[],
1099 u8 omap_vdd_count)
1100{ 382{
1101 prm_mod_offs = prm_mod; 383 if (!voltdm || !voltdm->name)
1102 prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod; 384 return -EINVAL;
1103 vdd_info = omap_vdd_array; 385
1104 nr_scalable_vdd = omap_vdd_count; 386 INIT_LIST_HEAD(&voltdm->pwrdm_list);
387 list_add(&voltdm->node, &voltdm_list);
388
389 pr_debug("voltagedomain: registered %s\n", voltdm->name);
390
1105 return 0; 391 return 0;
1106} 392}
393
394/**
395 * voltdm_lookup - look up a voltagedomain by name, return a pointer
396 * @name: name of voltagedomain
397 *
398 * Find a registered voltagedomain by its name @name. Returns a pointer
399 * to the struct voltagedomain if found, or NULL otherwise.
400 */
401struct voltagedomain *voltdm_lookup(const char *name)
402{
403 struct voltagedomain *voltdm ;
404
405 if (!name)
406 return NULL;
407
408 voltdm = _voltdm_lookup(name);
409
410 return voltdm;
411}
412
413/**
414 * voltdm_init - set up the voltagedomain layer
415 * @voltdm_list: array of struct voltagedomain pointers to register
416 *
417 * Loop through the array of voltagedomains @voltdm_list, registering all
418 * that are available on the current CPU. If voltdm_list is supplied
419 * and not null, all of the referenced voltagedomains will be
420 * registered. No return value.
421 */
422void voltdm_init(struct voltagedomain **voltdms)
423{
424 struct voltagedomain **v;
425
426 if (voltdms) {
427 for (v = voltdms; *v; v++)
428 _voltdm_register(*v);
429 }
430}
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index e9f5408244e0..16a1b092cf36 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -19,6 +19,8 @@
19#include "vc.h" 19#include "vc.h"
20#include "vp.h" 20#include "vp.h"
21 21
22struct powerdomain;
23
22/* XXX document */ 24/* XXX document */
23#define VOLTSCALE_VPFORCEUPDATE 1 25#define VOLTSCALE_VPFORCEUPDATE 1
24#define VOLTSCALE_VCBYPASS 2 26#define VOLTSCALE_VCBYPASS 2
@@ -32,29 +34,60 @@
32#define OMAP3_VOLTSETUP2 0xff 34#define OMAP3_VOLTSETUP2 0xff
33 35
34/** 36/**
35 * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield 37 * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
36 * data 38 * data
37 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register 39 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
38 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base 40 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
39 * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register
40 * 41 *
41 * XXX What about VOLTOFFSET/VOLTCTRL? 42 * XXX What about VOLTOFFSET/VOLTCTRL?
42 * XXX It is not necessary to have both a _mask and a _shift for the same
43 * bitfield - remove one!
44 */ 43 */
45struct omap_vfsm_instance_data { 44struct omap_vfsm_instance {
46 u32 voltsetup_mask; 45 u32 voltsetup_mask;
47 u8 voltsetup_reg; 46 u8 voltsetup_reg;
48 u8 voltsetup_shift;
49}; 47};
50 48
51/** 49/**
52 * struct voltagedomain - omap voltage domain global structure. 50 * struct voltagedomain - omap voltage domain global structure.
53 * @name: Name of the voltage domain which can be used as a unique 51 * @name: Name of the voltage domain which can be used as a unique identifier.
54 * identifier. 52 * @scalable: Whether or not this voltage domain is scalable
53 * @node: list_head linking all voltage domains
54 * @pwrdm_list: list_head linking all powerdomains in this voltagedomain
55 * @vc: pointer to VC channel associated with this voltagedomain
56 * @vp: pointer to VP associated with this voltagedomain
57 * @read: read a VC/VP register
58 * @write: write a VC/VP register
59 * @read: read-modify-write a VC/VP register
60 * @sys_clk: system clock name/frequency, used for various timing calculations
61 * @scale: function used to scale the voltage of the voltagedomain
62 * @nominal_volt: current nominal voltage for this voltage domain
63 * @volt_data: voltage table having the distinct voltages supported
64 * by the domain and other associated per voltage data.
55 */ 65 */
56struct voltagedomain { 66struct voltagedomain {
57 char *name; 67 char *name;
68 bool scalable;
69 struct list_head node;
70 struct list_head pwrdm_list;
71 struct omap_vc_channel *vc;
72 const struct omap_vfsm_instance *vfsm;
73 struct omap_vp_instance *vp;
74 struct omap_voltdm_pmic *pmic;
75
76 /* VC/VP register access functions: SoC specific */
77 u32 (*read) (u8 offset);
78 void (*write) (u32 val, u8 offset);
79 u32 (*rmw)(u32 mask, u32 bits, u8 offset);
80
81 union {
82 const char *name;
83 u32 rate;
84 } sys_clk;
85
86 int (*scale) (struct voltagedomain *voltdm,
87 unsigned long target_volt);
88
89 u32 nominal_volt;
90 struct omap_volt_data *volt_data;
58}; 91};
59 92
60/** 93/**
@@ -77,13 +110,18 @@ struct omap_volt_data {
77}; 110};
78 111
79/** 112/**
80 * struct omap_volt_pmic_info - PMIC specific data required by voltage driver. 113 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
81 * @slew_rate: PMIC slew rate (in uv/us) 114 * @slew_rate: PMIC slew rate (in uv/us)
82 * @step_size: PMIC voltage step size (in uv) 115 * @step_size: PMIC voltage step size (in uv)
116 * @i2c_slave_addr: I2C slave address of PMIC
117 * @volt_reg_addr: voltage configuration register address
118 * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address
119 * @i2c_high_speed: whether VC uses I2C high-speed mode to PMIC
120 * @i2c_mcode: master code value for I2C high-speed preamble transmission
83 * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV. 121 * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
84 * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value. 122 * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
85 */ 123 */
86struct omap_volt_pmic_info { 124struct omap_voltdm_pmic {
87 int slew_rate; 125 int slew_rate;
88 int step_size; 126 int step_size;
89 u32 on_volt; 127 u32 on_volt;
@@ -91,94 +129,44 @@ struct omap_volt_pmic_info {
91 u32 ret_volt; 129 u32 ret_volt;
92 u32 off_volt; 130 u32 off_volt;
93 u16 volt_setup_time; 131 u16 volt_setup_time;
132 u16 i2c_slave_addr;
133 u16 volt_reg_addr;
134 u16 cmd_reg_addr;
94 u8 vp_erroroffset; 135 u8 vp_erroroffset;
95 u8 vp_vstepmin; 136 u8 vp_vstepmin;
96 u8 vp_vstepmax; 137 u8 vp_vstepmax;
97 u8 vp_vddmin; 138 u8 vp_vddmin;
98 u8 vp_vddmax; 139 u8 vp_vddmax;
99 u8 vp_timeout_us; 140 u8 vp_timeout_us;
100 u8 i2c_slave_addr; 141 bool i2c_high_speed;
101 u8 pmic_reg; 142 u8 i2c_mcode;
102 unsigned long (*vsel_to_uv) (const u8 vsel); 143 unsigned long (*vsel_to_uv) (const u8 vsel);
103 u8 (*uv_to_vsel) (unsigned long uV); 144 u8 (*uv_to_vsel) (unsigned long uV);
104}; 145};
105 146
106/**
107 * omap_vdd_info - Per Voltage Domain info
108 *
109 * @volt_data : voltage table having the distinct voltages supported
110 * by the domain and other associated per voltage data.
111 * @pmic_info : pmic specific parameters which should be populted by
112 * the pmic drivers.
113 * @vp_data : the register values, shifts, masks for various
114 * vp registers
115 * @vp_rt_data : VP data derived at runtime, not predefined
116 * @vc_data : structure containing various various vc registers,
117 * shifts, masks etc.
118 * @vfsm : voltage manager FSM data
119 * @voltdm : pointer to the voltage domain structure
120 * @debug_dir : debug directory for this voltage domain.
121 * @curr_volt : current voltage for this vdd.
122 * @vp_enabled : flag to keep track of whether vp is enabled or not
123 * @volt_scale : API to scale the voltage of the vdd.
124 */
125struct omap_vdd_info {
126 struct omap_volt_data *volt_data;
127 struct omap_volt_pmic_info *pmic_info;
128 struct omap_vp_instance_data *vp_data;
129 struct omap_vp_runtime_data vp_rt_data;
130 struct omap_vc_instance_data *vc_data;
131 const struct omap_vfsm_instance_data *vfsm;
132 struct voltagedomain voltdm;
133 struct dentry *debug_dir;
134 u32 curr_volt;
135 bool vp_enabled;
136 u32 (*read_reg) (u16 mod, u8 offset);
137 void (*write_reg) (u32 val, u16 mod, u8 offset);
138 int (*volt_scale) (struct omap_vdd_info *vdd,
139 unsigned long target_volt);
140};
141
142unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
143void omap_vp_enable(struct voltagedomain *voltdm);
144void omap_vp_disable(struct voltagedomain *voltdm);
145int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
146 unsigned long target_volt);
147void omap_voltage_reset(struct voltagedomain *voltdm);
148void omap_voltage_get_volttable(struct voltagedomain *voltdm, 147void omap_voltage_get_volttable(struct voltagedomain *voltdm,
149 struct omap_volt_data **volt_data); 148 struct omap_volt_data **volt_data);
150struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 149struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
151 unsigned long volt); 150 unsigned long volt);
152unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
153struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
154int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
155 struct omap_vdd_info *omap_vdd_array[],
156 u8 omap_vdd_count);
157#ifdef CONFIG_PM
158int omap_voltage_register_pmic(struct voltagedomain *voltdm, 151int omap_voltage_register_pmic(struct voltagedomain *voltdm,
159 struct omap_volt_pmic_info *pmic_info); 152 struct omap_voltdm_pmic *pmic);
160void omap_change_voltscale_method(struct voltagedomain *voltdm, 153void omap_change_voltscale_method(struct voltagedomain *voltdm,
161 int voltscale_method); 154 int voltscale_method);
162/* API to get the voltagedomain pointer */
163struct voltagedomain *omap_voltage_domain_lookup(char *name);
164
165int omap_voltage_late_init(void); 155int omap_voltage_late_init(void);
166#else
167static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
168 struct omap_volt_pmic_info *pmic_info)
169{
170 return -EINVAL;
171}
172static inline void omap_change_voltscale_method(struct voltagedomain *voltdm,
173 int voltscale_method) {}
174static inline int omap_voltage_late_init(void)
175{
176 return -EINVAL;
177}
178static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
179{
180 return ERR_PTR(-EINVAL);
181}
182#endif
183 156
157extern void omap2xxx_voltagedomains_init(void);
158extern void omap3xxx_voltagedomains_init(void);
159extern void omap44xx_voltagedomains_init(void);
160
161struct voltagedomain *voltdm_lookup(const char *name);
162void voltdm_init(struct voltagedomain **voltdm_list);
163int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
164int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
165 void *user);
166int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
167 int (*fn)(struct voltagedomain *voltdm,
168 struct powerdomain *pwrdm));
169int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
170void voltdm_reset(struct voltagedomain *voltdm);
171unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
184#endif 172#endif
diff --git a/arch/arm/mach-omap2/voltagedomains2xxx_data.c b/arch/arm/mach-omap2/voltagedomains2xxx_data.c
new file mode 100644
index 000000000000..7a41349981e5
--- /dev/null
+++ b/arch/arm/mach-omap2/voltagedomains2xxx_data.c
@@ -0,0 +1,32 @@
1/*
2 * OMAP3 voltage domain data
3 *
4 * Copyright (C) 2011 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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12
13#include "voltage.h"
14
15static struct voltagedomain omap2_voltdm_core = {
16 .name = "core",
17};
18
19static struct voltagedomain omap2_voltdm_wkup = {
20 .name = "wakeup",
21};
22
23static struct voltagedomain *voltagedomains_omap2[] __initdata = {
24 &omap2_voltdm_core,
25 &omap2_voltdm_wkup,
26 NULL,
27};
28
29void __init omap2xxx_voltagedomains_init(void)
30{
31 voltdm_init(voltagedomains_omap2);
32}
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index def230fd2fde..071101debbbc 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -31,65 +31,70 @@
31 * VDD data 31 * VDD data
32 */ 32 */
33 33
34static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = { 34static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
35 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, 35 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
36 .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT,
37 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, 36 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
38}; 37};
39 38
40static struct omap_vdd_info omap3_vdd1_info = { 39static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
41 .vp_data = &omap3_vp1_data,
42 .vc_data = &omap3_vc1_data,
43 .vfsm = &omap3_vdd1_vfsm_data,
44 .voltdm = {
45 .name = "mpu",
46 },
47};
48
49static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
50 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, 40 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
51 .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT,
52 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, 41 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
53}; 42};
54 43
55static struct omap_vdd_info omap3_vdd2_info = { 44static struct voltagedomain omap3_voltdm_mpu = {
56 .vp_data = &omap3_vp2_data, 45 .name = "mpu_iva",
57 .vc_data = &omap3_vc2_data, 46 .scalable = true,
58 .vfsm = &omap3_vdd2_vfsm_data, 47 .read = omap3_prm_vcvp_read,
59 .voltdm = { 48 .write = omap3_prm_vcvp_write,
60 .name = "core", 49 .rmw = omap3_prm_vcvp_rmw,
61 }, 50 .vc = &omap3_vc_mpu,
51 .vfsm = &omap3_vdd1_vfsm,
52 .vp = &omap3_vp_mpu,
62}; 53};
63 54
64/* OMAP3 VDD structures */ 55static struct voltagedomain omap3_voltdm_core = {
65static struct omap_vdd_info *omap3_vdd_info[] = { 56 .name = "core",
66 &omap3_vdd1_info, 57 .scalable = true,
67 &omap3_vdd2_info, 58 .read = omap3_prm_vcvp_read,
59 .write = omap3_prm_vcvp_write,
60 .rmw = omap3_prm_vcvp_rmw,
61 .vc = &omap3_vc_core,
62 .vfsm = &omap3_vdd2_vfsm,
63 .vp = &omap3_vp_core,
68}; 64};
69 65
70/* OMAP3 specific voltage init functions */ 66static struct voltagedomain omap3_voltdm_wkup = {
71static int __init omap3xxx_voltage_early_init(void) 67 .name = "wakeup",
72{ 68};
73 s16 prm_mod = OMAP3430_GR_MOD;
74 s16 prm_irqst_ocp_mod = OCP_MOD;
75 69
76 if (!cpu_is_omap34xx()) 70static struct voltagedomain *voltagedomains_omap3[] __initdata = {
77 return 0; 71 &omap3_voltdm_mpu,
72 &omap3_voltdm_core,
73 &omap3_voltdm_wkup,
74 NULL,
75};
76
77static const char *sys_clk_name __initdata = "sys_ck";
78
79void __init omap3xxx_voltagedomains_init(void)
80{
81 struct voltagedomain *voltdm;
82 int i;
78 83
79 /* 84 /*
80 * XXX Will depend on the process, validation, and binning 85 * XXX Will depend on the process, validation, and binning
81 * for the currently-running IC 86 * for the currently-running IC
82 */ 87 */
83 if (cpu_is_omap3630()) { 88 if (cpu_is_omap3630()) {
84 omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data; 89 omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
85 omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data; 90 omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
86 } else { 91 } else {
87 omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data; 92 omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
88 omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data; 93 omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
89 } 94 }
90 95
91 return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod, 96 for (i = 0; voltdm = voltagedomains_omap3[i], voltdm; i++)
92 omap3_vdd_info, 97 voltdm->sys_clk.name = sys_clk_name;
93 ARRAY_SIZE(omap3_vdd_info)); 98
99 voltdm_init(voltagedomains_omap3);
94}; 100};
95core_initcall(omap3xxx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index cb64996de0e1..c4584e9ac717 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -32,71 +32,80 @@
32#include "vc.h" 32#include "vc.h"
33#include "vp.h" 33#include "vp.h"
34 34
35static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = { 35static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, 36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
37}; 37};
38 38
39static struct omap_vdd_info omap4_vdd_mpu_info = { 39static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
40 .vp_data = &omap4_vp_mpu_data, 40 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
41 .vc_data = &omap4_vc_mpu_data,
42 .vfsm = &omap4_vdd_mpu_vfsm_data,
43 .voltdm = {
44 .name = "mpu",
45 },
46}; 41};
47 42
48static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = { 43static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
49 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, 44 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
50}; 45};
51 46
52static struct omap_vdd_info omap4_vdd_iva_info = { 47static struct voltagedomain omap4_voltdm_mpu = {
53 .vp_data = &omap4_vp_iva_data, 48 .name = "mpu",
54 .vc_data = &omap4_vc_iva_data, 49 .scalable = true,
55 .vfsm = &omap4_vdd_iva_vfsm_data, 50 .read = omap4_prm_vcvp_read,
56 .voltdm = { 51 .write = omap4_prm_vcvp_write,
57 .name = "iva", 52 .rmw = omap4_prm_vcvp_rmw,
58 }, 53 .vc = &omap4_vc_mpu,
54 .vfsm = &omap4_vdd_mpu_vfsm,
55 .vp = &omap4_vp_mpu,
59}; 56};
60 57
61static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = { 58static struct voltagedomain omap4_voltdm_iva = {
62 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, 59 .name = "iva",
60 .scalable = true,
61 .read = omap4_prm_vcvp_read,
62 .write = omap4_prm_vcvp_write,
63 .rmw = omap4_prm_vcvp_rmw,
64 .vc = &omap4_vc_iva,
65 .vfsm = &omap4_vdd_iva_vfsm,
66 .vp = &omap4_vp_iva,
63}; 67};
64 68
65static struct omap_vdd_info omap4_vdd_core_info = { 69static struct voltagedomain omap4_voltdm_core = {
66 .vp_data = &omap4_vp_core_data, 70 .name = "core",
67 .vc_data = &omap4_vc_core_data, 71 .scalable = true,
68 .vfsm = &omap4_vdd_core_vfsm_data, 72 .read = omap4_prm_vcvp_read,
69 .voltdm = { 73 .write = omap4_prm_vcvp_write,
70 .name = "core", 74 .rmw = omap4_prm_vcvp_rmw,
71 }, 75 .vc = &omap4_vc_core,
76 .vfsm = &omap4_vdd_core_vfsm,
77 .vp = &omap4_vp_core,
72}; 78};
73 79
74/* OMAP4 VDD structures */ 80static struct voltagedomain omap4_voltdm_wkup = {
75static struct omap_vdd_info *omap4_vdd_info[] = { 81 .name = "wakeup",
76 &omap4_vdd_mpu_info,
77 &omap4_vdd_iva_info,
78 &omap4_vdd_core_info,
79}; 82};
80 83
81/* OMAP4 specific voltage init functions */ 84static struct voltagedomain *voltagedomains_omap4[] __initdata = {
82static int __init omap44xx_voltage_early_init(void) 85 &omap4_voltdm_mpu,
83{ 86 &omap4_voltdm_iva,
84 s16 prm_mod = OMAP4430_PRM_DEVICE_INST; 87 &omap4_voltdm_core,
85 s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST; 88 &omap4_voltdm_wkup,
89 NULL,
90};
91
92static const char *sys_clk_name __initdata = "sys_clkin_ck";
86 93
87 if (!cpu_is_omap44xx()) 94void __init omap44xx_voltagedomains_init(void)
88 return 0; 95{
96 struct voltagedomain *voltdm;
97 int i;
89 98
90 /* 99 /*
91 * XXX Will depend on the process, validation, and binning 100 * XXX Will depend on the process, validation, and binning
92 * for the currently-running IC 101 * for the currently-running IC
93 */ 102 */
94 omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data; 103 omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data;
95 omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data; 104 omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data;
96 omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data; 105 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
106
107 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
108 voltdm->sys_clk.name = sys_clk_name;
97 109
98 return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod, 110 voltdm_init(voltagedomains_omap4);
99 omap4_vdd_info,
100 ARRAY_SIZE(omap4_vdd_info));
101}; 111};
102core_initcall(omap44xx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
new file mode 100644
index 000000000000..66bd700a2b98
--- /dev/null
+++ b/arch/arm/mach-omap2/vp.c
@@ -0,0 +1,278 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3
4#include <plat/common.h>
5
6#include "voltage.h"
7#include "vp.h"
8#include "prm-regbits-34xx.h"
9#include "prm-regbits-44xx.h"
10#include "prm44xx.h"
11
12static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt)
13{
14 struct omap_vp_instance *vp = voltdm->vp;
15 u32 vpconfig;
16 char vsel;
17
18 vsel = voltdm->pmic->uv_to_vsel(volt);
19
20 vpconfig = voltdm->read(vp->vpconfig);
21 vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
22 vp->common->vpconfig_forceupdate |
23 vp->common->vpconfig_initvdd);
24 vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask);
25 voltdm->write(vpconfig, vp->vpconfig);
26
27 /* Trigger initVDD value copy to voltage processor */
28 voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
29 vp->vpconfig);
30
31 /* Clear initVDD copy trigger bit */
32 voltdm->write(vpconfig, vp->vpconfig);
33
34 return vpconfig;
35}
36
37/* Generic voltage init functions */
38void __init omap_vp_init(struct voltagedomain *voltdm)
39{
40 struct omap_vp_instance *vp = voltdm->vp;
41 u32 val, sys_clk_rate, timeout, waittime;
42 u32 vddmin, vddmax, vstepmin, vstepmax;
43
44 if (!voltdm->read || !voltdm->write) {
45 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
46 __func__, voltdm->name);
47 return;
48 }
49
50 vp->enabled = false;
51
52 /* Divide to avoid overflow */
53 sys_clk_rate = voltdm->sys_clk.rate / 1000;
54
55 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
56 vddmin = voltdm->pmic->vp_vddmin;
57 vddmax = voltdm->pmic->vp_vddmax;
58
59 waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
60 sys_clk_rate) / 1000;
61 vstepmin = voltdm->pmic->vp_vstepmin;
62 vstepmax = voltdm->pmic->vp_vstepmax;
63
64 /*
65 * VP_CONFIG: error gain is not set here, it will be updated
66 * on each scale, based on OPP.
67 */
68 val = (voltdm->pmic->vp_erroroffset <<
69 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
70 vp->common->vpconfig_timeouten;
71 voltdm->write(val, vp->vpconfig);
72
73 /* VSTEPMIN */
74 val = (waittime << vp->common->vstepmin_smpswaittimemin_shift) |
75 (vstepmin << vp->common->vstepmin_stepmin_shift);
76 voltdm->write(val, vp->vstepmin);
77
78 /* VSTEPMAX */
79 val = (vstepmax << vp->common->vstepmax_stepmax_shift) |
80 (waittime << vp->common->vstepmax_smpswaittimemax_shift);
81 voltdm->write(val, vp->vstepmax);
82
83 /* VLIMITTO */
84 val = (vddmax << vp->common->vlimitto_vddmax_shift) |
85 (vddmin << vp->common->vlimitto_vddmin_shift) |
86 (timeout << vp->common->vlimitto_timeout_shift);
87 voltdm->write(val, vp->vlimitto);
88}
89
90int omap_vp_update_errorgain(struct voltagedomain *voltdm,
91 unsigned long target_volt)
92{
93 struct omap_volt_data *volt_data;
94
95 if (!voltdm->vp)
96 return -EINVAL;
97
98 /* Get volt_data corresponding to target_volt */
99 volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
100 if (IS_ERR(volt_data))
101 return -EINVAL;
102
103 /* Setting vp errorgain based on the voltage */
104 voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
105 volt_data->vp_errgain <<
106 __ffs(voltdm->vp->common->vpconfig_errorgain_mask),
107 voltdm->vp->vpconfig);
108
109 return 0;
110}
111
112/* VP force update method of voltage scaling */
113int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
114 unsigned long target_volt)
115{
116 struct omap_vp_instance *vp = voltdm->vp;
117 u32 vpconfig;
118 u8 target_vsel, current_vsel;
119 int ret, timeout = 0;
120
121 ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, &current_vsel);
122 if (ret)
123 return ret;
124
125 /*
126 * Clear all pending TransactionDone interrupt/status. Typical latency
127 * is <3us
128 */
129 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
130 vp->common->ops->clear_txdone(vp->id);
131 if (!vp->common->ops->check_txdone(vp->id))
132 break;
133 udelay(1);
134 }
135 if (timeout >= VP_TRANXDONE_TIMEOUT) {
136 pr_warning("%s: vdd_%s TRANXDONE timeout exceeded."
137 "Voltage change aborted", __func__, voltdm->name);
138 return -ETIMEDOUT;
139 }
140
141 vpconfig = _vp_set_init_voltage(voltdm, target_volt);
142
143 /* Force update of voltage */
144 voltdm->write(vpconfig | vp->common->vpconfig_forceupdate,
145 voltdm->vp->vpconfig);
146
147 /*
148 * Wait for TransactionDone. Typical latency is <200us.
149 * Depends on SMPSWAITTIMEMIN/MAX and voltage change
150 */
151 timeout = 0;
152 omap_test_timeout(vp->common->ops->check_txdone(vp->id),
153 VP_TRANXDONE_TIMEOUT, timeout);
154 if (timeout >= VP_TRANXDONE_TIMEOUT)
155 pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
156 "TRANXDONE never got set after the voltage update\n",
157 __func__, voltdm->name);
158
159 omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel);
160
161 /*
162 * Disable TransactionDone interrupt , clear all status, clear
163 * control registers
164 */
165 timeout = 0;
166 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
167 vp->common->ops->clear_txdone(vp->id);
168 if (!vp->common->ops->check_txdone(vp->id))
169 break;
170 udelay(1);
171 }
172
173 if (timeout >= VP_TRANXDONE_TIMEOUT)
174 pr_warning("%s: vdd_%s TRANXDONE timeout exceeded while trying"
175 "to clear the TRANXDONE status\n",
176 __func__, voltdm->name);
177
178 /* Clear force bit */
179 voltdm->write(vpconfig, vp->vpconfig);
180
181 return 0;
182}
183
184/**
185 * omap_vp_enable() - API to enable a particular VP
186 * @voltdm: pointer to the VDD whose VP is to be enabled.
187 *
188 * This API enables a particular voltage processor. Needed by the smartreflex
189 * class drivers.
190 */
191void omap_vp_enable(struct voltagedomain *voltdm)
192{
193 struct omap_vp_instance *vp;
194 u32 vpconfig, volt;
195
196 if (!voltdm || IS_ERR(voltdm)) {
197 pr_warning("%s: VDD specified does not exist!\n", __func__);
198 return;
199 }
200
201 vp = voltdm->vp;
202 if (!voltdm->read || !voltdm->write) {
203 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
204 __func__, voltdm->name);
205 return;
206 }
207
208 /* If VP is already enabled, do nothing. Return */
209 if (vp->enabled)
210 return;
211
212 volt = voltdm_get_voltage(voltdm);
213 if (!volt) {
214 pr_warning("%s: unable to find current voltage for %s\n",
215 __func__, voltdm->name);
216 return;
217 }
218
219 vpconfig = _vp_set_init_voltage(voltdm, volt);
220
221 /* Enable VP */
222 vpconfig |= vp->common->vpconfig_vpenable;
223 voltdm->write(vpconfig, vp->vpconfig);
224
225 vp->enabled = true;
226}
227
228/**
229 * omap_vp_disable() - API to disable a particular VP
230 * @voltdm: pointer to the VDD whose VP is to be disabled.
231 *
232 * This API disables a particular voltage processor. Needed by the smartreflex
233 * class drivers.
234 */
235void omap_vp_disable(struct voltagedomain *voltdm)
236{
237 struct omap_vp_instance *vp;
238 u32 vpconfig;
239 int timeout;
240
241 if (!voltdm || IS_ERR(voltdm)) {
242 pr_warning("%s: VDD specified does not exist!\n", __func__);
243 return;
244 }
245
246 vp = voltdm->vp;
247 if (!voltdm->read || !voltdm->write) {
248 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
249 __func__, voltdm->name);
250 return;
251 }
252
253 /* If VP is already disabled, do nothing. Return */
254 if (!vp->enabled) {
255 pr_warning("%s: Trying to disable VP for vdd_%s when"
256 "it is already disabled\n", __func__, voltdm->name);
257 return;
258 }
259
260 /* Disable VP */
261 vpconfig = voltdm->read(vp->vpconfig);
262 vpconfig &= ~vp->common->vpconfig_vpenable;
263 voltdm->write(vpconfig, vp->vpconfig);
264
265 /*
266 * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
267 */
268 omap_test_timeout((voltdm->read(vp->vstatus)),
269 VP_IDLE_TIMEOUT, timeout);
270
271 if (timeout >= VP_IDLE_TIMEOUT)
272 pr_warning("%s: vdd_%s idle timedout\n",
273 __func__, voltdm->name);
274
275 vp->enabled = false;
276
277 return;
278}
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7ce134f7de79..7c155d248aa3 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -19,44 +19,60 @@
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21 21
22struct voltagedomain;
23
24/*
25 * Voltage Processor (VP) identifiers
26 */
27#define OMAP3_VP_VDD_MPU_ID 0
28#define OMAP3_VP_VDD_CORE_ID 1
29#define OMAP4_VP_VDD_CORE_ID 0
30#define OMAP4_VP_VDD_IVA_ID 1
31#define OMAP4_VP_VDD_MPU_ID 2
32
22/* XXX document */ 33/* XXX document */
23#define VP_IDLE_TIMEOUT 200 34#define VP_IDLE_TIMEOUT 200
24#define VP_TRANXDONE_TIMEOUT 300 35#define VP_TRANXDONE_TIMEOUT 300
25 36
37/**
38 * struct omap_vp_ops - per-VP operations
39 * @check_txdone: check for VP transaction done
40 * @clear_txdone: clear VP transaction done status
41 */
42struct omap_vp_ops {
43 u32 (*check_txdone)(u8 vp_id);
44 void (*clear_txdone)(u8 vp_id);
45};
26 46
27/** 47/**
28 * struct omap_vp_common_data - register data common to all VDDs 48 * struct omap_vp_common - register data common to all VDDs
49 * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
29 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg 50 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
30 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg 51 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
31 * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg 52 * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
32 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg 53 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
33 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg 54 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
34 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg 55 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
35 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg 56 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
36 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg 57 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
37 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg 58 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
38 * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg 59 * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
39 * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg 60 * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
40 * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg 61 * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
41 * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg 62 * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
42 * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg 63 * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
43 * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg 64 * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
44 * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg 65 * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
45 * 66 * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
46 * XXX It it not necessary to have both a mask and a shift for the same
47 * bitfield - remove one
48 * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
49 */ 67 */
50struct omap_vp_common_data { 68struct omap_vp_common {
69 u32 vpconfig_erroroffset_mask;
51 u32 vpconfig_errorgain_mask; 70 u32 vpconfig_errorgain_mask;
52 u32 vpconfig_initvoltage_mask; 71 u32 vpconfig_initvoltage_mask;
53 u32 vpconfig_timeouten; 72 u8 vpconfig_timeouten;
54 u32 vpconfig_initvdd; 73 u8 vpconfig_initvdd;
55 u32 vpconfig_forceupdate; 74 u8 vpconfig_forceupdate;
56 u32 vpconfig_vpenable; 75 u8 vpconfig_vpenable;
57 u8 vpconfig_erroroffset_shift;
58 u8 vpconfig_errorgain_shift;
59 u8 vpconfig_initvoltage_shift;
60 u8 vstepmin_stepmin_shift; 76 u8 vstepmin_stepmin_shift;
61 u8 vstepmin_smpswaittimemin_shift; 77 u8 vstepmin_smpswaittimemin_shift;
62 u8 vstepmax_stepmax_shift; 78 u8 vstepmax_stepmax_shift;
@@ -64,80 +80,49 @@ struct omap_vp_common_data {
64 u8 vlimitto_vddmin_shift; 80 u8 vlimitto_vddmin_shift;
65 u8 vlimitto_vddmax_shift; 81 u8 vlimitto_vddmax_shift;
66 u8 vlimitto_timeout_shift; 82 u8 vlimitto_timeout_shift;
67}; 83 u8 vpvoltage_mask;
68 84
69/** 85 const struct omap_vp_ops *ops;
70 * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
71 * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
72 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
73 *
74 * XXX prm_irqst_reg does not belong here
75 * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
76 * hardware bug
77 * XXX This structure is probably not needed
78 */
79struct omap_vp_prm_irqst_data {
80 u8 prm_irqst_reg;
81 u32 tranxdone_status;
82}; 86};
83 87
84/** 88/**
85 * struct omap_vp_instance_data - VP register offsets (per-VDD) 89 * struct omap_vp_instance - VP register offsets (per-VDD)
86 * @vp_common: pointer to struct omap_vp_common_data * for this SoC 90 * @common: pointer to struct omap_vp_common * for this SoC
87 * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
88 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start 91 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
89 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start 92 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
90 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start 93 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
91 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start 94 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
92 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start 95 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
96 * @id: Unique identifier for VP instance.
97 * @enabled: flag to keep track of whether vp is enabled or not
93 * 98 *
94 * XXX vp_common is probably not needed since it is per-SoC 99 * XXX vp_common is probably not needed since it is per-SoC
95 */ 100 */
96struct omap_vp_instance_data { 101struct omap_vp_instance {
97 const struct omap_vp_common_data *vp_common; 102 const struct omap_vp_common *common;
98 const struct omap_vp_prm_irqst_data *prm_irqst_data;
99 u8 vpconfig; 103 u8 vpconfig;
100 u8 vstepmin; 104 u8 vstepmin;
101 u8 vstepmax; 105 u8 vstepmax;
102 u8 vlimitto; 106 u8 vlimitto;
103 u8 vstatus; 107 u8 vstatus;
104 u8 voltage; 108 u8 voltage;
109 u8 id;
110 bool enabled;
105}; 111};
106 112
107/** 113extern struct omap_vp_instance omap3_vp_mpu;
108 * struct omap_vp_runtime_data - VP data populated at runtime by code 114extern struct omap_vp_instance omap3_vp_core;
109 * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
110 * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
111 * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
112 * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
113 * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
114 * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
115 * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
116 * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
117 * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
118 *
119 * XXX Is this structure really needed? Why not just program the
120 * device directly? They are in PRM space, therefore in the WKUP
121 * powerdomain, so register contents should not be lost in off-mode.
122 * XXX Some of these fields are incorrectly named, e.g., vstep*
123 */
124struct omap_vp_runtime_data {
125 u32 vpconfig_erroroffset;
126 u16 vpconfig_errorgain;
127 u16 vstepmin_smpswaittimemin;
128 u16 vstepmax_smpswaittimemax;
129 u16 vlimitto_timeout;
130 u8 vstepmin_stepmin;
131 u8 vstepmax_stepmax;
132 u8 vlimitto_vddmin;
133 u8 vlimitto_vddmax;
134};
135 115
136extern struct omap_vp_instance_data omap3_vp1_data; 116extern struct omap_vp_instance omap4_vp_mpu;
137extern struct omap_vp_instance_data omap3_vp2_data; 117extern struct omap_vp_instance omap4_vp_iva;
118extern struct omap_vp_instance omap4_vp_core;
138 119
139extern struct omap_vp_instance_data omap4_vp_mpu_data; 120void omap_vp_init(struct voltagedomain *voltdm);
140extern struct omap_vp_instance_data omap4_vp_iva_data; 121void omap_vp_enable(struct voltagedomain *voltdm);
141extern struct omap_vp_instance_data omap4_vp_core_data; 122void omap_vp_disable(struct voltagedomain *voltdm);
123int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
124 unsigned long target_volt);
125int omap_vp_update_errorgain(struct voltagedomain *voltdm,
126 unsigned long target_volt);
142 127
143#endif 128#endif
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index 645217094e51..260c554b1547 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -25,16 +25,20 @@
25#include "voltage.h" 25#include "voltage.h"
26 26
27#include "vp.h" 27#include "vp.h"
28#include "prm2xxx_3xxx.h"
29
30static const struct omap_vp_ops omap3_vp_ops = {
31 .check_txdone = omap3_prm_vp_check_txdone,
32 .clear_txdone = omap3_prm_vp_clear_txdone,
33};
28 34
29/* 35/*
30 * VP data common to 34xx/36xx chips 36 * VP data common to 34xx/36xx chips
31 * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file. 37 * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
32 */ 38 */
33static const struct omap_vp_common_data omap3_vp_common = { 39static const struct omap_vp_common omap3_vp_common = {
34 .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT, 40 .vpconfig_erroroffset_mask = OMAP3430_ERROROFFSET_MASK,
35 .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK, 41 .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
36 .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
37 .vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT,
38 .vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK, 42 .vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK,
39 .vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK, 43 .vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK,
40 .vpconfig_initvdd = OMAP3430_INITVDD_MASK, 44 .vpconfig_initvdd = OMAP3430_INITVDD_MASK,
@@ -47,36 +51,29 @@ static const struct omap_vp_common_data omap3_vp_common = {
47 .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT, 51 .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
48 .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT, 52 .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
49 .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT, 53 .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
50}; 54 .vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK,
51 55
52static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = { 56 .ops = &omap3_vp_ops,
53 .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
54 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
55}; 57};
56 58
57struct omap_vp_instance_data omap3_vp1_data = { 59struct omap_vp_instance omap3_vp_mpu = {
58 .vp_common = &omap3_vp_common, 60 .id = OMAP3_VP_VDD_MPU_ID,
61 .common = &omap3_vp_common,
59 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET, 62 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
60 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET, 63 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
61 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET, 64 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
62 .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET, 65 .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
63 .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET, 66 .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
64 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET, 67 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
65 .prm_irqst_data = &omap3_vp1_prm_irqst_data,
66};
67
68static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = {
69 .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
70 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
71}; 68};
72 69
73struct omap_vp_instance_data omap3_vp2_data = { 70struct omap_vp_instance omap3_vp_core = {
74 .vp_common = &omap3_vp_common, 71 .id = OMAP3_VP_VDD_CORE_ID,
72 .common = &omap3_vp_common,
75 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET, 73 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
76 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET, 74 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
77 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET, 75 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
78 .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET, 76 .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
79 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, 77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
80 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, 78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
81 .prm_irqst_data = &omap3_vp2_prm_irqst_data,
82}; 79};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 65d1ad63800a..b4e77044891e 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -27,15 +27,18 @@
27 27
28#include "vp.h" 28#include "vp.h"
29 29
30static const struct omap_vp_ops omap4_vp_ops = {
31 .check_txdone = omap4_prm_vp_check_txdone,
32 .clear_txdone = omap4_prm_vp_clear_txdone,
33};
34
30/* 35/*
31 * VP data common to 44xx chips 36 * VP data common to 44xx chips
32 * XXX This stuff presumably belongs in the vp44xx.c or vp.c file. 37 * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
33 */ 38 */
34static const struct omap_vp_common_data omap4_vp_common = { 39static const struct omap_vp_common omap4_vp_common = {
35 .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT, 40 .vpconfig_erroroffset_mask = OMAP4430_ERROROFFSET_MASK,
36 .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK, 41 .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
37 .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
38 .vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT,
39 .vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK, 42 .vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK,
40 .vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK, 43 .vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK,
41 .vpconfig_initvdd = OMAP4430_INITVDD_MASK, 44 .vpconfig_initvdd = OMAP4430_INITVDD_MASK,
@@ -48,53 +51,39 @@ static const struct omap_vp_common_data omap4_vp_common = {
48 .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT, 51 .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
49 .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT, 52 .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
50 .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT, 53 .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
54 .vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK,
55 .ops = &omap4_vp_ops,
51}; 56};
52 57
53static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = { 58struct omap_vp_instance omap4_vp_mpu = {
54 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET, 59 .id = OMAP4_VP_VDD_MPU_ID,
55 .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK, 60 .common = &omap4_vp_common,
56};
57
58struct omap_vp_instance_data omap4_vp_mpu_data = {
59 .vp_common = &omap4_vp_common,
60 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET, 61 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
61 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET, 62 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
62 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET, 63 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
63 .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET, 64 .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
64 .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET, 65 .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
65 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET, 66 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
66 .prm_irqst_data = &omap4_vp_mpu_prm_irqst_data,
67}; 67};
68 68
69static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = { 69struct omap_vp_instance omap4_vp_iva = {
70 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET, 70 .id = OMAP4_VP_VDD_IVA_ID,
71 .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK, 71 .common = &omap4_vp_common,
72};
73
74struct omap_vp_instance_data omap4_vp_iva_data = {
75 .vp_common = &omap4_vp_common,
76 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET, 72 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
77 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET, 73 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
78 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET, 74 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
79 .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET, 75 .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
80 .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET, 76 .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
81 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET, 77 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
82 .prm_irqst_data = &omap4_vp_iva_prm_irqst_data,
83};
84
85static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
86 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
87 .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
88}; 78};
89 79
90struct omap_vp_instance_data omap4_vp_core_data = { 80struct omap_vp_instance omap4_vp_core = {
91 .vp_common = &omap4_vp_common, 81 .id = OMAP4_VP_VDD_CORE_ID,
82 .common = &omap4_vp_common,
92 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET, 83 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
93 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET, 84 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
94 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET, 85 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
95 .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET, 86 .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
96 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, 87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
97 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, 88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
98 .prm_irqst_data = &omap4_vp_core_prm_irqst_data,
99}; 89};
100
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index ea28f98d5d6a..bd9a06b3ee89 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -26,54 +26,8 @@
26#include <plat/mmc.h> 26#include <plat/mmc.h>
27#include <mach/gpio.h> 27#include <mach/gpio.h>
28#include <plat/menelaus.h> 28#include <plat/menelaus.h>
29#include <plat/mcbsp.h>
30#include <plat/omap44xx.h> 29#include <plat/omap44xx.h>
31 30
32/*-------------------------------------------------------------------------*/
33
34#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
35
36static struct platform_device **omap_mcbsp_devices;
37
38void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
39 struct omap_mcbsp_platform_data *config, int size)
40{
41 int i;
42
43 omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
44 GFP_KERNEL);
45 if (!omap_mcbsp_devices) {
46 printk(KERN_ERR "Could not register McBSP devices\n");
47 return;
48 }
49
50 for (i = 0; i < size; i++) {
51 struct platform_device *new_mcbsp;
52 int ret;
53
54 new_mcbsp = platform_device_alloc("omap-mcbsp", i + 1);
55 if (!new_mcbsp)
56 continue;
57 platform_device_add_resources(new_mcbsp, &res[i * res_count],
58 res_count);
59 new_mcbsp->dev.platform_data = &config[i];
60 ret = platform_device_add(new_mcbsp);
61 if (ret) {
62 platform_device_put(new_mcbsp);
63 continue;
64 }
65 omap_mcbsp_devices[i] = new_mcbsp;
66 }
67}
68
69#else
70void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
71 struct omap_mcbsp_platform_data *config, int size)
72{ }
73#endif
74
75/*-------------------------------------------------------------------------*/
76
77#if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \ 31#if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
78 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE) 32 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
79 33
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 75a847dd776a..de7896fd9b33 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -3,6 +3,12 @@
3 * 3 *
4 * OMAP Dual-Mode Timers 4 * OMAP Dual-Mode Timers
5 * 5 *
6 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
7 * Tarun Kanti DebBarma <tarun.kanti@ti.com>
8 * Thara Gopinath <thara@ti.com>
9 *
10 * dmtimer adaptation to platform_driver.
11 *
6 * Copyright (C) 2005 Nokia Corporation 12 * Copyright (C) 2005 Nokia Corporation
7 * OMAP2 support by Juha Yrjola 13 * OMAP2 support by Juha Yrjola
8 * API improvements and OMAP2 clock framework support by Timo Teras 14 * API improvements and OMAP2 clock framework support by Timo Teras
@@ -29,168 +35,80 @@
29 * 675 Mass Ave, Cambridge, MA 02139, USA. 35 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */ 36 */
31 37
32#include <linux/init.h>
33#include <linux/spinlock.h>
34#include <linux/errno.h>
35#include <linux/list.h>
36#include <linux/clk.h>
37#include <linux/delay.h>
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/module.h> 39#include <linux/slab.h>
40#include <mach/hardware.h> 40#include <linux/err.h>
41#include <plat/dmtimer.h> 41#include <linux/pm_runtime.h>
42#include <mach/irqs.h>
43
44static int dm_timer_count;
45
46#ifdef CONFIG_ARCH_OMAP1
47static struct omap_dm_timer omap1_dm_timers[] = {
48 { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
49 { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 },
50 { .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 },
51 { .phys_base = 0xfffb2c00, .irq = INT_1610_GPTIMER4 },
52 { .phys_base = 0xfffb3400, .irq = INT_1610_GPTIMER5 },
53 { .phys_base = 0xfffb3c00, .irq = INT_1610_GPTIMER6 },
54 { .phys_base = 0xfffb7400, .irq = INT_1610_GPTIMER7 },
55 { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
56};
57
58static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers);
59
60#else
61#define omap1_dm_timers NULL
62#define omap1_dm_timer_count 0
63#endif /* CONFIG_ARCH_OMAP1 */
64
65#ifdef CONFIG_ARCH_OMAP2
66static struct omap_dm_timer omap2_dm_timers[] = {
67 { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
68 { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 },
69 { .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 },
70 { .phys_base = 0x4807a000, .irq = INT_24XX_GPTIMER4 },
71 { .phys_base = 0x4807c000, .irq = INT_24XX_GPTIMER5 },
72 { .phys_base = 0x4807e000, .irq = INT_24XX_GPTIMER6 },
73 { .phys_base = 0x48080000, .irq = INT_24XX_GPTIMER7 },
74 { .phys_base = 0x48082000, .irq = INT_24XX_GPTIMER8 },
75 { .phys_base = 0x48084000, .irq = INT_24XX_GPTIMER9 },
76 { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
77 { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
78 { .phys_base = 0x4808a000, .irq = INT_24XX_GPTIMER12 },
79};
80
81static const char *omap2_dm_source_names[] __initdata = {
82 "sys_ck",
83 "func_32k_ck",
84 "alt_ck",
85 NULL
86};
87
88static struct clk *omap2_dm_source_clocks[3];
89static const int omap2_dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
90
91#else
92#define omap2_dm_timers NULL
93#define omap2_dm_timer_count 0
94#define omap2_dm_source_names NULL
95#define omap2_dm_source_clocks NULL
96#endif /* CONFIG_ARCH_OMAP2 */
97
98#ifdef CONFIG_ARCH_OMAP3
99static struct omap_dm_timer omap3_dm_timers[] = {
100 { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 },
101 { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 },
102 { .phys_base = 0x49034000, .irq = INT_24XX_GPTIMER3 },
103 { .phys_base = 0x49036000, .irq = INT_24XX_GPTIMER4 },
104 { .phys_base = 0x49038000, .irq = INT_24XX_GPTIMER5 },
105 { .phys_base = 0x4903A000, .irq = INT_24XX_GPTIMER6 },
106 { .phys_base = 0x4903C000, .irq = INT_24XX_GPTIMER7 },
107 { .phys_base = 0x4903E000, .irq = INT_24XX_GPTIMER8 },
108 { .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 },
109 { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
110 { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
111 { .phys_base = 0x48304000, .irq = INT_34XX_GPT12_IRQ },
112};
113
114static const char *omap3_dm_source_names[] __initdata = {
115 "sys_ck",
116 "omap_32k_fck",
117 NULL
118};
119
120static struct clk *omap3_dm_source_clocks[2];
121static const int omap3_dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
122 42
123#else 43#include <plat/dmtimer.h>
124#define omap3_dm_timers NULL
125#define omap3_dm_timer_count 0
126#define omap3_dm_source_names NULL
127#define omap3_dm_source_clocks NULL
128#endif /* CONFIG_ARCH_OMAP3 */
129
130#ifdef CONFIG_ARCH_OMAP4
131static struct omap_dm_timer omap4_dm_timers[] = {
132 { .phys_base = 0x4a318000, .irq = OMAP44XX_IRQ_GPT1 },
133 { .phys_base = 0x48032000, .irq = OMAP44XX_IRQ_GPT2 },
134 { .phys_base = 0x48034000, .irq = OMAP44XX_IRQ_GPT3 },
135 { .phys_base = 0x48036000, .irq = OMAP44XX_IRQ_GPT4 },
136 { .phys_base = 0x40138000, .irq = OMAP44XX_IRQ_GPT5 },
137 { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT6 },
138 { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT7 },
139 { .phys_base = 0x4013e000, .irq = OMAP44XX_IRQ_GPT8 },
140 { .phys_base = 0x4803e000, .irq = OMAP44XX_IRQ_GPT9 },
141 { .phys_base = 0x48086000, .irq = OMAP44XX_IRQ_GPT10 },
142 { .phys_base = 0x48088000, .irq = OMAP44XX_IRQ_GPT11 },
143 { .phys_base = 0x4a320000, .irq = OMAP44XX_IRQ_GPT12 },
144};
145static const char *omap4_dm_source_names[] __initdata = {
146 "sys_clkin_ck",
147 "sys_32k_ck",
148 NULL
149};
150static struct clk *omap4_dm_source_clocks[2];
151static const int omap4_dm_timer_count = ARRAY_SIZE(omap4_dm_timers);
152
153#else
154#define omap4_dm_timers NULL
155#define omap4_dm_timer_count 0
156#define omap4_dm_source_names NULL
157#define omap4_dm_source_clocks NULL
158#endif /* CONFIG_ARCH_OMAP4 */
159
160static struct omap_dm_timer *dm_timers;
161static const char **dm_source_names;
162static struct clk **dm_source_clocks;
163 44
164static spinlock_t dm_timer_lock; 45static LIST_HEAD(omap_timer_list);
46static DEFINE_SPINLOCK(dm_timer_lock);
165 47
166/* 48/**
167 * Reads timer registers in posted and non-posted mode. The posted mode bit 49 * omap_dm_timer_read_reg - read timer registers in posted and non-posted mode
168 * is encoded in reg. Note that in posted mode write pending bit must be 50 * @timer: timer pointer over which read operation to perform
169 * checked. Otherwise a read of a non completed write will produce an error. 51 * @reg: lowest byte holds the register offset
52 *
53 * The posted mode bit is encoded in reg. Note that in posted mode write
54 * pending bit must be checked. Otherwise a read of a non completed write
55 * will produce an error.
170 */ 56 */
171static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg) 57static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
172{ 58{
173 return __omap_dm_timer_read(timer->io_base, reg, timer->posted); 59 WARN_ON((reg & 0xff) < _OMAP_TIMER_WAKEUP_EN_OFFSET);
60 return __omap_dm_timer_read(timer, reg, timer->posted);
174} 61}
175 62
176/* 63/**
177 * Writes timer registers in posted and non-posted mode. The posted mode bit 64 * omap_dm_timer_write_reg - write timer registers in posted and non-posted mode
178 * is encoded in reg. Note that in posted mode the write pending bit must be 65 * @timer: timer pointer over which write operation is to perform
179 * checked. Otherwise a write on a register which has a pending write will be 66 * @reg: lowest byte holds the register offset
180 * lost. 67 * @value: data to write into the register
68 *
69 * The posted mode bit is encoded in reg. Note that in posted mode the write
70 * pending bit must be checked. Otherwise a write on a register which has a
71 * pending write will be lost.
181 */ 72 */
182static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg, 73static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
183 u32 value) 74 u32 value)
184{ 75{
185 __omap_dm_timer_write(timer->io_base, reg, value, timer->posted); 76 WARN_ON((reg & 0xff) < _OMAP_TIMER_WAKEUP_EN_OFFSET);
77 __omap_dm_timer_write(timer, reg, value, timer->posted);
78}
79
80static void omap_timer_restore_context(struct omap_dm_timer *timer)
81{
82 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_OFFSET,
83 timer->context.tiocp_cfg);
84 if (timer->revision > 1)
85 __raw_writel(timer->context.tistat, timer->sys_stat);
86
87 __raw_writel(timer->context.tisr, timer->irq_stat);
88 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG,
89 timer->context.twer);
90 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG,
91 timer->context.tcrr);
92 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG,
93 timer->context.tldr);
94 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG,
95 timer->context.tmar);
96 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
97 timer->context.tsicr);
98 __raw_writel(timer->context.tier, timer->irq_ena);
99 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG,
100 timer->context.tclr);
186} 101}
187 102
188static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer) 103static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
189{ 104{
190 int c; 105 int c;
191 106
107 if (!timer->sys_stat)
108 return;
109
192 c = 0; 110 c = 0;
193 while (!(omap_dm_timer_read_reg(timer, OMAP_TIMER_SYS_STAT_REG) & 1)) { 111 while (!(__raw_readl(timer->sys_stat) & 1)) {
194 c++; 112 c++;
195 if (c > 100000) { 113 if (c > 100000) {
196 printk(KERN_ERR "Timer failed to reset\n"); 114 printk(KERN_ERR "Timer failed to reset\n");
@@ -201,53 +119,65 @@ static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
201 119
202static void omap_dm_timer_reset(struct omap_dm_timer *timer) 120static void omap_dm_timer_reset(struct omap_dm_timer *timer)
203{ 121{
204 int autoidle = 0, wakeup = 0; 122 omap_dm_timer_enable(timer);
205 123 if (timer->pdev->id != 1) {
206 if (!cpu_class_is_omap2() || timer != &dm_timers[0]) {
207 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06); 124 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06);
208 omap_dm_timer_wait_for_reset(timer); 125 omap_dm_timer_wait_for_reset(timer);
209 } 126 }
210 omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
211
212 /* Enable autoidle on OMAP2+ */
213 if (cpu_class_is_omap2())
214 autoidle = 1;
215
216 /*
217 * Enable wake-up on OMAP2 CPUs.
218 */
219 if (cpu_class_is_omap2())
220 wakeup = 1;
221 127
222 __omap_dm_timer_reset(timer->io_base, autoidle, wakeup); 128 __omap_dm_timer_reset(timer, 0, 0);
129 omap_dm_timer_disable(timer);
223 timer->posted = 1; 130 timer->posted = 1;
224} 131}
225 132
226void omap_dm_timer_prepare(struct omap_dm_timer *timer) 133int omap_dm_timer_prepare(struct omap_dm_timer *timer)
227{ 134{
228 omap_dm_timer_enable(timer); 135 struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
229 omap_dm_timer_reset(timer); 136 int ret;
137
138 timer->fclk = clk_get(&timer->pdev->dev, "fck");
139 if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) {
140 timer->fclk = NULL;
141 dev_err(&timer->pdev->dev, ": No fclk handle.\n");
142 return -EINVAL;
143 }
144
145 if (pdata->needs_manual_reset)
146 omap_dm_timer_reset(timer);
147
148 ret = omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
149
150 timer->posted = 1;
151 return ret;
230} 152}
231 153
232struct omap_dm_timer *omap_dm_timer_request(void) 154struct omap_dm_timer *omap_dm_timer_request(void)
233{ 155{
234 struct omap_dm_timer *timer = NULL; 156 struct omap_dm_timer *timer = NULL, *t;
235 unsigned long flags; 157 unsigned long flags;
236 int i; 158 int ret = 0;
237 159
238 spin_lock_irqsave(&dm_timer_lock, flags); 160 spin_lock_irqsave(&dm_timer_lock, flags);
239 for (i = 0; i < dm_timer_count; i++) { 161 list_for_each_entry(t, &omap_timer_list, node) {
240 if (dm_timers[i].reserved) 162 if (t->reserved)
241 continue; 163 continue;
242 164
243 timer = &dm_timers[i]; 165 timer = t;
244 timer->reserved = 1; 166 timer->reserved = 1;
245 break; 167 break;
246 } 168 }
169
170 if (timer) {
171 ret = omap_dm_timer_prepare(timer);
172 if (ret) {
173 timer->reserved = 0;
174 timer = NULL;
175 }
176 }
247 spin_unlock_irqrestore(&dm_timer_lock, flags); 177 spin_unlock_irqrestore(&dm_timer_lock, flags);
248 178
249 if (timer != NULL) 179 if (!timer)
250 omap_dm_timer_prepare(timer); 180 pr_debug("%s: timer request failed!\n", __func__);
251 181
252 return timer; 182 return timer;
253} 183}
@@ -255,74 +185,65 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_request);
255 185
256struct omap_dm_timer *omap_dm_timer_request_specific(int id) 186struct omap_dm_timer *omap_dm_timer_request_specific(int id)
257{ 187{
258 struct omap_dm_timer *timer; 188 struct omap_dm_timer *timer = NULL, *t;
259 unsigned long flags; 189 unsigned long flags;
190 int ret = 0;
260 191
261 spin_lock_irqsave(&dm_timer_lock, flags); 192 spin_lock_irqsave(&dm_timer_lock, flags);
262 if (id <= 0 || id > dm_timer_count || dm_timers[id-1].reserved) { 193 list_for_each_entry(t, &omap_timer_list, node) {
263 spin_unlock_irqrestore(&dm_timer_lock, flags); 194 if (t->pdev->id == id && !t->reserved) {
264 printk("BUG: warning at %s:%d/%s(): unable to get timer %d\n", 195 timer = t;
265 __FILE__, __LINE__, __func__, id); 196 timer->reserved = 1;
266 dump_stack(); 197 break;
267 return NULL; 198 }
268 } 199 }
269 200
270 timer = &dm_timers[id-1]; 201 if (timer) {
271 timer->reserved = 1; 202 ret = omap_dm_timer_prepare(timer);
203 if (ret) {
204 timer->reserved = 0;
205 timer = NULL;
206 }
207 }
272 spin_unlock_irqrestore(&dm_timer_lock, flags); 208 spin_unlock_irqrestore(&dm_timer_lock, flags);
273 209
274 omap_dm_timer_prepare(timer); 210 if (!timer)
211 pr_debug("%s: timer%d request failed!\n", __func__, id);
275 212
276 return timer; 213 return timer;
277} 214}
278EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific); 215EXPORT_SYMBOL_GPL(omap_dm_timer_request_specific);
279 216
280void omap_dm_timer_free(struct omap_dm_timer *timer) 217int omap_dm_timer_free(struct omap_dm_timer *timer)
281{ 218{
282 omap_dm_timer_enable(timer); 219 if (unlikely(!timer))
283 omap_dm_timer_reset(timer); 220 return -EINVAL;
284 omap_dm_timer_disable(timer); 221
222 clk_put(timer->fclk);
285 223
286 WARN_ON(!timer->reserved); 224 WARN_ON(!timer->reserved);
287 timer->reserved = 0; 225 timer->reserved = 0;
226 return 0;
288} 227}
289EXPORT_SYMBOL_GPL(omap_dm_timer_free); 228EXPORT_SYMBOL_GPL(omap_dm_timer_free);
290 229
291void omap_dm_timer_enable(struct omap_dm_timer *timer) 230void omap_dm_timer_enable(struct omap_dm_timer *timer)
292{ 231{
293 if (timer->enabled) 232 pm_runtime_get_sync(&timer->pdev->dev);
294 return;
295
296#ifdef CONFIG_ARCH_OMAP2PLUS
297 if (cpu_class_is_omap2()) {
298 clk_enable(timer->fclk);
299 clk_enable(timer->iclk);
300 }
301#endif
302
303 timer->enabled = 1;
304} 233}
305EXPORT_SYMBOL_GPL(omap_dm_timer_enable); 234EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
306 235
307void omap_dm_timer_disable(struct omap_dm_timer *timer) 236void omap_dm_timer_disable(struct omap_dm_timer *timer)
308{ 237{
309 if (!timer->enabled) 238 pm_runtime_put(&timer->pdev->dev);
310 return;
311
312#ifdef CONFIG_ARCH_OMAP2PLUS
313 if (cpu_class_is_omap2()) {
314 clk_disable(timer->iclk);
315 clk_disable(timer->fclk);
316 }
317#endif
318
319 timer->enabled = 0;
320} 239}
321EXPORT_SYMBOL_GPL(omap_dm_timer_disable); 240EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
322 241
323int omap_dm_timer_get_irq(struct omap_dm_timer *timer) 242int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
324{ 243{
325 return timer->irq; 244 if (timer)
245 return timer->irq;
246 return -EINVAL;
326} 247}
327EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq); 248EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
328 249
@@ -334,24 +255,29 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_get_irq);
334 */ 255 */
335__u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask) 256__u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
336{ 257{
337 int i; 258 int i = 0;
259 struct omap_dm_timer *timer = NULL;
260 unsigned long flags;
338 261
339 /* If ARMXOR cannot be idled this function call is unnecessary */ 262 /* If ARMXOR cannot be idled this function call is unnecessary */
340 if (!(inputmask & (1 << 1))) 263 if (!(inputmask & (1 << 1)))
341 return inputmask; 264 return inputmask;
342 265
343 /* If any active timer is using ARMXOR return modified mask */ 266 /* If any active timer is using ARMXOR return modified mask */
344 for (i = 0; i < dm_timer_count; i++) { 267 spin_lock_irqsave(&dm_timer_lock, flags);
268 list_for_each_entry(timer, &omap_timer_list, node) {
345 u32 l; 269 u32 l;
346 270
347 l = omap_dm_timer_read_reg(&dm_timers[i], OMAP_TIMER_CTRL_REG); 271 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
348 if (l & OMAP_TIMER_CTRL_ST) { 272 if (l & OMAP_TIMER_CTRL_ST) {
349 if (((omap_readl(MOD_CONF_CTRL_1) >> (i * 2)) & 0x03) == 0) 273 if (((omap_readl(MOD_CONF_CTRL_1) >> (i * 2)) & 0x03) == 0)
350 inputmask &= ~(1 << 1); 274 inputmask &= ~(1 << 1);
351 else 275 else
352 inputmask &= ~(1 << 2); 276 inputmask &= ~(1 << 2);
353 } 277 }
278 i++;
354 } 279 }
280 spin_unlock_irqrestore(&dm_timer_lock, flags);
355 281
356 return inputmask; 282 return inputmask;
357} 283}
@@ -361,7 +287,9 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
361 287
362struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) 288struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
363{ 289{
364 return timer->fclk; 290 if (timer)
291 return timer->fclk;
292 return NULL;
365} 293}
366EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk); 294EXPORT_SYMBOL_GPL(omap_dm_timer_get_fclk);
367 295
@@ -375,70 +303,91 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
375 303
376#endif 304#endif
377 305
378void omap_dm_timer_trigger(struct omap_dm_timer *timer) 306int omap_dm_timer_trigger(struct omap_dm_timer *timer)
379{ 307{
308 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
309 pr_err("%s: timer not available or enabled.\n", __func__);
310 return -EINVAL;
311 }
312
380 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); 313 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
314 return 0;
381} 315}
382EXPORT_SYMBOL_GPL(omap_dm_timer_trigger); 316EXPORT_SYMBOL_GPL(omap_dm_timer_trigger);
383 317
384void omap_dm_timer_start(struct omap_dm_timer *timer) 318int omap_dm_timer_start(struct omap_dm_timer *timer)
385{ 319{
386 u32 l; 320 u32 l;
387 321
322 if (unlikely(!timer))
323 return -EINVAL;
324
325 omap_dm_timer_enable(timer);
326
327 if (timer->loses_context) {
328 u32 ctx_loss_cnt_after =
329 timer->get_context_loss_count(&timer->pdev->dev);
330 if (ctx_loss_cnt_after != timer->ctx_loss_count)
331 omap_timer_restore_context(timer);
332 }
333
388 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 334 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
389 if (!(l & OMAP_TIMER_CTRL_ST)) { 335 if (!(l & OMAP_TIMER_CTRL_ST)) {
390 l |= OMAP_TIMER_CTRL_ST; 336 l |= OMAP_TIMER_CTRL_ST;
391 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 337 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
392 } 338 }
339
340 /* Save the context */
341 timer->context.tclr = l;
342 return 0;
393} 343}
394EXPORT_SYMBOL_GPL(omap_dm_timer_start); 344EXPORT_SYMBOL_GPL(omap_dm_timer_start);
395 345
396void omap_dm_timer_stop(struct omap_dm_timer *timer) 346int omap_dm_timer_stop(struct omap_dm_timer *timer)
397{ 347{
398 unsigned long rate = 0; 348 unsigned long rate = 0;
349 struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data;
399 350
400#ifdef CONFIG_ARCH_OMAP2PLUS 351 if (unlikely(!timer))
401 rate = clk_get_rate(timer->fclk); 352 return -EINVAL;
402#endif
403 353
404 __omap_dm_timer_stop(timer->io_base, timer->posted, rate); 354 if (!pdata->needs_manual_reset)
355 rate = clk_get_rate(timer->fclk);
356
357 __omap_dm_timer_stop(timer, timer->posted, rate);
358
359 return 0;
405} 360}
406EXPORT_SYMBOL_GPL(omap_dm_timer_stop); 361EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
407 362
408#ifdef CONFIG_ARCH_OMAP1
409
410int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) 363int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
411{ 364{
412 int n = (timer - dm_timers) << 1; 365 int ret;
413 u32 l; 366 struct dmtimer_platform_data *pdata;
414
415 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
416 l |= source << n;
417 omap_writel(l, MOD_CONF_CTRL_1);
418 367
419 return 0; 368 if (unlikely(!timer))
420} 369 return -EINVAL;
421EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
422 370
423#else 371 pdata = timer->pdev->dev.platform_data;
424 372
425int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
426{
427 if (source < 0 || source >= 3) 373 if (source < 0 || source >= 3)
428 return -EINVAL; 374 return -EINVAL;
429 375
430 return __omap_dm_timer_set_source(timer->fclk, 376 ret = pdata->set_timer_src(timer->pdev, source);
431 dm_source_clocks[source]); 377
378 return ret;
432} 379}
433EXPORT_SYMBOL_GPL(omap_dm_timer_set_source); 380EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
434 381
435#endif 382int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
436
437void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
438 unsigned int load) 383 unsigned int load)
439{ 384{
440 u32 l; 385 u32 l;
441 386
387 if (unlikely(!timer))
388 return -EINVAL;
389
390 omap_dm_timer_enable(timer);
442 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 391 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
443 if (autoreload) 392 if (autoreload)
444 l |= OMAP_TIMER_CTRL_AR; 393 l |= OMAP_TIMER_CTRL_AR;
@@ -448,15 +397,32 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
448 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); 397 omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
449 398
450 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); 399 omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
400 /* Save the context */
401 timer->context.tclr = l;
402 timer->context.tldr = load;
403 omap_dm_timer_disable(timer);
404 return 0;
451} 405}
452EXPORT_SYMBOL_GPL(omap_dm_timer_set_load); 406EXPORT_SYMBOL_GPL(omap_dm_timer_set_load);
453 407
454/* Optimized set_load which removes costly spin wait in timer_start */ 408/* Optimized set_load which removes costly spin wait in timer_start */
455void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, 409int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
456 unsigned int load) 410 unsigned int load)
457{ 411{
458 u32 l; 412 u32 l;
459 413
414 if (unlikely(!timer))
415 return -EINVAL;
416
417 omap_dm_timer_enable(timer);
418
419 if (timer->loses_context) {
420 u32 ctx_loss_cnt_after =
421 timer->get_context_loss_count(&timer->pdev->dev);
422 if (ctx_loss_cnt_after != timer->ctx_loss_count)
423 omap_timer_restore_context(timer);
424 }
425
460 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 426 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
461 if (autoreload) { 427 if (autoreload) {
462 l |= OMAP_TIMER_CTRL_AR; 428 l |= OMAP_TIMER_CTRL_AR;
@@ -466,15 +432,25 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
466 } 432 }
467 l |= OMAP_TIMER_CTRL_ST; 433 l |= OMAP_TIMER_CTRL_ST;
468 434
469 __omap_dm_timer_load_start(timer->io_base, l, load, timer->posted); 435 __omap_dm_timer_load_start(timer, l, load, timer->posted);
436
437 /* Save the context */
438 timer->context.tclr = l;
439 timer->context.tldr = load;
440 timer->context.tcrr = load;
441 return 0;
470} 442}
471EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start); 443EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start);
472 444
473void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, 445int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
474 unsigned int match) 446 unsigned int match)
475{ 447{
476 u32 l; 448 u32 l;
477 449
450 if (unlikely(!timer))
451 return -EINVAL;
452
453 omap_dm_timer_enable(timer);
478 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 454 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
479 if (enable) 455 if (enable)
480 l |= OMAP_TIMER_CTRL_CE; 456 l |= OMAP_TIMER_CTRL_CE;
@@ -482,14 +458,24 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
482 l &= ~OMAP_TIMER_CTRL_CE; 458 l &= ~OMAP_TIMER_CTRL_CE;
483 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 459 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
484 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); 460 omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match);
461
462 /* Save the context */
463 timer->context.tclr = l;
464 timer->context.tmar = match;
465 omap_dm_timer_disable(timer);
466 return 0;
485} 467}
486EXPORT_SYMBOL_GPL(omap_dm_timer_set_match); 468EXPORT_SYMBOL_GPL(omap_dm_timer_set_match);
487 469
488void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, 470int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
489 int toggle, int trigger) 471 int toggle, int trigger)
490{ 472{
491 u32 l; 473 u32 l;
492 474
475 if (unlikely(!timer))
476 return -EINVAL;
477
478 omap_dm_timer_enable(timer);
493 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 479 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
494 l &= ~(OMAP_TIMER_CTRL_GPOCFG | OMAP_TIMER_CTRL_SCPWM | 480 l &= ~(OMAP_TIMER_CTRL_GPOCFG | OMAP_TIMER_CTRL_SCPWM |
495 OMAP_TIMER_CTRL_PT | (0x03 << 10)); 481 OMAP_TIMER_CTRL_PT | (0x03 << 10));
@@ -499,13 +485,22 @@ void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
499 l |= OMAP_TIMER_CTRL_PT; 485 l |= OMAP_TIMER_CTRL_PT;
500 l |= trigger << 10; 486 l |= trigger << 10;
501 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 487 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
488
489 /* Save the context */
490 timer->context.tclr = l;
491 omap_dm_timer_disable(timer);
492 return 0;
502} 493}
503EXPORT_SYMBOL_GPL(omap_dm_timer_set_pwm); 494EXPORT_SYMBOL_GPL(omap_dm_timer_set_pwm);
504 495
505void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler) 496int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
506{ 497{
507 u32 l; 498 u32 l;
508 499
500 if (unlikely(!timer))
501 return -EINVAL;
502
503 omap_dm_timer_enable(timer);
509 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); 504 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
510 l &= ~(OMAP_TIMER_CTRL_PRE | (0x07 << 2)); 505 l &= ~(OMAP_TIMER_CTRL_PRE | (0x07 << 2));
511 if (prescaler >= 0x00 && prescaler <= 0x07) { 506 if (prescaler >= 0x00 && prescaler <= 0x07) {
@@ -513,13 +508,28 @@ void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
513 l |= prescaler << 2; 508 l |= prescaler << 2;
514 } 509 }
515 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 510 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
511
512 /* Save the context */
513 timer->context.tclr = l;
514 omap_dm_timer_disable(timer);
515 return 0;
516} 516}
517EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler); 517EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler);
518 518
519void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, 519int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
520 unsigned int value) 520 unsigned int value)
521{ 521{
522 __omap_dm_timer_int_enable(timer->io_base, value); 522 if (unlikely(!timer))
523 return -EINVAL;
524
525 omap_dm_timer_enable(timer);
526 __omap_dm_timer_int_enable(timer, value);
527
528 /* Save the context */
529 timer->context.tier = value;
530 timer->context.twer = value;
531 omap_dm_timer_disable(timer);
532 return 0;
523} 533}
524EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable); 534EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
525 535
@@ -527,40 +537,61 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
527{ 537{
528 unsigned int l; 538 unsigned int l;
529 539
530 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_STAT_REG); 540 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
541 pr_err("%s: timer not available or enabled.\n", __func__);
542 return 0;
543 }
544
545 l = __raw_readl(timer->irq_stat);
531 546
532 return l; 547 return l;
533} 548}
534EXPORT_SYMBOL_GPL(omap_dm_timer_read_status); 549EXPORT_SYMBOL_GPL(omap_dm_timer_read_status);
535 550
536void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value) 551int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
537{ 552{
538 __omap_dm_timer_write_status(timer->io_base, value); 553 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev)))
554 return -EINVAL;
555
556 __omap_dm_timer_write_status(timer, value);
557 /* Save the context */
558 timer->context.tisr = value;
559 return 0;
539} 560}
540EXPORT_SYMBOL_GPL(omap_dm_timer_write_status); 561EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
541 562
542unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer) 563unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
543{ 564{
544 return __omap_dm_timer_read_counter(timer->io_base, timer->posted); 565 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
566 pr_err("%s: timer not iavailable or enabled.\n", __func__);
567 return 0;
568 }
569
570 return __omap_dm_timer_read_counter(timer, timer->posted);
545} 571}
546EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter); 572EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
547 573
548void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value) 574int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
549{ 575{
576 if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
577 pr_err("%s: timer not available or enabled.\n", __func__);
578 return -EINVAL;
579 }
580
550 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, value); 581 omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, value);
582
583 /* Save the context */
584 timer->context.tcrr = value;
585 return 0;
551} 586}
552EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter); 587EXPORT_SYMBOL_GPL(omap_dm_timer_write_counter);
553 588
554int omap_dm_timers_active(void) 589int omap_dm_timers_active(void)
555{ 590{
556 int i; 591 struct omap_dm_timer *timer;
557
558 for (i = 0; i < dm_timer_count; i++) {
559 struct omap_dm_timer *timer;
560
561 timer = &dm_timers[i];
562 592
563 if (!timer->enabled) 593 list_for_each_entry(timer, &omap_timer_list, node) {
594 if (!timer->reserved)
564 continue; 595 continue;
565 596
566 if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) & 597 if (omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG) &
@@ -572,69 +603,147 @@ int omap_dm_timers_active(void)
572} 603}
573EXPORT_SYMBOL_GPL(omap_dm_timers_active); 604EXPORT_SYMBOL_GPL(omap_dm_timers_active);
574 605
575static int __init omap_dm_timer_init(void) 606/**
607 * omap_dm_timer_probe - probe function called for every registered device
608 * @pdev: pointer to current timer platform device
609 *
610 * Called by driver framework at the end of device registration for all
611 * timer devices.
612 */
613static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
576{ 614{
615 int ret;
616 unsigned long flags;
577 struct omap_dm_timer *timer; 617 struct omap_dm_timer *timer;
578 int i, map_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */ 618 struct resource *mem, *irq, *ioarea;
619 struct dmtimer_platform_data *pdata = pdev->dev.platform_data;
579 620
580 if (!(cpu_is_omap16xx() || cpu_class_is_omap2())) 621 if (!pdata) {
622 dev_err(&pdev->dev, "%s: no platform data.\n", __func__);
581 return -ENODEV; 623 return -ENODEV;
624 }
582 625
583 spin_lock_init(&dm_timer_lock); 626 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
584 627 if (unlikely(!irq)) {
585 if (cpu_class_is_omap1()) { 628 dev_err(&pdev->dev, "%s: no IRQ resource.\n", __func__);
586 dm_timers = omap1_dm_timers; 629 return -ENODEV;
587 dm_timer_count = omap1_dm_timer_count;
588 map_size = SZ_2K;
589 } else if (cpu_is_omap24xx()) {
590 dm_timers = omap2_dm_timers;
591 dm_timer_count = omap2_dm_timer_count;
592 dm_source_names = omap2_dm_source_names;
593 dm_source_clocks = omap2_dm_source_clocks;
594 } else if (cpu_is_omap34xx()) {
595 dm_timers = omap3_dm_timers;
596 dm_timer_count = omap3_dm_timer_count;
597 dm_source_names = omap3_dm_source_names;
598 dm_source_clocks = omap3_dm_source_clocks;
599 } else if (cpu_is_omap44xx()) {
600 dm_timers = omap4_dm_timers;
601 dm_timer_count = omap4_dm_timer_count;
602 dm_source_names = omap4_dm_source_names;
603 dm_source_clocks = omap4_dm_source_clocks;
604 } 630 }
605 631
606 if (cpu_class_is_omap2()) 632 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
607 for (i = 0; dm_source_names[i] != NULL; i++) 633 if (unlikely(!mem)) {
608 dm_source_clocks[i] = clk_get(NULL, dm_source_names[i]); 634 dev_err(&pdev->dev, "%s: no memory resource.\n", __func__);
635 return -ENODEV;
636 }
609 637
610 if (cpu_is_omap243x()) 638 ioarea = request_mem_region(mem->start, resource_size(mem),
611 dm_timers[0].phys_base = 0x49018000; 639 pdev->name);
640 if (!ioarea) {
641 dev_err(&pdev->dev, "%s: region already claimed.\n", __func__);
642 return -EBUSY;
643 }
612 644
613 for (i = 0; i < dm_timer_count; i++) { 645 timer = kzalloc(sizeof(struct omap_dm_timer), GFP_KERNEL);
614 timer = &dm_timers[i]; 646 if (!timer) {
647 dev_err(&pdev->dev, "%s: no memory for omap_dm_timer.\n",
648 __func__);
649 ret = -ENOMEM;
650 goto err_free_ioregion;
651 }
615 652
616 /* Static mapping, never released */ 653 timer->io_base = ioremap(mem->start, resource_size(mem));
617 timer->io_base = ioremap(timer->phys_base, map_size); 654 if (!timer->io_base) {
618 BUG_ON(!timer->io_base); 655 dev_err(&pdev->dev, "%s: ioremap failed.\n", __func__);
656 ret = -ENOMEM;
657 goto err_free_mem;
658 }
619 659
620#ifdef CONFIG_ARCH_OMAP2PLUS 660 timer->id = pdev->id;
621 if (cpu_class_is_omap2()) { 661 timer->irq = irq->start;
622 char clk_name[16]; 662 timer->reserved = pdata->reserved;
623 sprintf(clk_name, "gpt%d_ick", i + 1); 663 timer->pdev = pdev;
624 timer->iclk = clk_get(NULL, clk_name); 664 timer->loses_context = pdata->loses_context;
625 sprintf(clk_name, "gpt%d_fck", i + 1); 665 timer->get_context_loss_count = pdata->get_context_loss_count;
626 timer->fclk = clk_get(NULL, clk_name); 666
627 } 667 /* Skip pm_runtime_enable for OMAP1 */
668 if (!pdata->needs_manual_reset) {
669 pm_runtime_enable(&pdev->dev);
670 pm_runtime_irq_safe(&pdev->dev);
671 }
628 672
629 /* One or two timers may be set up early for sys_timer */ 673 if (!timer->reserved) {
630 if (sys_timer_reserved & (1 << i)) { 674 pm_runtime_get_sync(&pdev->dev);
631 timer->reserved = 1; 675 __omap_dm_timer_init_regs(timer);
632 timer->posted = 1; 676 pm_runtime_put(&pdev->dev);
633 }
634#endif
635 } 677 }
636 678
679 /* add the timer element to the list */
680 spin_lock_irqsave(&dm_timer_lock, flags);
681 list_add_tail(&timer->node, &omap_timer_list);
682 spin_unlock_irqrestore(&dm_timer_lock, flags);
683
684 dev_dbg(&pdev->dev, "Device Probed.\n");
685
637 return 0; 686 return 0;
687
688err_free_mem:
689 kfree(timer);
690
691err_free_ioregion:
692 release_mem_region(mem->start, resource_size(mem));
693
694 return ret;
638} 695}
639 696
640arch_initcall(omap_dm_timer_init); 697/**
698 * omap_dm_timer_remove - cleanup a registered timer device
699 * @pdev: pointer to current timer platform device
700 *
701 * Called by driver framework whenever a timer device is unregistered.
702 * In addition to freeing platform resources it also deletes the timer
703 * entry from the local list.
704 */
705static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
706{
707 struct omap_dm_timer *timer;
708 unsigned long flags;
709 int ret = -EINVAL;
710
711 spin_lock_irqsave(&dm_timer_lock, flags);
712 list_for_each_entry(timer, &omap_timer_list, node)
713 if (timer->pdev->id == pdev->id) {
714 list_del(&timer->node);
715 kfree(timer);
716 ret = 0;
717 break;
718 }
719 spin_unlock_irqrestore(&dm_timer_lock, flags);
720
721 return ret;
722}
723
724static struct platform_driver omap_dm_timer_driver = {
725 .probe = omap_dm_timer_probe,
726 .remove = omap_dm_timer_remove,
727 .driver = {
728 .name = "omap_timer",
729 },
730};
731
732static int __init omap_dm_timer_driver_init(void)
733{
734 return platform_driver_register(&omap_dm_timer_driver);
735}
736
737static void __exit omap_dm_timer_driver_exit(void)
738{
739 platform_driver_unregister(&omap_dm_timer_driver);
740}
741
742early_platform_init("earlytimer", &omap_dm_timer_driver);
743module_init(omap_dm_timer_driver_init);
744module_exit(omap_dm_timer_driver_exit);
745
746MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
747MODULE_LICENSE("GPL");
748MODULE_ALIAS("platform:" DRIVER_NAME);
749MODULE_AUTHOR("Texas Instruments Inc");
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 3341ca4703e9..c20beb8ed38b 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -123,19 +123,11 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
123 omap_pm_set_max_mpu_wakeup_lat(dev, t); 123 omap_pm_set_max_mpu_wakeup_lat(dev, t);
124} 124}
125 125
126static struct omap_device_pm_latency omap_i2c_latency[] = {
127 [0] = {
128 .deactivate_func = omap_device_idle_hwmods,
129 .activate_func = omap_device_enable_hwmods,
130 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
131 },
132};
133
134static inline int omap2_i2c_add_bus(int bus_id) 126static inline int omap2_i2c_add_bus(int bus_id)
135{ 127{
136 int l; 128 int l;
137 struct omap_hwmod *oh; 129 struct omap_hwmod *oh;
138 struct omap_device *od; 130 struct platform_device *pdev;
139 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; 131 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
140 struct omap_i2c_bus_platform_data *pdata; 132 struct omap_i2c_bus_platform_data *pdata;
141 133
@@ -160,12 +152,12 @@ static inline int omap2_i2c_add_bus(int bus_id)
160 */ 152 */
161 if (cpu_is_omap34xx()) 153 if (cpu_is_omap34xx())
162 pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; 154 pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
163 od = omap_device_build(name, bus_id, oh, pdata, 155 pdev = omap_device_build(name, bus_id, oh, pdata,
164 sizeof(struct omap_i2c_bus_platform_data), 156 sizeof(struct omap_i2c_bus_platform_data),
165 omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); 157 NULL, 0, 0);
166 WARN(IS_ERR(od), "Could not build omap_device for %s\n", name); 158 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
167 159
168 return PTR_ERR(od); 160 return PTR_ERR(pdev);
169} 161}
170#else 162#else
171static inline int omap2_i2c_add_bus(int bus_id) 163static inline int omap2_i2c_add_bus(int bus_id)
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index df4b9683f17f..197ca03c3f7d 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -80,8 +80,6 @@ struct clkops {
80 * 80 *
81 * @div is the divisor that should be applied to the parent clock's rate 81 * @div is the divisor that should be applied to the parent clock's rate
82 * to produce the current clock's rate. 82 * to produce the current clock's rate.
83 *
84 * XXX @flags probably should be replaced with an struct omap_chip.
85 */ 83 */
86struct clksel_rate { 84struct clksel_rate {
87 u32 val; 85 u32 val;
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 4564cc697d7f..c50df4814f6f 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -45,6 +45,18 @@ extern unsigned long long notrace omap_32k_sched_clock(void);
45 45
46extern void omap_reserve(void); 46extern void omap_reserve(void);
47 47
48void omap2420_init_early(void);
49void omap2430_init_early(void);
50void omap3430_init_early(void);
51void omap35xx_init_early(void);
52void omap3630_init_early(void);
53void omap3_init_early(void); /* Do not use this one */
54void am35xx_init_early(void);
55void ti816x_init_early(void);
56void omap4430_init_early(void);
57
58void omap_sram_init(void);
59
48/* 60/*
49 * IO bases for various OMAP processors 61 * IO bases for various OMAP processors
50 * Except the tap base, rest all the io bases 62 * Except the tap base, rest all the io bases
@@ -53,13 +65,13 @@ extern void omap_reserve(void);
53struct omap_globals { 65struct omap_globals {
54 u32 class; /* OMAP class to detect */ 66 u32 class; /* OMAP class to detect */
55 void __iomem *tap; /* Control module ID code */ 67 void __iomem *tap; /* Control module ID code */
56 unsigned long sdrc; /* SDRAM Controller */ 68 void __iomem *sdrc; /* SDRAM Controller */
57 unsigned long sms; /* SDRAM Memory Scheduler */ 69 void __iomem *sms; /* SDRAM Memory Scheduler */
58 unsigned long ctrl; /* System Control Module */ 70 void __iomem *ctrl; /* System Control Module */
59 unsigned long ctrl_pad; /* PAD Control Module */ 71 void __iomem *ctrl_pad; /* PAD Control Module */
60 unsigned long prm; /* Power and Reset Management */ 72 void __iomem *prm; /* Power and Reset Management */
61 unsigned long cm; /* Clock Management */ 73 void __iomem *cm; /* Clock Management */
62 unsigned long cm2; 74 void __iomem *cm2;
63}; 75};
64 76
65void omap2_set_globals_242x(void); 77void omap2_set_globals_242x(void);
@@ -74,7 +86,11 @@ void omap2_set_globals_sdrc(struct omap_globals *);
74void omap2_set_globals_control(struct omap_globals *); 86void omap2_set_globals_control(struct omap_globals *);
75void omap2_set_globals_prcm(struct omap_globals *); 87void omap2_set_globals_prcm(struct omap_globals *);
76 88
89void omap242x_map_io(void);
90void omap243x_map_io(void);
77void omap3_map_io(void); 91void omap3_map_io(void);
92void omap4_map_io(void);
93
78 94
79/** 95/**
80 * omap_test_timeout - busy-loop, testing a condition 96 * omap_test_timeout - busy-loop, testing a condition
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 67b3d75884cd..2f9026942229 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -44,13 +44,6 @@
44 44
45int omap_type(void); 45int omap_type(void);
46 46
47struct omap_chip_id {
48 u16 oc;
49 u8 type;
50};
51
52#define OMAP_CHIP_INIT(x) { .oc = x }
53
54/* 47/*
55 * omap_rev bits: 48 * omap_rev bits:
56 * CPU id bits (0730, 1510, 1710, 2422...) [31:16] 49 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
@@ -60,19 +53,6 @@ struct omap_chip_id {
60unsigned int omap_rev(void); 53unsigned int omap_rev(void);
61 54
62/* 55/*
63 * Define CPU revision bits
64 *
65 * Verbose meaning of the revision bits may be different for a silicon
66 * family. This difference can be handled separately.
67 */
68#define OMAP_REVBITS_00 0x00
69#define OMAP_REVBITS_01 0x01
70#define OMAP_REVBITS_02 0x02
71#define OMAP_REVBITS_03 0x03
72#define OMAP_REVBITS_04 0x04
73#define OMAP_REVBITS_05 0x05
74
75/*
76 * Get the CPU revision for OMAP devices 56 * Get the CPU revision for OMAP devices
77 */ 57 */
78#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 58#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
@@ -262,7 +242,7 @@ IS_OMAP_TYPE(2422, 0x2422)
262IS_OMAP_TYPE(2423, 0x2423) 242IS_OMAP_TYPE(2423, 0x2423)
263IS_OMAP_TYPE(2430, 0x2430) 243IS_OMAP_TYPE(2430, 0x2430)
264IS_OMAP_TYPE(3430, 0x3430) 244IS_OMAP_TYPE(3430, 0x3430)
265IS_OMAP_TYPE(3505, 0x3505) 245IS_OMAP_TYPE(3505, 0x3517)
266IS_OMAP_TYPE(3517, 0x3517) 246IS_OMAP_TYPE(3517, 0x3517)
267 247
268#define cpu_is_omap310() 0 248#define cpu_is_omap310() 0
@@ -354,8 +334,9 @@ IS_OMAP_TYPE(3517, 0x3517)
354 (!omap3_has_sgx()) && \ 334 (!omap3_has_sgx()) && \
355 (omap3_has_iva())) 335 (omap3_has_iva()))
356# define cpu_is_omap3530() (cpu_is_omap3430()) 336# define cpu_is_omap3530() (cpu_is_omap3430())
357# define cpu_is_omap3505() is_omap3505()
358# define cpu_is_omap3517() is_omap3517() 337# define cpu_is_omap3517() is_omap3517()
338# define cpu_is_omap3505() (cpu_is_omap3517() && \
339 !omap3_has_sgx())
359# undef cpu_is_omap3630 340# undef cpu_is_omap3630
360# define cpu_is_omap3630() is_omap363x() 341# define cpu_is_omap3630() is_omap363x()
361# define cpu_is_ti816x() is_ti816x() 342# define cpu_is_ti816x() is_ti816x()
@@ -379,35 +360,31 @@ IS_OMAP_TYPE(3517, 0x3517)
379/* Various silicon revisions for omap2 */ 360/* Various silicon revisions for omap2 */
380#define OMAP242X_CLASS 0x24200024 361#define OMAP242X_CLASS 0x24200024
381#define OMAP2420_REV_ES1_0 OMAP242X_CLASS 362#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
382#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (OMAP_REVBITS_01 << 8)) 363#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
383 364
384#define OMAP243X_CLASS 0x24300024 365#define OMAP243X_CLASS 0x24300024
385#define OMAP2430_REV_ES1_0 OMAP243X_CLASS 366#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
386 367
387#define OMAP343X_CLASS 0x34300034 368#define OMAP343X_CLASS 0x34300034
388#define OMAP3430_REV_ES1_0 OMAP343X_CLASS 369#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
389#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (OMAP_REVBITS_01 << 8)) 370#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
390#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (OMAP_REVBITS_02 << 8)) 371#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
391#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (OMAP_REVBITS_03 << 8)) 372#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
392#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (OMAP_REVBITS_04 << 8)) 373#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
393#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (OMAP_REVBITS_05 << 8)) 374#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
394 375
395#define OMAP363X_CLASS 0x36300034 376#define OMAP363X_CLASS 0x36300034
396#define OMAP3630_REV_ES1_0 OMAP363X_CLASS 377#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
397#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (OMAP_REVBITS_01 << 8)) 378#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
398#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (OMAP_REVBITS_02 << 8)) 379#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
399 380
400#define OMAP35XX_CLASS 0x35000034 381#define OMAP3517_CLASS 0x35170034
401#define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 8)) 382#define OMAP3517_REV_ES1_0 OMAP3517_CLASS
402#define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 8)) 383#define OMAP3517_REV_ES1_1 (OMAP3517_CLASS | (0x1 << 8))
403#define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 8))
404#define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 8))
405#define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 8))
406#define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 8))
407 384
408#define TI816X_CLASS 0x81600034 385#define TI816X_CLASS 0x81600034
409#define TI8168_REV_ES1_0 TI816X_CLASS 386#define TI8168_REV_ES1_0 TI816X_CLASS
410#define TI8168_REV_ES1_1 (TI816X_CLASS | (OMAP_REVBITS_01 << 8)) 387#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
411 388
412#define OMAP443X_CLASS 0x44300044 389#define OMAP443X_CLASS 0x44300044
413#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 390#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
@@ -418,61 +395,6 @@ IS_OMAP_TYPE(3517, 0x3517)
418#define OMAP446X_CLASS 0x44600044 395#define OMAP446X_CLASS 0x44600044
419#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 396#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
420 397
421/*
422 * omap_chip bits
423 *
424 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
425 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
426 * something that is only valid on that particular ES revision.
427 *
428 * These bits may be ORed together to indicate structures that are
429 * available on multiple chip types.
430 *
431 * To test whether a particular structure matches the current OMAP chip type,
432 * use omap_chip_is().
433 *
434 */
435#define CHIP_IS_OMAP2420 (1 << 0)
436#define CHIP_IS_OMAP2430 (1 << 1)
437#define CHIP_IS_OMAP3430 (1 << 2)
438#define CHIP_IS_OMAP3430ES1 (1 << 3)
439#define CHIP_IS_OMAP3430ES2 (1 << 4)
440#define CHIP_IS_OMAP3430ES3_0 (1 << 5)
441#define CHIP_IS_OMAP3430ES3_1 (1 << 6)
442#define CHIP_IS_OMAP3630ES1 (1 << 7)
443#define CHIP_IS_OMAP4430ES1 (1 << 8)
444#define CHIP_IS_OMAP3630ES1_1 (1 << 9)
445#define CHIP_IS_OMAP3630ES1_2 (1 << 10)
446#define CHIP_IS_OMAP4430ES2 (1 << 11)
447#define CHIP_IS_OMAP4430ES2_1 (1 << 12)
448#define CHIP_IS_OMAP4430ES2_2 (1 << 13)
449#define CHIP_IS_TI816X (1 << 14)
450#define CHIP_IS_OMAP4460ES1_0 (1 << 15)
451
452#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
453
454#define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1 | \
455 CHIP_IS_OMAP4430ES2 | \
456 CHIP_IS_OMAP4430ES2_1 | \
457 CHIP_IS_OMAP4430ES2_2 | \
458 CHIP_IS_OMAP4460ES1_0)
459
460/*
461 * "GE" here represents "greater than or equal to" in terms of ES
462 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
463 * chips at ES2 and beyond, but not, for example, any OMAP lines after
464 * OMAP3.
465 */
466#define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
467 CHIP_IS_OMAP3430ES3_0 | \
468 CHIP_GE_OMAP3430ES3_1)
469#define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1 | \
470 CHIP_IS_OMAP3630ES1 | \
471 CHIP_GE_OMAP3630ES1_1)
472#define CHIP_GE_OMAP3630ES1_1 (CHIP_IS_OMAP3630ES1_1 | \
473 CHIP_IS_OMAP3630ES1_2)
474
475int omap_chip_is(struct omap_chip_id oci);
476void omap2_check_revision(void); 398void omap2_check_revision(void);
477 399
478/* 400/*
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index eb5d16c60cd9..d11025e6e7a4 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/dmtimer.h 2 * arch/arm/plat-omap/include/plat/dmtimer.h
3 * 3 *
4 * OMAP Dual-Mode Timers 4 * OMAP Dual-Mode Timers
5 * 5 *
@@ -35,6 +35,7 @@
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/platform_device.h>
38 39
39#ifndef __ASM_ARCH_DMTIMER_H 40#ifndef __ASM_ARCH_DMTIMER_H
40#define __ASM_ARCH_DMTIMER_H 41#define __ASM_ARCH_DMTIMER_H
@@ -59,12 +60,56 @@
59 * in OMAP4 can be distinguished. 60 * in OMAP4 can be distinguished.
60 */ 61 */
61#define OMAP_TIMER_IP_VERSION_1 0x1 62#define OMAP_TIMER_IP_VERSION_1 0x1
63
64/* timer capabilities used in hwmod database */
65#define OMAP_TIMER_SECURE 0x80000000
66#define OMAP_TIMER_ALWON 0x40000000
67#define OMAP_TIMER_HAS_PWM 0x20000000
68
69struct omap_timer_capability_dev_attr {
70 u32 timer_capability;
71};
72
62struct omap_dm_timer; 73struct omap_dm_timer;
63struct clk; 74struct clk;
64 75
76struct timer_regs {
77 u32 tidr;
78 u32 tiocp_cfg;
79 u32 tistat;
80 u32 tisr;
81 u32 tier;
82 u32 twer;
83 u32 tclr;
84 u32 tcrr;
85 u32 tldr;
86 u32 ttrg;
87 u32 twps;
88 u32 tmar;
89 u32 tcar1;
90 u32 tsicr;
91 u32 tcar2;
92 u32 tpir;
93 u32 tnir;
94 u32 tcvr;
95 u32 tocr;
96 u32 towr;
97};
98
99struct dmtimer_platform_data {
100 int (*set_timer_src)(struct platform_device *pdev, int source);
101 int timer_ip_version;
102 u32 needs_manual_reset:1;
103 bool reserved;
104
105 bool loses_context;
106
107 u32 (*get_context_loss_count)(struct device *dev);
108};
109
65struct omap_dm_timer *omap_dm_timer_request(void); 110struct omap_dm_timer *omap_dm_timer_request(void);
66struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id); 111struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
67void omap_dm_timer_free(struct omap_dm_timer *timer); 112int omap_dm_timer_free(struct omap_dm_timer *timer);
68void omap_dm_timer_enable(struct omap_dm_timer *timer); 113void omap_dm_timer_enable(struct omap_dm_timer *timer);
69void omap_dm_timer_disable(struct omap_dm_timer *timer); 114void omap_dm_timer_disable(struct omap_dm_timer *timer);
70 115
@@ -73,23 +118,23 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
73u32 omap_dm_timer_modify_idlect_mask(u32 inputmask); 118u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
74struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer); 119struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer);
75 120
76void omap_dm_timer_trigger(struct omap_dm_timer *timer); 121int omap_dm_timer_trigger(struct omap_dm_timer *timer);
77void omap_dm_timer_start(struct omap_dm_timer *timer); 122int omap_dm_timer_start(struct omap_dm_timer *timer);
78void omap_dm_timer_stop(struct omap_dm_timer *timer); 123int omap_dm_timer_stop(struct omap_dm_timer *timer);
79 124
80int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); 125int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
81void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); 126int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
82void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value); 127int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
83void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); 128int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
84void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); 129int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
85void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); 130int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
86 131
87void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); 132int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
88 133
89unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); 134unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
90void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); 135int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
91unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer); 136unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
92void omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value); 137int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
93 138
94int omap_dm_timers_active(void); 139int omap_dm_timers_active(void);
95 140
@@ -98,12 +143,30 @@ int omap_dm_timers_active(void);
98 * used by dmtimer.c and sys_timer related code. 143 * used by dmtimer.c and sys_timer related code.
99 */ 144 */
100 145
101/* register offsets */ 146/*
102#define _OMAP_TIMER_ID_OFFSET 0x00 147 * The interrupt registers are different between v1 and v2 ip.
103#define _OMAP_TIMER_OCP_CFG_OFFSET 0x10 148 * These registers are offsets from timer->iobase.
104#define _OMAP_TIMER_SYS_STAT_OFFSET 0x14 149 */
105#define _OMAP_TIMER_STAT_OFFSET 0x18 150#define OMAP_TIMER_ID_OFFSET 0x00
106#define _OMAP_TIMER_INT_EN_OFFSET 0x1c 151#define OMAP_TIMER_OCP_CFG_OFFSET 0x10
152
153#define OMAP_TIMER_V1_SYS_STAT_OFFSET 0x14
154#define OMAP_TIMER_V1_STAT_OFFSET 0x18
155#define OMAP_TIMER_V1_INT_EN_OFFSET 0x1c
156
157#define OMAP_TIMER_V2_IRQSTATUS_RAW 0x24
158#define OMAP_TIMER_V2_IRQSTATUS 0x28
159#define OMAP_TIMER_V2_IRQENABLE_SET 0x2c
160#define OMAP_TIMER_V2_IRQENABLE_CLR 0x30
161
162/*
163 * The functional registers have a different base on v1 and v2 ip.
164 * These registers are offsets from timer->func_base. The func_base
165 * is samae as io_base for v1 and io_base + 0x14 for v2 ip.
166 *
167 */
168#define OMAP_TIMER_V2_FUNC_OFFSET 0x14
169
107#define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20 170#define _OMAP_TIMER_WAKEUP_EN_OFFSET 0x20
108#define _OMAP_TIMER_CTRL_OFFSET 0x24 171#define _OMAP_TIMER_CTRL_OFFSET 0x24
109#define OMAP_TIMER_CTRL_GPOCFG (1 << 14) 172#define OMAP_TIMER_CTRL_GPOCFG (1 << 14)
@@ -147,21 +210,6 @@ int omap_dm_timers_active(void);
147/* register offsets with the write pending bit encoded */ 210/* register offsets with the write pending bit encoded */
148#define WPSHIFT 16 211#define WPSHIFT 16
149 212
150#define OMAP_TIMER_ID_REG (_OMAP_TIMER_ID_OFFSET \
151 | (WP_NONE << WPSHIFT))
152
153#define OMAP_TIMER_OCP_CFG_REG (_OMAP_TIMER_OCP_CFG_OFFSET \
154 | (WP_NONE << WPSHIFT))
155
156#define OMAP_TIMER_SYS_STAT_REG (_OMAP_TIMER_SYS_STAT_OFFSET \
157 | (WP_NONE << WPSHIFT))
158
159#define OMAP_TIMER_STAT_REG (_OMAP_TIMER_STAT_OFFSET \
160 | (WP_NONE << WPSHIFT))
161
162#define OMAP_TIMER_INT_EN_REG (_OMAP_TIMER_INT_EN_OFFSET \
163 | (WP_NONE << WPSHIFT))
164
165#define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \ 213#define OMAP_TIMER_WAKEUP_EN_REG (_OMAP_TIMER_WAKEUP_EN_OFFSET \
166 | (WP_NONE << WPSHIFT)) 214 | (WP_NONE << WPSHIFT))
167 215
@@ -209,49 +257,88 @@ int omap_dm_timers_active(void);
209 257
210struct omap_dm_timer { 258struct omap_dm_timer {
211 unsigned long phys_base; 259 unsigned long phys_base;
260 int id;
212 int irq; 261 int irq;
213#ifdef CONFIG_ARCH_OMAP2PLUS
214 struct clk *iclk, *fclk; 262 struct clk *iclk, *fclk;
215#endif 263
216 void __iomem *io_base; 264 void __iomem *io_base;
265 void __iomem *sys_stat; /* TISTAT timer status */
266 void __iomem *irq_stat; /* TISR/IRQSTATUS interrupt status */
267 void __iomem *irq_ena; /* irq enable */
268 void __iomem *irq_dis; /* irq disable, only on v2 ip */
269 void __iomem *pend; /* write pending */
270 void __iomem *func_base; /* function register base */
271
217 unsigned long rate; 272 unsigned long rate;
218 unsigned reserved:1; 273 unsigned reserved:1;
219 unsigned enabled:1;
220 unsigned posted:1; 274 unsigned posted:1;
275 struct timer_regs context;
276 bool loses_context;
277 int ctx_loss_count;
278 int revision;
279 struct platform_device *pdev;
280 struct list_head node;
281
282 u32 (*get_context_loss_count)(struct device *dev);
221}; 283};
222 284
223extern u32 sys_timer_reserved; 285int omap_dm_timer_prepare(struct omap_dm_timer *timer);
224void omap_dm_timer_prepare(struct omap_dm_timer *timer);
225 286
226static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg, 287static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
227 int posted) 288 int posted)
228{ 289{
229 if (posted) 290 if (posted)
230 while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)) 291 while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
231 & (reg >> WPSHIFT))
232 cpu_relax(); 292 cpu_relax();
233 293
234 return __raw_readl(base + (reg & 0xff)); 294 return __raw_readl(timer->func_base + (reg & 0xff));
235} 295}
236 296
237static inline void __omap_dm_timer_write(void __iomem *base, u32 reg, u32 val, 297static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
238 int posted) 298 u32 reg, u32 val, int posted)
239{ 299{
240 if (posted) 300 if (posted)
241 while (__raw_readl(base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)) 301 while (__raw_readl(timer->pend) & (reg >> WPSHIFT))
242 & (reg >> WPSHIFT))
243 cpu_relax(); 302 cpu_relax();
244 303
245 __raw_writel(val, base + (reg & 0xff)); 304 __raw_writel(val, timer->func_base + (reg & 0xff));
305}
306
307static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
308{
309 u32 tidr;
310
311 /* Assume v1 ip if bits [31:16] are zero */
312 tidr = __raw_readl(timer->io_base);
313 if (!(tidr >> 16)) {
314 timer->revision = 1;
315 timer->sys_stat = timer->io_base +
316 OMAP_TIMER_V1_SYS_STAT_OFFSET;
317 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
318 timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
319 timer->irq_dis = 0;
320 timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET;
321 timer->func_base = timer->io_base;
322 } else {
323 timer->revision = 2;
324 timer->sys_stat = 0;
325 timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS;
326 timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET;
327 timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR;
328 timer->pend = timer->io_base +
329 _OMAP_TIMER_WRITE_PEND_OFFSET +
330 OMAP_TIMER_V2_FUNC_OFFSET;
331 timer->func_base = timer->io_base + OMAP_TIMER_V2_FUNC_OFFSET;
332 }
246} 333}
247 334
248/* Assumes the source clock has been set by caller */ 335/* Assumes the source clock has been set by caller */
249static inline void __omap_dm_timer_reset(void __iomem *base, int autoidle, 336static inline void __omap_dm_timer_reset(struct omap_dm_timer *timer,
250 int wakeup) 337 int autoidle, int wakeup)
251{ 338{
252 u32 l; 339 u32 l;
253 340
254 l = __omap_dm_timer_read(base, OMAP_TIMER_OCP_CFG_REG, 0); 341 l = __raw_readl(timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
255 l |= 0x02 << 3; /* Set to smart-idle mode */ 342 l |= 0x02 << 3; /* Set to smart-idle mode */
256 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */ 343 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */
257 344
@@ -261,10 +348,10 @@ static inline void __omap_dm_timer_reset(void __iomem *base, int autoidle,
261 if (wakeup) 348 if (wakeup)
262 l |= 1 << 2; 349 l |= 1 << 2;
263 350
264 __omap_dm_timer_write(base, OMAP_TIMER_OCP_CFG_REG, l, 0); 351 __raw_writel(l, timer->io_base + OMAP_TIMER_OCP_CFG_OFFSET);
265 352
266 /* Match hardware reset default of posted mode */ 353 /* Match hardware reset default of posted mode */
267 __omap_dm_timer_write(base, OMAP_TIMER_IF_CTRL_REG, 354 __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG,
268 OMAP_TIMER_CTRL_POSTED, 0); 355 OMAP_TIMER_CTRL_POSTED, 0);
269} 356}
270 357
@@ -286,18 +373,18 @@ static inline int __omap_dm_timer_set_source(struct clk *timer_fck,
286 return ret; 373 return ret;
287} 374}
288 375
289static inline void __omap_dm_timer_stop(void __iomem *base, int posted, 376static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
290 unsigned long rate) 377 int posted, unsigned long rate)
291{ 378{
292 u32 l; 379 u32 l;
293 380
294 l = __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted); 381 l = __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
295 if (l & OMAP_TIMER_CTRL_ST) { 382 if (l & OMAP_TIMER_CTRL_ST) {
296 l &= ~0x1; 383 l &= ~0x1;
297 __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, l, posted); 384 __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, l, posted);
298#ifdef CONFIG_ARCH_OMAP2PLUS 385#ifdef CONFIG_ARCH_OMAP2PLUS
299 /* Readback to make sure write has completed */ 386 /* Readback to make sure write has completed */
300 __omap_dm_timer_read(base, OMAP_TIMER_CTRL_REG, posted); 387 __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
301 /* 388 /*
302 * Wait for functional clock period x 3.5 to make sure that 389 * Wait for functional clock period x 3.5 to make sure that
303 * timer is stopped 390 * timer is stopped
@@ -307,34 +394,34 @@ static inline void __omap_dm_timer_stop(void __iomem *base, int posted,
307 } 394 }
308 395
309 /* Ack possibly pending interrupt */ 396 /* Ack possibly pending interrupt */
310 __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG, 397 __raw_writel(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat);
311 OMAP_TIMER_INT_OVERFLOW, 0);
312} 398}
313 399
314static inline void __omap_dm_timer_load_start(void __iomem *base, u32 ctrl, 400static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
315 unsigned int load, int posted) 401 u32 ctrl, unsigned int load,
402 int posted)
316{ 403{
317 __omap_dm_timer_write(base, OMAP_TIMER_COUNTER_REG, load, posted); 404 __omap_dm_timer_write(timer, OMAP_TIMER_COUNTER_REG, load, posted);
318 __omap_dm_timer_write(base, OMAP_TIMER_CTRL_REG, ctrl, posted); 405 __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, ctrl, posted);
319} 406}
320 407
321static inline void __omap_dm_timer_int_enable(void __iomem *base, 408static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer,
322 unsigned int value) 409 unsigned int value)
323{ 410{
324 __omap_dm_timer_write(base, OMAP_TIMER_INT_EN_REG, value, 0); 411 __raw_writel(value, timer->irq_ena);
325 __omap_dm_timer_write(base, OMAP_TIMER_WAKEUP_EN_REG, value, 0); 412 __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
326} 413}
327 414
328static inline unsigned int __omap_dm_timer_read_counter(void __iomem *base, 415static inline unsigned int
329 int posted) 416__omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted)
330{ 417{
331 return __omap_dm_timer_read(base, OMAP_TIMER_COUNTER_REG, posted); 418 return __omap_dm_timer_read(timer, OMAP_TIMER_COUNTER_REG, posted);
332} 419}
333 420
334static inline void __omap_dm_timer_write_status(void __iomem *base, 421static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
335 unsigned int value) 422 unsigned int value)
336{ 423{
337 __omap_dm_timer_write(base, OMAP_TIMER_STAT_REG, value, 0); 424 __raw_writel(value, timer->irq_stat);
338} 425}
339 426
340#endif /* __ASM_ARCH_DMTIMER_H */ 427#endif /* __ASM_ARCH_DMTIMER_H */
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index d72ec85c97e6..5ffbea60be45 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -228,13 +228,13 @@
228 228
229#define OMAP44XX_EMIF2_PHYS OMAP44XX_EMIF2_BASE 229#define OMAP44XX_EMIF2_PHYS OMAP44XX_EMIF2_BASE
230 /* 0x4d000000 --> 0xfd200000 */ 230 /* 0x4d000000 --> 0xfd200000 */
231#define OMAP44XX_EMIF2_VIRT (OMAP44XX_EMIF2_PHYS + OMAP4_L3_PER_IO_OFFSET)
232#define OMAP44XX_EMIF2_SIZE SZ_1M 231#define OMAP44XX_EMIF2_SIZE SZ_1M
232#define OMAP44XX_EMIF2_VIRT (OMAP44XX_EMIF1_VIRT + OMAP44XX_EMIF1_SIZE)
233 233
234#define OMAP44XX_DMM_PHYS OMAP44XX_DMM_BASE 234#define OMAP44XX_DMM_PHYS OMAP44XX_DMM_BASE
235 /* 0x4e000000 --> 0xfd300000 */ 235 /* 0x4e000000 --> 0xfd300000 */
236#define OMAP44XX_DMM_VIRT (OMAP44XX_DMM_PHYS + OMAP4_L3_PER_IO_OFFSET)
237#define OMAP44XX_DMM_SIZE SZ_1M 236#define OMAP44XX_DMM_SIZE SZ_1M
237#define OMAP44XX_DMM_VIRT (OMAP44XX_EMIF2_VIRT + OMAP44XX_EMIF2_SIZE)
238/* 238/*
239 * ---------------------------------------------------------------------------- 239 * ----------------------------------------------------------------------------
240 * Omap specific register access 240 * Omap specific register access
@@ -247,6 +247,8 @@
247 * NOTE: Please use ioremap + __raw_read/write where possible instead of these 247 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
248 */ 248 */
249 249
250void omap_ioremap_init(void);
251
250extern u8 omap_readb(u32 pa); 252extern u8 omap_readb(u32 pa);
251extern u16 omap_readw(u32 pa); 253extern u16 omap_readw(u32 pa);
252extern u32 omap_readl(u32 pa); 254extern u32 omap_readl(u32 pa);
@@ -256,8 +258,31 @@ extern void omap_writel(u32 v, u32 pa);
256 258
257struct omap_sdrc_params; 259struct omap_sdrc_params;
258 260
259extern void omap1_map_common_io(void); 261#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
260extern void omap1_init_common_hw(void); 262void omap7xx_map_io(void);
263#else
264static inline void omap_map_io(void)
265{
266}
267#endif
268
269#ifdef CONFIG_ARCH_OMAP15XX
270void omap15xx_map_io(void);
271#else
272static inline void omap15xx_map_io(void)
273{
274}
275#endif
276
277#ifdef CONFIG_ARCH_OMAP16XX
278void omap16xx_map_io(void);
279#else
280static inline void omap16xx_map_io(void)
281{
282}
283#endif
284
285void omap1_init_early(void);
261 286
262#ifdef CONFIG_SOC_OMAP2420 287#ifdef CONFIG_SOC_OMAP2420
263extern void omap242x_map_common_io(void); 288extern void omap242x_map_common_io(void);
@@ -300,7 +325,7 @@ static inline void omap44xx_map_common_io(void)
300#endif 325#endif
301 326
302extern void omap2_init_common_infrastructure(void); 327extern void omap2_init_common_infrastructure(void);
303extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, 328extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
304 struct omap_sdrc_params *sdrc_cs1); 329 struct omap_sdrc_params *sdrc_cs1);
305 330
306#define __arch_ioremap omap_ioremap 331#define __arch_ioremap omap_ioremap
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 9882c657b2d4..8fa74e2c9d6e 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -25,9 +25,7 @@
25#define __ASM_ARCH_OMAP_MCBSP_H 25#define __ASM_ARCH_OMAP_MCBSP_H
26 26
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28 28#include <linux/clk.h>
29#include <mach/hardware.h>
30#include <plat/clock.h>
31 29
32/* macro for building platform_device for McBSP ports */ 30/* macro for building platform_device for McBSP ports */
33#define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \ 31#define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \
@@ -40,104 +38,60 @@ static struct platform_device omap_mcbsp##port_nr = { \
40#define MCBSP_CONFIG_TYPE3 0x3 38#define MCBSP_CONFIG_TYPE3 0x3
41#define MCBSP_CONFIG_TYPE4 0x4 39#define MCBSP_CONFIG_TYPE4 0x4
42 40
43#define OMAP7XX_MCBSP1_BASE 0xfffb1000 41/* McBSP register numbers. Register address offset = num * reg_step */
44#define OMAP7XX_MCBSP2_BASE 0xfffb1800 42enum {
45 43 /* Common registers */
46#define OMAP1510_MCBSP1_BASE 0xe1011800 44 OMAP_MCBSP_REG_SPCR2 = 4,
47#define OMAP1510_MCBSP2_BASE 0xfffb1000 45 OMAP_MCBSP_REG_SPCR1,
48#define OMAP1510_MCBSP3_BASE 0xe1017000 46 OMAP_MCBSP_REG_RCR2,
49 47 OMAP_MCBSP_REG_RCR1,
50#define OMAP1610_MCBSP1_BASE 0xe1011800 48 OMAP_MCBSP_REG_XCR2,
51#define OMAP1610_MCBSP2_BASE 0xfffb1000 49 OMAP_MCBSP_REG_XCR1,
52#define OMAP1610_MCBSP3_BASE 0xe1017000 50 OMAP_MCBSP_REG_SRGR2,
53 51 OMAP_MCBSP_REG_SRGR1,
54#ifdef CONFIG_ARCH_OMAP1 52 OMAP_MCBSP_REG_MCR2,
55 53 OMAP_MCBSP_REG_MCR1,
56#define OMAP_MCBSP_REG_DRR2 0x00 54 OMAP_MCBSP_REG_RCERA,
57#define OMAP_MCBSP_REG_DRR1 0x02 55 OMAP_MCBSP_REG_RCERB,
58#define OMAP_MCBSP_REG_DXR2 0x04 56 OMAP_MCBSP_REG_XCERA,
59#define OMAP_MCBSP_REG_DXR1 0x06 57 OMAP_MCBSP_REG_XCERB,
60#define OMAP_MCBSP_REG_DRR 0x02 58 OMAP_MCBSP_REG_PCR0,
61#define OMAP_MCBSP_REG_DXR 0x06 59 OMAP_MCBSP_REG_RCERC,
62#define OMAP_MCBSP_REG_SPCR2 0x08 60 OMAP_MCBSP_REG_RCERD,
63#define OMAP_MCBSP_REG_SPCR1 0x0a 61 OMAP_MCBSP_REG_XCERC,
64#define OMAP_MCBSP_REG_RCR2 0x0c 62 OMAP_MCBSP_REG_XCERD,
65#define OMAP_MCBSP_REG_RCR1 0x0e 63 OMAP_MCBSP_REG_RCERE,
66#define OMAP_MCBSP_REG_XCR2 0x10 64 OMAP_MCBSP_REG_RCERF,
67#define OMAP_MCBSP_REG_XCR1 0x12 65 OMAP_MCBSP_REG_XCERE,
68#define OMAP_MCBSP_REG_SRGR2 0x14 66 OMAP_MCBSP_REG_XCERF,
69#define OMAP_MCBSP_REG_SRGR1 0x16 67 OMAP_MCBSP_REG_RCERG,
70#define OMAP_MCBSP_REG_MCR2 0x18 68 OMAP_MCBSP_REG_RCERH,
71#define OMAP_MCBSP_REG_MCR1 0x1a 69 OMAP_MCBSP_REG_XCERG,
72#define OMAP_MCBSP_REG_RCERA 0x1c 70 OMAP_MCBSP_REG_XCERH,
73#define OMAP_MCBSP_REG_RCERB 0x1e 71
74#define OMAP_MCBSP_REG_XCERA 0x20 72 /* OMAP1-OMAP2420 registers */
75#define OMAP_MCBSP_REG_XCERB 0x22 73 OMAP_MCBSP_REG_DRR2 = 0,
76#define OMAP_MCBSP_REG_PCR0 0x24 74 OMAP_MCBSP_REG_DRR1,
77#define OMAP_MCBSP_REG_RCERC 0x26 75 OMAP_MCBSP_REG_DXR2,
78#define OMAP_MCBSP_REG_RCERD 0x28 76 OMAP_MCBSP_REG_DXR1,
79#define OMAP_MCBSP_REG_XCERC 0x2A 77
80#define OMAP_MCBSP_REG_XCERD 0x2C 78 /* OMAP2430 and onwards */
81#define OMAP_MCBSP_REG_RCERE 0x2E 79 OMAP_MCBSP_REG_DRR = 0,
82#define OMAP_MCBSP_REG_RCERF 0x30 80 OMAP_MCBSP_REG_DXR = 2,
83#define OMAP_MCBSP_REG_XCERE 0x32 81 OMAP_MCBSP_REG_SYSCON = 35,
84#define OMAP_MCBSP_REG_XCERF 0x34 82 OMAP_MCBSP_REG_THRSH2,
85#define OMAP_MCBSP_REG_RCERG 0x36 83 OMAP_MCBSP_REG_THRSH1,
86#define OMAP_MCBSP_REG_RCERH 0x38 84 OMAP_MCBSP_REG_IRQST = 40,
87#define OMAP_MCBSP_REG_XCERG 0x3A 85 OMAP_MCBSP_REG_IRQEN,
88#define OMAP_MCBSP_REG_XCERH 0x3C 86 OMAP_MCBSP_REG_WAKEUPEN,
89 87 OMAP_MCBSP_REG_XCCR,
90/* Dummy defines, these are not available on omap1 */ 88 OMAP_MCBSP_REG_RCCR,
91#define OMAP_MCBSP_REG_XCCR 0x00 89 OMAP_MCBSP_REG_XBUFFSTAT,
92#define OMAP_MCBSP_REG_RCCR 0x00 90 OMAP_MCBSP_REG_RBUFFSTAT,
93 91 OMAP_MCBSP_REG_SSELCR,
94#else 92};
95
96#define OMAP_MCBSP_REG_DRR2 0x00
97#define OMAP_MCBSP_REG_DRR1 0x04
98#define OMAP_MCBSP_REG_DXR2 0x08
99#define OMAP_MCBSP_REG_DXR1 0x0C
100#define OMAP_MCBSP_REG_DRR 0x00
101#define OMAP_MCBSP_REG_DXR 0x08
102#define OMAP_MCBSP_REG_SPCR2 0x10
103#define OMAP_MCBSP_REG_SPCR1 0x14
104#define OMAP_MCBSP_REG_RCR2 0x18
105#define OMAP_MCBSP_REG_RCR1 0x1C
106#define OMAP_MCBSP_REG_XCR2 0x20
107#define OMAP_MCBSP_REG_XCR1 0x24
108#define OMAP_MCBSP_REG_SRGR2 0x28
109#define OMAP_MCBSP_REG_SRGR1 0x2C
110#define OMAP_MCBSP_REG_MCR2 0x30
111#define OMAP_MCBSP_REG_MCR1 0x34
112#define OMAP_MCBSP_REG_RCERA 0x38
113#define OMAP_MCBSP_REG_RCERB 0x3C
114#define OMAP_MCBSP_REG_XCERA 0x40
115#define OMAP_MCBSP_REG_XCERB 0x44
116#define OMAP_MCBSP_REG_PCR0 0x48
117#define OMAP_MCBSP_REG_RCERC 0x4C
118#define OMAP_MCBSP_REG_RCERD 0x50
119#define OMAP_MCBSP_REG_XCERC 0x54
120#define OMAP_MCBSP_REG_XCERD 0x58
121#define OMAP_MCBSP_REG_RCERE 0x5C
122#define OMAP_MCBSP_REG_RCERF 0x60
123#define OMAP_MCBSP_REG_XCERE 0x64
124#define OMAP_MCBSP_REG_XCERF 0x68
125#define OMAP_MCBSP_REG_RCERG 0x6C
126#define OMAP_MCBSP_REG_RCERH 0x70
127#define OMAP_MCBSP_REG_XCERG 0x74
128#define OMAP_MCBSP_REG_XCERH 0x78
129#define OMAP_MCBSP_REG_SYSCON 0x8C
130#define OMAP_MCBSP_REG_THRSH2 0x90
131#define OMAP_MCBSP_REG_THRSH1 0x94
132#define OMAP_MCBSP_REG_IRQST 0xA0
133#define OMAP_MCBSP_REG_IRQEN 0xA4
134#define OMAP_MCBSP_REG_WAKEUPEN 0xA8
135#define OMAP_MCBSP_REG_XCCR 0xAC
136#define OMAP_MCBSP_REG_RCCR 0xB0
137#define OMAP_MCBSP_REG_XBUFFSTAT 0xB4
138#define OMAP_MCBSP_REG_RBUFFSTAT 0xB8
139#define OMAP_MCBSP_REG_SSELCR 0xBC
140 93
94/* OMAP3 sidetone control registers */
141#define OMAP_ST_REG_REV 0x00 95#define OMAP_ST_REG_REV 0x00
142#define OMAP_ST_REG_SYSCONFIG 0x10 96#define OMAP_ST_REG_SYSCONFIG 0x10
143#define OMAP_ST_REG_IRQSTATUS 0x18 97#define OMAP_ST_REG_IRQSTATUS 0x18
@@ -146,8 +100,6 @@ static struct platform_device omap_mcbsp##port_nr = { \
146#define OMAP_ST_REG_SFIRCR 0x28 100#define OMAP_ST_REG_SFIRCR 0x28
147#define OMAP_ST_REG_SSELCR 0x2C 101#define OMAP_ST_REG_SSELCR 0x2C
148 102
149#endif
150
151/************************** McBSP SPCR1 bit definitions ***********************/ 103/************************** McBSP SPCR1 bit definitions ***********************/
152#define RRST 0x0001 104#define RRST 0x0001
153#define RRDY 0x0002 105#define RRDY 0x0002
@@ -344,20 +296,20 @@ typedef enum {
344struct omap_mcbsp_ops { 296struct omap_mcbsp_ops {
345 void (*request)(unsigned int); 297 void (*request)(unsigned int);
346 void (*free)(unsigned int); 298 void (*free)(unsigned int);
347 int (*set_clks_src)(u8, u8);
348}; 299};
349 300
350struct omap_mcbsp_platform_data { 301struct omap_mcbsp_platform_data {
351 unsigned long phys_base;
352 u8 dma_rx_sync, dma_tx_sync;
353 u16 rx_irq, tx_irq;
354 struct omap_mcbsp_ops *ops; 302 struct omap_mcbsp_ops *ops;
355#ifdef CONFIG_ARCH_OMAP3
356 /* Sidetone block for McBSP 2 and 3 */
357 unsigned long phys_base_st;
358#endif
359 u16 buffer_size; 303 u16 buffer_size;
360 unsigned int mcbsp_config_type; 304 u8 reg_size;
305 u8 reg_step;
306
307 /* McBSP platform and instance specific features */
308 bool has_wakeup; /* Wakeup capability */
309 bool has_ccr; /* Transceiver has configuration control registers */
310 int (*enable_st_clock)(unsigned int, bool);
311 int (*set_clk_src)(struct device *dev, struct clk *clk, const char *src);
312 int (*mux_signal)(struct device *dev, const char *signal, const char *src);
361}; 313};
362 314
363struct omap_mcbsp_st_data { 315struct omap_mcbsp_st_data {
@@ -389,14 +341,12 @@ struct omap_mcbsp {
389 spinlock_t lock; 341 spinlock_t lock;
390 struct omap_mcbsp_platform_data *pdata; 342 struct omap_mcbsp_platform_data *pdata;
391 struct clk *fclk; 343 struct clk *fclk;
392#ifdef CONFIG_ARCH_OMAP3
393 struct omap_mcbsp_st_data *st_data; 344 struct omap_mcbsp_st_data *st_data;
394 int dma_op_mode; 345 int dma_op_mode;
395 u16 max_tx_thres; 346 u16 max_tx_thres;
396 u16 max_rx_thres; 347 u16 max_rx_thres;
397#endif
398 void *reg_cache; 348 void *reg_cache;
399 unsigned int mcbsp_config_type; 349 int reg_cache_size;
400}; 350};
401 351
402/** 352/**
@@ -408,16 +358,10 @@ struct omap_mcbsp_dev_attr {
408}; 358};
409 359
410extern struct omap_mcbsp **mcbsp_ptr; 360extern struct omap_mcbsp **mcbsp_ptr;
411extern int omap_mcbsp_count, omap_mcbsp_cache_size; 361extern int omap_mcbsp_count;
412
413#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
414#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
415 362
416int omap_mcbsp_init(void); 363int omap_mcbsp_init(void);
417void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
418 struct omap_mcbsp_platform_data *config, int size);
419void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); 364void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
420#ifdef CONFIG_ARCH_OMAP3
421void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); 365void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
422void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); 366void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
423u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); 367u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
@@ -426,18 +370,6 @@ u16 omap_mcbsp_get_fifo_size(unsigned int id);
426u16 omap_mcbsp_get_tx_delay(unsigned int id); 370u16 omap_mcbsp_get_tx_delay(unsigned int id);
427u16 omap_mcbsp_get_rx_delay(unsigned int id); 371u16 omap_mcbsp_get_rx_delay(unsigned int id);
428int omap_mcbsp_get_dma_op_mode(unsigned int id); 372int omap_mcbsp_get_dma_op_mode(unsigned int id);
429#else
430static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
431{ }
432static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
433{ }
434static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
435static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
436static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; }
437static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; }
438static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; }
439static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
440#endif
441int omap_mcbsp_request(unsigned int id); 373int omap_mcbsp_request(unsigned int id);
442void omap_mcbsp_free(unsigned int id); 374void omap_mcbsp_free(unsigned int id);
443void omap_mcbsp_start(unsigned int id, int tx, int rx); 375void omap_mcbsp_start(unsigned int id, int tx, int rx);
@@ -453,21 +385,11 @@ void omap2_mcbsp1_mux_fsr_src(u8 mux);
453int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); 385int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream);
454int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); 386int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream);
455 387
456#ifdef CONFIG_ARCH_OMAP3
457/* Sidetone specific API */ 388/* Sidetone specific API */
458int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); 389int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
459int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); 390int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
460int omap_st_enable(unsigned int id); 391int omap_st_enable(unsigned int id);
461int omap_st_disable(unsigned int id); 392int omap_st_disable(unsigned int id);
462int omap_st_is_enabled(unsigned int id); 393int omap_st_is_enabled(unsigned int id);
463#else
464static inline int omap_st_set_chgain(unsigned int id, int channel,
465 s16 chgain) { return 0; }
466static inline int omap_st_get_chgain(unsigned int id, int channel,
467 s16 *chgain) { return 0; }
468static inline int omap_st_enable(unsigned int id) { return 0; }
469static inline int omap_st_disable(unsigned int id) { return 0; }
470static inline int omap_st_is_enabled(unsigned int id) { return 0; }
471#endif
472 394
473#endif 395#endif
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index ee405b36df4b..12c5b0c345bf 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -68,7 +68,7 @@ extern struct device omap_device_parent;
68 * 68 *
69 */ 69 */
70struct omap_device { 70struct omap_device {
71 struct platform_device pdev; 71 struct platform_device *pdev;
72 struct omap_hwmod **hwmods; 72 struct omap_hwmod **hwmods;
73 struct omap_device_pm_latency *pm_lats; 73 struct omap_device_pm_latency *pm_lats;
74 u32 dev_wakeup_lat; 74 u32 dev_wakeup_lat;
@@ -88,25 +88,20 @@ int omap_device_shutdown(struct platform_device *pdev);
88 88
89/* Core code interface */ 89/* Core code interface */
90 90
91int omap_device_count_resources(struct omap_device *od); 91struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
92int omap_device_fill_resources(struct omap_device *od, struct resource *res);
93
94struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
95 struct omap_hwmod *oh, void *pdata, 92 struct omap_hwmod *oh, void *pdata,
96 int pdata_len, 93 int pdata_len,
97 struct omap_device_pm_latency *pm_lats, 94 struct omap_device_pm_latency *pm_lats,
98 int pm_lats_cnt, int is_early_device); 95 int pm_lats_cnt, int is_early_device);
99 96
100struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, 97struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
101 struct omap_hwmod **oh, int oh_cnt, 98 struct omap_hwmod **oh, int oh_cnt,
102 void *pdata, int pdata_len, 99 void *pdata, int pdata_len,
103 struct omap_device_pm_latency *pm_lats, 100 struct omap_device_pm_latency *pm_lats,
104 int pm_lats_cnt, int is_early_device); 101 int pm_lats_cnt, int is_early_device);
105 102
106int omap_device_register(struct omap_device *od);
107int omap_early_device_register(struct omap_device *od);
108
109void __iomem *omap_device_get_rt_va(struct omap_device *od); 103void __iomem *omap_device_get_rt_va(struct omap_device *od);
104struct device *omap_device_get_by_hwmod_name(const char *oh_name);
110 105
111/* OMAP PM interface */ 106/* OMAP PM interface */
112int omap_device_align_pm_lat(struct platform_device *pdev, 107int omap_device_align_pm_lat(struct platform_device *pdev,
@@ -122,11 +117,6 @@ int omap_device_enable_hwmods(struct omap_device *od);
122int omap_device_disable_clocks(struct omap_device *od); 117int omap_device_disable_clocks(struct omap_device *od);
123int omap_device_enable_clocks(struct omap_device *od); 118int omap_device_enable_clocks(struct omap_device *od);
124 119
125static inline void omap_device_disable_idle_on_suspend(struct omap_device *od)
126{
127 od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
128}
129
130/* 120/*
131 * Entries should be kept in latency order ascending 121 * Entries should be kept in latency order ascending
132 * 122 *
@@ -157,6 +147,17 @@ struct omap_device_pm_latency {
157#define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1) 147#define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1)
158 148
159/* Get omap_device pointer from platform_device pointer */ 149/* Get omap_device pointer from platform_device pointer */
160#define to_omap_device(x) container_of((x), struct omap_device, pdev) 150static inline struct omap_device *to_omap_device(struct platform_device *pdev)
151{
152 return pdev ? pdev->archdata.od : NULL;
153}
154
155static inline
156void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
157{
158 struct omap_device *od = to_omap_device(pdev);
159
160 od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
161}
161 162
162#endif 163#endif
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 0e329ca88a70..5419f1a2aaa4 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -496,7 +496,6 @@ struct omap_hwmod_class {
496 * @_state: internal-use hwmod state 496 * @_state: internal-use hwmod state
497 * @_postsetup_state: internal-use state to leave the hwmod in after _setup() 497 * @_postsetup_state: internal-use state to leave the hwmod in after _setup()
498 * @flags: hwmod flags (documented below) 498 * @flags: hwmod flags (documented below)
499 * @omap_chip: OMAP chips this hwmod is present on
500 * @_lock: spinlock serializing operations on this hwmod 499 * @_lock: spinlock serializing operations on this hwmod
501 * @node: list node for hwmod list (internal use) 500 * @node: list node for hwmod list (internal use)
502 * 501 *
@@ -526,7 +525,6 @@ struct omap_hwmod {
526 char *clkdm_name; 525 char *clkdm_name;
527 struct clockdomain *clkdm; 526 struct clockdomain *clkdm;
528 char *vdd_name; 527 char *vdd_name;
529 struct voltagedomain *voltdm;
530 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 528 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
531 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 529 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
532 void *dev_attr; 530 void *dev_attr;
@@ -545,7 +543,6 @@ struct omap_hwmod {
545 u8 _int_flags; 543 u8 _int_flags;
546 u8 _state; 544 u8 _state;
547 u8 _postsetup_state; 545 u8 _postsetup_state;
548 const struct omap_chip_id omap_chip;
549}; 546};
550 547
551int omap_hwmod_register(struct omap_hwmod **ohs); 548int omap_hwmod_register(struct omap_hwmod **ohs);
diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/plat-omap/include/plat/voltage.h
new file mode 100644
index 000000000000..0a6a482ec014
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/voltage.h
@@ -0,0 +1,20 @@
1/*
2 * OMAP Voltage Management Routines
3 *
4 * Copyright (C) 2011, 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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ARCH_ARM_OMAP_VOLTAGE_H
12#define __ARCH_ARM_OMAP_VOLTAGE_H
13
14struct voltagedomain;
15
16struct voltagedomain *voltdm_lookup(const char *name);
17int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
18unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
19
20#endif
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
index f1ecfa9fc61d..1bbcbde76400 100644
--- a/arch/arm/plat-omap/io.c
+++ b/arch/arm/plat-omap/io.c
@@ -23,11 +23,16 @@
23#define BETWEEN(p,st,sz) ((p) >= (st) && (p) < ((st) + (sz))) 23#define BETWEEN(p,st,sz) ((p) >= (st) && (p) < ((st) + (sz)))
24#define XLATE(p,pst,vst) ((void __iomem *)((p) - (pst) + (vst))) 24#define XLATE(p,pst,vst) ((void __iomem *)((p) - (pst) + (vst)))
25 25
26static int initialized;
27
26/* 28/*
27 * Intercept ioremap() requests for addresses in our fixed mapping regions. 29 * Intercept ioremap() requests for addresses in our fixed mapping regions.
28 */ 30 */
29void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type) 31void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
30{ 32{
33
34 WARN(!initialized, "Do not use ioremap before init_early\n");
35
31#ifdef CONFIG_ARCH_OMAP1 36#ifdef CONFIG_ARCH_OMAP1
32 if (cpu_class_is_omap1()) { 37 if (cpu_class_is_omap1()) {
33 if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE)) 38 if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE))
@@ -139,3 +144,8 @@ void omap_iounmap(volatile void __iomem *addr)
139 __iounmap(addr); 144 __iounmap(addr);
140} 145}
141EXPORT_SYMBOL(omap_iounmap); 146EXPORT_SYMBOL(omap_iounmap);
147
148void __init omap_ioremap_init(void)
149{
150 initialized++;
151}
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 6c62af108710..4b15cd7926d7 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -24,45 +24,40 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26#include <plat/mcbsp.h> 26#include <plat/mcbsp.h>
27#include <plat/omap_device.h>
28#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
29 28
30/* XXX These "sideways" includes are a sign that something is wrong */
31#include "../mach-omap2/cm2xxx_3xxx.h"
32#include "../mach-omap2/cm-regbits-34xx.h"
33
34struct omap_mcbsp **mcbsp_ptr; 29struct omap_mcbsp **mcbsp_ptr;
35int omap_mcbsp_count, omap_mcbsp_cache_size; 30int omap_mcbsp_count;
31
32#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
33#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
36 34
37static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 35static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
38{ 36{
39 if (cpu_class_is_omap1()) { 37 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
40 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val; 38
41 __raw_writew((u16)val, mcbsp->io_base + reg); 39 if (mcbsp->pdata->reg_size == 2) {
42 } else if (cpu_is_omap2420()) { 40 ((u16 *)mcbsp->reg_cache)[reg] = (u16)val;
43 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)] = (u16)val; 41 __raw_writew((u16)val, addr);
44 __raw_writew((u16)val, mcbsp->io_base + reg);
45 } else { 42 } else {
46 ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)] = val; 43 ((u32 *)mcbsp->reg_cache)[reg] = val;
47 __raw_writel(val, mcbsp->io_base + reg); 44 __raw_writel(val, addr);
48 } 45 }
49} 46}
50 47
51static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache) 48static int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
52{ 49{
53 if (cpu_class_is_omap1()) { 50 void __iomem *addr = mcbsp->io_base + reg * mcbsp->pdata->reg_step;
54 return !from_cache ? __raw_readw(mcbsp->io_base + reg) : 51
55 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)]; 52 if (mcbsp->pdata->reg_size == 2) {
56 } else if (cpu_is_omap2420()) { 53 return !from_cache ? __raw_readw(addr) :
57 return !from_cache ? __raw_readw(mcbsp->io_base + reg) : 54 ((u16 *)mcbsp->reg_cache)[reg];
58 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)];
59 } else { 55 } else {
60 return !from_cache ? __raw_readl(mcbsp->io_base + reg) : 56 return !from_cache ? __raw_readl(addr) :
61 ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)]; 57 ((u32 *)mcbsp->reg_cache)[reg];
62 } 58 }
63} 59}
64 60
65#ifdef CONFIG_ARCH_OMAP3
66static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 61static void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
67{ 62{
68 __raw_writel(val, mcbsp->st_data->io_base_st + reg); 63 __raw_writel(val, mcbsp->st_data->io_base_st + reg);
@@ -72,7 +67,6 @@ static int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
72{ 67{
73 return __raw_readl(mcbsp->st_data->io_base_st + reg); 68 return __raw_readl(mcbsp->st_data->io_base_st + reg);
74} 69}
75#endif
76 70
77#define MCBSP_READ(mcbsp, reg) \ 71#define MCBSP_READ(mcbsp, reg) \
78 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0) 72 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0)
@@ -187,7 +181,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
187 MCBSP_WRITE(mcbsp, MCR2, config->mcr2); 181 MCBSP_WRITE(mcbsp, MCR2, config->mcr2);
188 MCBSP_WRITE(mcbsp, MCR1, config->mcr1); 182 MCBSP_WRITE(mcbsp, MCR1, config->mcr1);
189 MCBSP_WRITE(mcbsp, PCR0, config->pcr0); 183 MCBSP_WRITE(mcbsp, PCR0, config->pcr0);
190 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 184 if (mcbsp->pdata->has_ccr) {
191 MCBSP_WRITE(mcbsp, XCCR, config->xccr); 185 MCBSP_WRITE(mcbsp, XCCR, config->xccr);
192 MCBSP_WRITE(mcbsp, RCCR, config->rccr); 186 MCBSP_WRITE(mcbsp, RCCR, config->rccr);
193 } 187 }
@@ -239,46 +233,28 @@ int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream)
239 } 233 }
240 mcbsp = id_to_mcbsp_ptr(id); 234 mcbsp = id_to_mcbsp_ptr(id);
241 235
242 data_reg = mcbsp->phys_dma_base; 236 if (mcbsp->pdata->reg_size == 2) {
243
244 if (mcbsp->mcbsp_config_type < MCBSP_CONFIG_TYPE2) {
245 if (stream) 237 if (stream)
246 data_reg += OMAP_MCBSP_REG_DRR1; 238 data_reg = OMAP_MCBSP_REG_DRR1;
247 else 239 else
248 data_reg += OMAP_MCBSP_REG_DXR1; 240 data_reg = OMAP_MCBSP_REG_DXR1;
249 } else { 241 } else {
250 if (stream) 242 if (stream)
251 data_reg += OMAP_MCBSP_REG_DRR; 243 data_reg = OMAP_MCBSP_REG_DRR;
252 else 244 else
253 data_reg += OMAP_MCBSP_REG_DXR; 245 data_reg = OMAP_MCBSP_REG_DXR;
254 } 246 }
255 247
256 return data_reg; 248 return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step;
257} 249}
258EXPORT_SYMBOL(omap_mcbsp_dma_reg_params); 250EXPORT_SYMBOL(omap_mcbsp_dma_reg_params);
259 251
260#ifdef CONFIG_ARCH_OMAP3
261static struct omap_device *find_omap_device_by_dev(struct device *dev)
262{
263 struct platform_device *pdev = container_of(dev,
264 struct platform_device, dev);
265 return container_of(pdev, struct omap_device, pdev);
266}
267
268static void omap_st_on(struct omap_mcbsp *mcbsp) 252static void omap_st_on(struct omap_mcbsp *mcbsp)
269{ 253{
270 unsigned int w; 254 unsigned int w;
271 struct omap_device *od;
272 255
273 od = find_omap_device_by_dev(mcbsp->dev); 256 if (mcbsp->pdata->enable_st_clock)
274 257 mcbsp->pdata->enable_st_clock(mcbsp->id, 1);
275 /*
276 * Sidetone uses McBSP ICLK - which must not idle when sidetones
277 * are enabled or sidetones start sounding ugly.
278 */
279 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
280 w &= ~(1 << (mcbsp->id - 2));
281 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
282 258
283 /* Enable McBSP Sidetone */ 259 /* Enable McBSP Sidetone */
284 w = MCBSP_READ(mcbsp, SSELCR); 260 w = MCBSP_READ(mcbsp, SSELCR);
@@ -292,9 +268,6 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
292static void omap_st_off(struct omap_mcbsp *mcbsp) 268static void omap_st_off(struct omap_mcbsp *mcbsp)
293{ 269{
294 unsigned int w; 270 unsigned int w;
295 struct omap_device *od;
296
297 od = find_omap_device_by_dev(mcbsp->dev);
298 271
299 w = MCBSP_ST_READ(mcbsp, SSELCR); 272 w = MCBSP_ST_READ(mcbsp, SSELCR);
300 MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN)); 273 MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN));
@@ -302,17 +275,13 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
302 w = MCBSP_READ(mcbsp, SSELCR); 275 w = MCBSP_READ(mcbsp, SSELCR);
303 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); 276 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
304 277
305 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); 278 if (mcbsp->pdata->enable_st_clock)
306 w |= 1 << (mcbsp->id - 2); 279 mcbsp->pdata->enable_st_clock(mcbsp->id, 0);
307 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
308} 280}
309 281
310static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) 282static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
311{ 283{
312 u16 val, i; 284 u16 val, i;
313 struct omap_device *od;
314
315 od = find_omap_device_by_dev(mcbsp->dev);
316 285
317 val = MCBSP_ST_READ(mcbsp, SSELCR); 286 val = MCBSP_ST_READ(mcbsp, SSELCR);
318 287
@@ -340,9 +309,6 @@ static void omap_st_chgain(struct omap_mcbsp *mcbsp)
340{ 309{
341 u16 w; 310 u16 w;
342 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; 311 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
343 struct omap_device *od;
344
345 od = find_omap_device_by_dev(mcbsp->dev);
346 312
347 w = MCBSP_ST_READ(mcbsp, SSELCR); 313 w = MCBSP_ST_READ(mcbsp, SSELCR);
348 314
@@ -525,14 +491,13 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
525{ 491{
526 struct omap_mcbsp *mcbsp; 492 struct omap_mcbsp *mcbsp;
527 493
528 if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
529 return;
530
531 if (!omap_mcbsp_check_valid_id(id)) { 494 if (!omap_mcbsp_check_valid_id(id)) {
532 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 495 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
533 return; 496 return;
534 } 497 }
535 mcbsp = id_to_mcbsp_ptr(id); 498 mcbsp = id_to_mcbsp_ptr(id);
499 if (mcbsp->pdata->buffer_size == 0)
500 return;
536 501
537 if (threshold && threshold <= mcbsp->max_tx_thres) 502 if (threshold && threshold <= mcbsp->max_tx_thres)
538 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); 503 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1);
@@ -548,14 +513,13 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
548{ 513{
549 struct omap_mcbsp *mcbsp; 514 struct omap_mcbsp *mcbsp;
550 515
551 if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
552 return;
553
554 if (!omap_mcbsp_check_valid_id(id)) { 516 if (!omap_mcbsp_check_valid_id(id)) {
555 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 517 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
556 return; 518 return;
557 } 519 }
558 mcbsp = id_to_mcbsp_ptr(id); 520 mcbsp = id_to_mcbsp_ptr(id);
521 if (mcbsp->pdata->buffer_size == 0)
522 return;
559 523
560 if (threshold && threshold <= mcbsp->max_rx_thres) 524 if (threshold && threshold <= mcbsp->max_rx_thres)
561 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); 525 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1);
@@ -625,6 +589,8 @@ u16 omap_mcbsp_get_tx_delay(unsigned int id)
625 return -ENODEV; 589 return -ENODEV;
626 } 590 }
627 mcbsp = id_to_mcbsp_ptr(id); 591 mcbsp = id_to_mcbsp_ptr(id);
592 if (mcbsp->pdata->buffer_size == 0)
593 return 0;
628 594
629 /* Returns the number of free locations in the buffer */ 595 /* Returns the number of free locations in the buffer */
630 buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); 596 buffstat = MCBSP_READ(mcbsp, XBUFFSTAT);
@@ -648,6 +614,8 @@ u16 omap_mcbsp_get_rx_delay(unsigned int id)
648 return -ENODEV; 614 return -ENODEV;
649 } 615 }
650 mcbsp = id_to_mcbsp_ptr(id); 616 mcbsp = id_to_mcbsp_ptr(id);
617 if (mcbsp->pdata->buffer_size == 0)
618 return 0;
651 619
652 /* Returns the number of used locations in the buffer */ 620 /* Returns the number of used locations in the buffer */
653 buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); 621 buffstat = MCBSP_READ(mcbsp, RBUFFSTAT);
@@ -683,46 +651,6 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
683} 651}
684EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); 652EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
685 653
686static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
687{
688 struct omap_device *od;
689
690 od = find_omap_device_by_dev(mcbsp->dev);
691 /*
692 * Enable wakup behavior, smart idle and all wakeups
693 * REVISIT: some wakeups may be unnecessary
694 */
695 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
696 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
697 }
698}
699
700static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
701{
702 struct omap_device *od;
703
704 od = find_omap_device_by_dev(mcbsp->dev);
705
706 /*
707 * Disable wakup behavior, smart idle and all wakeups
708 */
709 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
710 /*
711 * HW bug workaround - If no_idle mode is taken, we need to
712 * go to smart_idle before going to always_idle, or the
713 * device will not hit retention anymore.
714 */
715
716 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
717 }
718}
719#else
720static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
721static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
722static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
723static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
724#endif
725
726int omap_mcbsp_request(unsigned int id) 654int omap_mcbsp_request(unsigned int id)
727{ 655{
728 struct omap_mcbsp *mcbsp; 656 struct omap_mcbsp *mcbsp;
@@ -735,7 +663,7 @@ int omap_mcbsp_request(unsigned int id)
735 } 663 }
736 mcbsp = id_to_mcbsp_ptr(id); 664 mcbsp = id_to_mcbsp_ptr(id);
737 665
738 reg_cache = kzalloc(omap_mcbsp_cache_size, GFP_KERNEL); 666 reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL);
739 if (!reg_cache) { 667 if (!reg_cache) {
740 return -ENOMEM; 668 return -ENOMEM;
741 } 669 }
@@ -757,8 +685,9 @@ int omap_mcbsp_request(unsigned int id)
757 685
758 pm_runtime_get_sync(mcbsp->dev); 686 pm_runtime_get_sync(mcbsp->dev);
759 687
760 /* Do procedure specific to omap34xx arch, if applicable */ 688 /* Enable wakeup behavior */
761 omap34xx_mcbsp_request(mcbsp); 689 if (mcbsp->pdata->has_wakeup)
690 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
762 691
763 /* 692 /*
764 * Make sure that transmitter, receiver and sample-rate generator are 693 * Make sure that transmitter, receiver and sample-rate generator are
@@ -795,8 +724,9 @@ err_clk_disable:
795 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 724 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
796 mcbsp->pdata->ops->free(id); 725 mcbsp->pdata->ops->free(id);
797 726
798 /* Do procedure specific to omap34xx arch, if applicable */ 727 /* Disable wakeup behavior */
799 omap34xx_mcbsp_free(mcbsp); 728 if (mcbsp->pdata->has_wakeup)
729 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
800 730
801 pm_runtime_put_sync(mcbsp->dev); 731 pm_runtime_put_sync(mcbsp->dev);
802 732
@@ -825,8 +755,9 @@ void omap_mcbsp_free(unsigned int id)
825 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 755 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
826 mcbsp->pdata->ops->free(id); 756 mcbsp->pdata->ops->free(id);
827 757
828 /* Do procedure specific to omap34xx arch, if applicable */ 758 /* Disable wakeup behavior */
829 omap34xx_mcbsp_free(mcbsp); 759 if (mcbsp->pdata->has_wakeup)
760 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
830 761
831 pm_runtime_put_sync(mcbsp->dev); 762 pm_runtime_put_sync(mcbsp->dev);
832 763
@@ -866,7 +797,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
866 } 797 }
867 mcbsp = id_to_mcbsp_ptr(id); 798 mcbsp = id_to_mcbsp_ptr(id);
868 799
869 if (cpu_is_omap34xx()) 800 if (mcbsp->st_data)
870 omap_st_start(mcbsp); 801 omap_st_start(mcbsp);
871 802
872 /* Only enable SRG, if McBSP is master */ 803 /* Only enable SRG, if McBSP is master */
@@ -904,7 +835,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
904 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); 835 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
905 } 836 }
906 837
907 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 838 if (mcbsp->pdata->has_ccr) {
908 /* Release the transmitter and receiver */ 839 /* Release the transmitter and receiver */
909 w = MCBSP_READ_CACHE(mcbsp, XCCR); 840 w = MCBSP_READ_CACHE(mcbsp, XCCR);
910 w &= ~(tx ? XDISABLE : 0); 841 w &= ~(tx ? XDISABLE : 0);
@@ -934,7 +865,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
934 865
935 /* Reset transmitter */ 866 /* Reset transmitter */
936 tx &= 1; 867 tx &= 1;
937 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 868 if (mcbsp->pdata->has_ccr) {
938 w = MCBSP_READ_CACHE(mcbsp, XCCR); 869 w = MCBSP_READ_CACHE(mcbsp, XCCR);
939 w |= (tx ? XDISABLE : 0); 870 w |= (tx ? XDISABLE : 0);
940 MCBSP_WRITE(mcbsp, XCCR, w); 871 MCBSP_WRITE(mcbsp, XCCR, w);
@@ -944,7 +875,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
944 875
945 /* Reset receiver */ 876 /* Reset receiver */
946 rx &= 1; 877 rx &= 1;
947 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 878 if (mcbsp->pdata->has_ccr) {
948 w = MCBSP_READ_CACHE(mcbsp, RCCR); 879 w = MCBSP_READ_CACHE(mcbsp, RCCR);
949 w |= (rx ? RDISABLE : 0); 880 w |= (rx ? RDISABLE : 0);
950 MCBSP_WRITE(mcbsp, RCCR, w); 881 MCBSP_WRITE(mcbsp, RCCR, w);
@@ -961,39 +892,72 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
961 MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6)); 892 MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6));
962 } 893 }
963 894
964 if (cpu_is_omap34xx()) 895 if (mcbsp->st_data)
965 omap_st_stop(mcbsp); 896 omap_st_stop(mcbsp);
966} 897}
967EXPORT_SYMBOL(omap_mcbsp_stop); 898EXPORT_SYMBOL(omap_mcbsp_stop);
968 899
969/*
970 * The following functions are only required on an OMAP1-only build.
971 * mach-omap2/mcbsp.c contains the real functions
972 */
973#ifndef CONFIG_ARCH_OMAP2PLUS
974int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id) 900int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
975{ 901{
976 WARN(1, "%s: should never be called on an OMAP1-only kernel\n", 902 struct omap_mcbsp *mcbsp;
977 __func__); 903 const char *src;
978 return -EINVAL; 904
905 if (!omap_mcbsp_check_valid_id(id)) {
906 pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
907 return -EINVAL;
908 }
909 mcbsp = id_to_mcbsp_ptr(id);
910
911 if (fck_src_id == MCBSP_CLKS_PAD_SRC)
912 src = "clks_ext";
913 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
914 src = "clks_fclk";
915 else
916 return -EINVAL;
917
918 if (mcbsp->pdata->set_clk_src)
919 return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src);
920 else
921 return -EINVAL;
979} 922}
923EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
980 924
981void omap2_mcbsp1_mux_clkr_src(u8 mux) 925void omap2_mcbsp1_mux_clkr_src(u8 mux)
982{ 926{
983 WARN(1, "%s: should never be called on an OMAP1-only kernel\n", 927 struct omap_mcbsp *mcbsp;
984 __func__); 928 const char *src;
985 return; 929
930 if (mux == CLKR_SRC_CLKR)
931 src = "clkr";
932 else if (mux == CLKR_SRC_CLKX)
933 src = "clkx";
934 else
935 return;
936
937 mcbsp = id_to_mcbsp_ptr(0);
938 if (mcbsp->pdata->mux_signal)
939 mcbsp->pdata->mux_signal(mcbsp->dev, "clkr", src);
986} 940}
941EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
987 942
988void omap2_mcbsp1_mux_fsr_src(u8 mux) 943void omap2_mcbsp1_mux_fsr_src(u8 mux)
989{ 944{
990 WARN(1, "%s: should never be called on an OMAP1-only kernel\n", 945 struct omap_mcbsp *mcbsp;
991 __func__); 946 const char *src;
992 return; 947
948 if (mux == FSR_SRC_FSR)
949 src = "fsr";
950 else if (mux == FSR_SRC_FSX)
951 src = "fsx";
952 else
953 return;
954
955 mcbsp = id_to_mcbsp_ptr(0);
956 if (mcbsp->pdata->mux_signal)
957 mcbsp->pdata->mux_signal(mcbsp->dev, "fsr", src);
993} 958}
994#endif 959EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
995 960
996#ifdef CONFIG_ARCH_OMAP3
997#define max_thres(m) (mcbsp->pdata->buffer_size) 961#define max_thres(m) (mcbsp->pdata->buffer_size)
998#define valid_threshold(m, val) ((val) <= max_thres(m)) 962#define valid_threshold(m, val) ((val) <= max_thres(m))
999#define THRESHOLD_PROP_BUILDER(prop) \ 963#define THRESHOLD_PROP_BUILDER(prop) \
@@ -1084,6 +1048,17 @@ unlock:
1084 1048
1085static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store); 1049static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
1086 1050
1051static const struct attribute *additional_attrs[] = {
1052 &dev_attr_max_tx_thres.attr,
1053 &dev_attr_max_rx_thres.attr,
1054 &dev_attr_dma_op_mode.attr,
1055 NULL,
1056};
1057
1058static const struct attribute_group additional_attr_group = {
1059 .attrs = (struct attribute **)additional_attrs,
1060};
1061
1087static ssize_t st_taps_show(struct device *dev, 1062static ssize_t st_taps_show(struct device *dev,
1088 struct device_attribute *attr, char *buf) 1063 struct device_attribute *attr, char *buf)
1089{ 1064{
@@ -1142,27 +1117,6 @@ out:
1142 1117
1143static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store); 1118static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
1144 1119
1145static const struct attribute *additional_attrs[] = {
1146 &dev_attr_max_tx_thres.attr,
1147 &dev_attr_max_rx_thres.attr,
1148 &dev_attr_dma_op_mode.attr,
1149 NULL,
1150};
1151
1152static const struct attribute_group additional_attr_group = {
1153 .attrs = (struct attribute **)additional_attrs,
1154};
1155
1156static inline int __devinit omap_additional_add(struct device *dev)
1157{
1158 return sysfs_create_group(&dev->kobj, &additional_attr_group);
1159}
1160
1161static inline void __devexit omap_additional_remove(struct device *dev)
1162{
1163 sysfs_remove_group(&dev->kobj, &additional_attr_group);
1164}
1165
1166static const struct attribute *sidetone_attrs[] = { 1120static const struct attribute *sidetone_attrs[] = {
1167 &dev_attr_st_taps.attr, 1121 &dev_attr_st_taps.attr,
1168 NULL, 1122 NULL,
@@ -1172,10 +1126,9 @@ static const struct attribute_group sidetone_attr_group = {
1172 .attrs = (struct attribute **)sidetone_attrs, 1126 .attrs = (struct attribute **)sidetone_attrs,
1173}; 1127};
1174 1128
1175static int __devinit omap_st_add(struct omap_mcbsp *mcbsp) 1129static int __devinit omap_st_add(struct omap_mcbsp *mcbsp,
1130 struct resource *res)
1176{ 1131{
1177 struct platform_device *pdev;
1178 struct resource *res;
1179 struct omap_mcbsp_st_data *st_data; 1132 struct omap_mcbsp_st_data *st_data;
1180 int err; 1133 int err;
1181 1134
@@ -1185,9 +1138,6 @@ static int __devinit omap_st_add(struct omap_mcbsp *mcbsp)
1185 goto err1; 1138 goto err1;
1186 } 1139 }
1187 1140
1188 pdev = container_of(mcbsp->dev, struct platform_device, dev);
1189
1190 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone");
1191 st_data->io_base_st = ioremap(res->start, resource_size(res)); 1141 st_data->io_base_st = ioremap(res->start, resource_size(res));
1192 if (!st_data->io_base_st) { 1142 if (!st_data->io_base_st) {
1193 err = -ENOMEM; 1143 err = -ENOMEM;
@@ -1214,59 +1164,10 @@ static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
1214{ 1164{
1215 struct omap_mcbsp_st_data *st_data = mcbsp->st_data; 1165 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1216 1166
1217 if (st_data) { 1167 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1218 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); 1168 iounmap(st_data->io_base_st);
1219 iounmap(st_data->io_base_st); 1169 kfree(st_data);
1220 kfree(st_data);
1221 }
1222}
1223
1224static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
1225{
1226 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
1227 if (cpu_is_omap34xx()) {
1228 /*
1229 * Initially configure the maximum thresholds to a safe value.
1230 * The McBSP FIFO usage with these values should not go under
1231 * 16 locations.
1232 * If the whole FIFO without safety buffer is used, than there
1233 * is a possibility that the DMA will be not able to push the
1234 * new data on time, causing channel shifts in runtime.
1235 */
1236 mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
1237 mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
1238 /*
1239 * REVISIT: Set dmap_op_mode to THRESHOLD as default
1240 * for mcbsp2 instances.
1241 */
1242 if (omap_additional_add(mcbsp->dev))
1243 dev_warn(mcbsp->dev,
1244 "Unable to create additional controls\n");
1245
1246 if (mcbsp->id == 2 || mcbsp->id == 3)
1247 if (omap_st_add(mcbsp))
1248 dev_warn(mcbsp->dev,
1249 "Unable to create sidetone controls\n");
1250
1251 } else {
1252 mcbsp->max_tx_thres = -EINVAL;
1253 mcbsp->max_rx_thres = -EINVAL;
1254 }
1255}
1256
1257static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
1258{
1259 if (cpu_is_omap34xx()) {
1260 omap_additional_remove(mcbsp->dev);
1261
1262 if (mcbsp->id == 2 || mcbsp->id == 3)
1263 omap_st_remove(mcbsp);
1264 }
1265} 1170}
1266#else
1267static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {}
1268static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {}
1269#endif /* CONFIG_ARCH_OMAP3 */
1270 1171
1271/* 1172/*
1272 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 1173 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
@@ -1316,7 +1217,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1316 } 1217 }
1317 } 1218 }
1318 mcbsp->phys_base = res->start; 1219 mcbsp->phys_base = res->start;
1319 omap_mcbsp_cache_size = resource_size(res); 1220 mcbsp->reg_cache_size = resource_size(res);
1320 mcbsp->io_base = ioremap(res->start, resource_size(res)); 1221 mcbsp->io_base = ioremap(res->start, resource_size(res));
1321 if (!mcbsp->io_base) { 1222 if (!mcbsp->io_base) {
1322 ret = -ENOMEM; 1223 ret = -ENOMEM;
@@ -1364,15 +1265,52 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
1364 mcbsp->pdata = pdata; 1265 mcbsp->pdata = pdata;
1365 mcbsp->dev = &pdev->dev; 1266 mcbsp->dev = &pdev->dev;
1366 mcbsp_ptr[id] = mcbsp; 1267 mcbsp_ptr[id] = mcbsp;
1367 mcbsp->mcbsp_config_type = pdata->mcbsp_config_type;
1368 platform_set_drvdata(pdev, mcbsp); 1268 platform_set_drvdata(pdev, mcbsp);
1369 pm_runtime_enable(mcbsp->dev); 1269 pm_runtime_enable(mcbsp->dev);
1370 1270
1371 /* Initialize mcbsp properties for OMAP34XX if needed / applicable */ 1271 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
1372 omap34xx_device_init(mcbsp); 1272 if (mcbsp->pdata->buffer_size) {
1273 /*
1274 * Initially configure the maximum thresholds to a safe value.
1275 * The McBSP FIFO usage with these values should not go under
1276 * 16 locations.
1277 * If the whole FIFO without safety buffer is used, than there
1278 * is a possibility that the DMA will be not able to push the
1279 * new data on time, causing channel shifts in runtime.
1280 */
1281 mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10;
1282 mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10;
1283
1284 ret = sysfs_create_group(&mcbsp->dev->kobj,
1285 &additional_attr_group);
1286 if (ret) {
1287 dev_err(mcbsp->dev,
1288 "Unable to create additional controls\n");
1289 goto err_thres;
1290 }
1291 } else {
1292 mcbsp->max_tx_thres = -EINVAL;
1293 mcbsp->max_rx_thres = -EINVAL;
1294 }
1295
1296 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sidetone");
1297 if (res) {
1298 ret = omap_st_add(mcbsp, res);
1299 if (ret) {
1300 dev_err(mcbsp->dev,
1301 "Unable to create sidetone controls\n");
1302 goto err_st;
1303 }
1304 }
1373 1305
1374 return 0; 1306 return 0;
1375 1307
1308err_st:
1309 if (mcbsp->pdata->buffer_size)
1310 sysfs_remove_group(&mcbsp->dev->kobj,
1311 &additional_attr_group);
1312err_thres:
1313 clk_put(mcbsp->fclk);
1376err_res: 1314err_res:
1377 iounmap(mcbsp->io_base); 1315 iounmap(mcbsp->io_base);
1378err_ioremap: 1316err_ioremap:
@@ -1392,7 +1330,12 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
1392 mcbsp->pdata->ops->free) 1330 mcbsp->pdata->ops->free)
1393 mcbsp->pdata->ops->free(mcbsp->id); 1331 mcbsp->pdata->ops->free(mcbsp->id);
1394 1332
1395 omap34xx_device_exit(mcbsp); 1333 if (mcbsp->pdata->buffer_size)
1334 sysfs_remove_group(&mcbsp->dev->kobj,
1335 &additional_attr_group);
1336
1337 if (mcbsp->st_data)
1338 omap_st_remove(mcbsp);
1396 1339
1397 clk_put(mcbsp->fclk); 1340 clk_put(mcbsp->fclk);
1398 1341
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 02609eee0562..cd90bedd9306 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -85,6 +85,8 @@
85#include <linux/clk.h> 85#include <linux/clk.h>
86#include <linux/clkdev.h> 86#include <linux/clkdev.h>
87#include <linux/pm_runtime.h> 87#include <linux/pm_runtime.h>
88#include <linux/of.h>
89#include <linux/notifier.h>
88 90
89#include <plat/omap_device.h> 91#include <plat/omap_device.h>
90#include <plat/omap_hwmod.h> 92#include <plat/omap_hwmod.h>
@@ -94,6 +96,23 @@
94#define USE_WAKEUP_LAT 0 96#define USE_WAKEUP_LAT 0
95#define IGNORE_WAKEUP_LAT 1 97#define IGNORE_WAKEUP_LAT 1
96 98
99static int omap_device_register(struct platform_device *pdev);
100static int omap_early_device_register(struct platform_device *pdev);
101static struct omap_device *omap_device_alloc(struct platform_device *pdev,
102 struct omap_hwmod **ohs, int oh_cnt,
103 struct omap_device_pm_latency *pm_lats,
104 int pm_lats_cnt);
105static void omap_device_delete(struct omap_device *od);
106
107
108static struct omap_device_pm_latency omap_default_latency[] = {
109 {
110 .deactivate_func = omap_device_idle_hwmods,
111 .activate_func = omap_device_enable_hwmods,
112 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
113 }
114};
115
97/* Private functions */ 116/* Private functions */
98 117
99/** 118/**
@@ -114,7 +133,7 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
114{ 133{
115 struct timespec a, b, c; 134 struct timespec a, b, c;
116 135
117 pr_debug("omap_device: %s: activating\n", od->pdev.name); 136 dev_dbg(&od->pdev->dev, "omap_device: activating\n");
118 137
119 while (od->pm_lat_level > 0) { 138 while (od->pm_lat_level > 0) {
120 struct omap_device_pm_latency *odpl; 139 struct omap_device_pm_latency *odpl;
@@ -138,25 +157,24 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
138 c = timespec_sub(b, a); 157 c = timespec_sub(b, a);
139 act_lat = timespec_to_ns(&c); 158 act_lat = timespec_to_ns(&c);
140 159
141 pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time " 160 dev_dbg(&od->pdev->dev,
142 "%llu nsec\n", od->pdev.name, od->pm_lat_level, 161 "omap_device: pm_lat %d: activate: elapsed time "
143 act_lat); 162 "%llu nsec\n", od->pm_lat_level, act_lat);
144 163
145 if (act_lat > odpl->activate_lat) { 164 if (act_lat > odpl->activate_lat) {
146 odpl->activate_lat_worst = act_lat; 165 odpl->activate_lat_worst = act_lat;
147 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { 166 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
148 odpl->activate_lat = act_lat; 167 odpl->activate_lat = act_lat;
149 pr_warning("omap_device: %s.%d: new worst case " 168 dev_dbg(&od->pdev->dev,
150 "activate latency %d: %llu\n", 169 "new worst case activate latency "
151 od->pdev.name, od->pdev.id, 170 "%d: %llu\n",
152 od->pm_lat_level, act_lat); 171 od->pm_lat_level, act_lat);
153 } else 172 } else
154 pr_warning("omap_device: %s.%d: activate " 173 dev_warn(&od->pdev->dev,
155 "latency %d higher than exptected. " 174 "activate latency %d "
156 "(%llu > %d)\n", 175 "higher than exptected. (%llu > %d)\n",
157 od->pdev.name, od->pdev.id, 176 od->pm_lat_level, act_lat,
158 od->pm_lat_level, act_lat, 177 odpl->activate_lat);
159 odpl->activate_lat);
160 } 178 }
161 179
162 od->dev_wakeup_lat -= odpl->activate_lat; 180 od->dev_wakeup_lat -= odpl->activate_lat;
@@ -183,7 +201,7 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
183{ 201{
184 struct timespec a, b, c; 202 struct timespec a, b, c;
185 203
186 pr_debug("omap_device: %s: deactivating\n", od->pdev.name); 204 dev_dbg(&od->pdev->dev, "omap_device: deactivating\n");
187 205
188 while (od->pm_lat_level < od->pm_lats_cnt) { 206 while (od->pm_lat_level < od->pm_lats_cnt) {
189 struct omap_device_pm_latency *odpl; 207 struct omap_device_pm_latency *odpl;
@@ -206,28 +224,26 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
206 c = timespec_sub(b, a); 224 c = timespec_sub(b, a);
207 deact_lat = timespec_to_ns(&c); 225 deact_lat = timespec_to_ns(&c);
208 226
209 pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time " 227 dev_dbg(&od->pdev->dev,
210 "%llu nsec\n", od->pdev.name, od->pm_lat_level, 228 "omap_device: pm_lat %d: deactivate: elapsed time "
211 deact_lat); 229 "%llu nsec\n", od->pm_lat_level, deact_lat);
212 230
213 if (deact_lat > odpl->deactivate_lat) { 231 if (deact_lat > odpl->deactivate_lat) {
214 odpl->deactivate_lat_worst = deact_lat; 232 odpl->deactivate_lat_worst = deact_lat;
215 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) { 233 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
216 odpl->deactivate_lat = deact_lat; 234 odpl->deactivate_lat = deact_lat;
217 pr_warning("omap_device: %s.%d: new worst case " 235 dev_dbg(&od->pdev->dev,
218 "deactivate latency %d: %llu\n", 236 "new worst case deactivate latency "
219 od->pdev.name, od->pdev.id, 237 "%d: %llu\n",
220 od->pm_lat_level, deact_lat); 238 od->pm_lat_level, deact_lat);
221 } else 239 } else
222 pr_warning("omap_device: %s.%d: deactivate " 240 dev_warn(&od->pdev->dev,
223 "latency %d higher than exptected. " 241 "deactivate latency %d "
224 "(%llu > %d)\n", 242 "higher than exptected. (%llu > %d)\n",
225 od->pdev.name, od->pdev.id, 243 od->pm_lat_level, deact_lat,
226 od->pm_lat_level, deact_lat, 244 odpl->deactivate_lat);
227 odpl->deactivate_lat);
228 } 245 }
229 246
230
231 od->dev_wakeup_lat += odpl->activate_lat; 247 od->dev_wakeup_lat += odpl->activate_lat;
232 248
233 od->pm_lat_level++; 249 od->pm_lat_level++;
@@ -245,28 +261,27 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
245 if (!clk_alias || !clk_name) 261 if (!clk_alias || !clk_name)
246 return; 262 return;
247 263
248 pr_debug("omap_device: %s: Creating %s -> %s\n", 264 dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name);
249 dev_name(&od->pdev.dev), clk_alias, clk_name);
250 265
251 r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias); 266 r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias);
252 if (!IS_ERR(r)) { 267 if (!IS_ERR(r)) {
253 pr_warning("omap_device: %s: alias %s already exists\n", 268 dev_warn(&od->pdev->dev,
254 dev_name(&od->pdev.dev), clk_alias); 269 "alias %s already exists\n", clk_alias);
255 clk_put(r); 270 clk_put(r);
256 return; 271 return;
257 } 272 }
258 273
259 r = omap_clk_get_by_name(clk_name); 274 r = omap_clk_get_by_name(clk_name);
260 if (IS_ERR(r)) { 275 if (IS_ERR(r)) {
261 pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n", 276 dev_err(&od->pdev->dev,
262 dev_name(&od->pdev.dev), clk_name); 277 "omap_clk_get_by_name for %s failed\n", clk_name);
263 return; 278 return;
264 } 279 }
265 280
266 l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev)); 281 l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
267 if (!l) { 282 if (!l) {
268 pr_err("omap_device: %s: clkdev_alloc for %s failed\n", 283 dev_err(&od->pdev->dev,
269 dev_name(&od->pdev.dev), clk_alias); 284 "clkdev_alloc for %s failed\n", clk_alias);
270 return; 285 return;
271 } 286 }
272 287
@@ -304,6 +319,96 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od,
304} 319}
305 320
306 321
322static struct dev_pm_domain omap_device_pm_domain;
323
324/**
325 * omap_device_build_from_dt - build an omap_device with multiple hwmods
326 * @pdev_name: name of the platform_device driver to use
327 * @pdev_id: this platform_device's connection ID
328 * @oh: ptr to the single omap_hwmod that backs this omap_device
329 * @pdata: platform_data ptr to associate with the platform_device
330 * @pdata_len: amount of memory pointed to by @pdata
331 * @pm_lats: pointer to a omap_device_pm_latency array for this device
332 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
333 * @is_early_device: should the device be registered as an early device or not
334 *
335 * Function for building an omap_device already registered from device-tree
336 *
337 * Returns 0 or PTR_ERR() on error.
338 */
339static int omap_device_build_from_dt(struct platform_device *pdev)
340{
341 struct omap_hwmod **hwmods;
342 struct omap_device *od;
343 struct omap_hwmod *oh;
344 struct device_node *node = pdev->dev.of_node;
345 const char *oh_name;
346 int oh_cnt, i, ret = 0;
347
348 oh_cnt = of_property_count_strings(node, "ti,hwmods");
349 if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) {
350 dev_warn(&pdev->dev, "No 'hwmods' to build omap_device\n");
351 return -ENODEV;
352 }
353
354 hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
355 if (!hwmods) {
356 ret = -ENOMEM;
357 goto odbfd_exit;
358 }
359
360 for (i = 0; i < oh_cnt; i++) {
361 of_property_read_string_index(node, "ti,hwmods", i, &oh_name);
362 oh = omap_hwmod_lookup(oh_name);
363 if (!oh) {
364 dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n",
365 oh_name);
366 ret = -EINVAL;
367 goto odbfd_exit1;
368 }
369 hwmods[i] = oh;
370 }
371
372 od = omap_device_alloc(pdev, hwmods, oh_cnt, NULL, 0);
373 if (!od) {
374 dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n",
375 oh_name);
376 ret = PTR_ERR(od);
377 goto odbfd_exit1;
378 }
379
380 if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
381 omap_device_disable_idle_on_suspend(pdev);
382
383 pdev->dev.pm_domain = &omap_device_pm_domain;
384
385odbfd_exit1:
386 kfree(hwmods);
387odbfd_exit:
388 return ret;
389}
390
391static int _omap_device_notifier_call(struct notifier_block *nb,
392 unsigned long event, void *dev)
393{
394 struct platform_device *pdev = to_platform_device(dev);
395
396 switch (event) {
397 case BUS_NOTIFY_ADD_DEVICE:
398 if (pdev->dev.of_node)
399 omap_device_build_from_dt(pdev);
400 break;
401
402 case BUS_NOTIFY_DEL_DEVICE:
403 if (pdev->archdata.od)
404 omap_device_delete(pdev->archdata.od);
405 break;
406 }
407
408 return NOTIFY_DONE;
409}
410
411
307/* Public functions for use by core code */ 412/* Public functions for use by core code */
308 413
309/** 414/**
@@ -343,7 +448,7 @@ u32 omap_device_get_context_loss_count(struct platform_device *pdev)
343 * much memory to allocate before calling 448 * much memory to allocate before calling
344 * omap_device_fill_resources(). Returns the count. 449 * omap_device_fill_resources(). Returns the count.
345 */ 450 */
346int omap_device_count_resources(struct omap_device *od) 451static int omap_device_count_resources(struct omap_device *od)
347{ 452{
348 int c = 0; 453 int c = 0;
349 int i; 454 int i;
@@ -352,7 +457,7 @@ int omap_device_count_resources(struct omap_device *od)
352 c += omap_hwmod_count_resources(od->hwmods[i]); 457 c += omap_hwmod_count_resources(od->hwmods[i]);
353 458
354 pr_debug("omap_device: %s: counted %d total resources across %d " 459 pr_debug("omap_device: %s: counted %d total resources across %d "
355 "hwmods\n", od->pdev.name, c, od->hwmods_cnt); 460 "hwmods\n", od->pdev->name, c, od->hwmods_cnt);
356 461
357 return c; 462 return c;
358} 463}
@@ -374,7 +479,8 @@ int omap_device_count_resources(struct omap_device *od)
374 * functions to get device resources. Hacking around the existing 479 * functions to get device resources. Hacking around the existing
375 * platform_device code wastes memory. Returns 0. 480 * platform_device code wastes memory. Returns 0.
376 */ 481 */
377int omap_device_fill_resources(struct omap_device *od, struct resource *res) 482static int omap_device_fill_resources(struct omap_device *od,
483 struct resource *res)
378{ 484{
379 int c = 0; 485 int c = 0;
380 int i, r; 486 int i, r;
@@ -389,6 +495,113 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
389} 495}
390 496
391/** 497/**
498 * omap_device_alloc - allocate an omap_device
499 * @pdev: platform_device that will be included in this omap_device
500 * @oh: ptr to the single omap_hwmod that backs this omap_device
501 * @pdata: platform_data ptr to associate with the platform_device
502 * @pdata_len: amount of memory pointed to by @pdata
503 * @pm_lats: pointer to a omap_device_pm_latency array for this device
504 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
505 *
506 * Convenience function for allocating an omap_device structure and filling
507 * hwmods, resources and pm_latency attributes.
508 *
509 * Returns an struct omap_device pointer or ERR_PTR() on error;
510 */
511static struct omap_device *omap_device_alloc(struct platform_device *pdev,
512 struct omap_hwmod **ohs, int oh_cnt,
513 struct omap_device_pm_latency *pm_lats,
514 int pm_lats_cnt)
515{
516 int ret = -ENOMEM;
517 struct omap_device *od;
518 struct resource *res = NULL;
519 int i, res_count;
520 struct omap_hwmod **hwmods;
521
522 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
523 if (!od) {
524 ret = -ENOMEM;
525 goto oda_exit1;
526 }
527 od->hwmods_cnt = oh_cnt;
528
529 hwmods = kmemdup(ohs, sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
530 if (!hwmods)
531 goto oda_exit2;
532
533 od->hwmods = hwmods;
534 od->pdev = pdev;
535
536 /*
537 * HACK: Ideally the resources from DT should match, and hwmod
538 * should just add the missing ones. Since the name is not
539 * properly populated by DT, stick to hwmod resources only.
540 */
541 if (pdev->num_resources && pdev->resource)
542 dev_warn(&pdev->dev, "%s(): resources already allocated %d\n",
543 __func__, pdev->num_resources);
544
545 res_count = omap_device_count_resources(od);
546 if (res_count > 0) {
547 dev_dbg(&pdev->dev, "%s(): resources allocated from hwmod %d\n",
548 __func__, res_count);
549 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
550 if (!res)
551 goto oda_exit3;
552
553 omap_device_fill_resources(od, res);
554
555 ret = platform_device_add_resources(pdev, res, res_count);
556 kfree(res);
557
558 if (ret)
559 goto oda_exit3;
560 }
561
562 if (!pm_lats) {
563 pm_lats = omap_default_latency;
564 pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
565 }
566
567 od->pm_lats_cnt = pm_lats_cnt;
568 od->pm_lats = kmemdup(pm_lats,
569 sizeof(struct omap_device_pm_latency) * pm_lats_cnt,
570 GFP_KERNEL);
571 if (!od->pm_lats)
572 goto oda_exit3;
573
574 pdev->archdata.od = od;
575
576 for (i = 0; i < oh_cnt; i++) {
577 hwmods[i]->od = od;
578 _add_hwmod_clocks_clkdev(od, hwmods[i]);
579 }
580
581 return od;
582
583oda_exit3:
584 kfree(hwmods);
585oda_exit2:
586 kfree(od);
587oda_exit1:
588 dev_err(&pdev->dev, "omap_device: build failed (%d)\n", ret);
589
590 return ERR_PTR(ret);
591}
592
593static void omap_device_delete(struct omap_device *od)
594{
595 if (!od)
596 return;
597
598 od->pdev->archdata.od = NULL;
599 kfree(od->pm_lats);
600 kfree(od->hwmods);
601 kfree(od);
602}
603
604/**
392 * omap_device_build - build and register an omap_device with one omap_hwmod 605 * omap_device_build - build and register an omap_device with one omap_hwmod
393 * @pdev_name: name of the platform_device driver to use 606 * @pdev_name: name of the platform_device driver to use
394 * @pdev_id: this platform_device's connection ID 607 * @pdev_id: this platform_device's connection ID
@@ -405,7 +618,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
405 * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, 618 * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
406 * passes along the return value of omap_device_build_ss(). 619 * passes along the return value of omap_device_build_ss().
407 */ 620 */
408struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, 621struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
409 struct omap_hwmod *oh, void *pdata, 622 struct omap_hwmod *oh, void *pdata,
410 int pdata_len, 623 int pdata_len,
411 struct omap_device_pm_latency *pm_lats, 624 struct omap_device_pm_latency *pm_lats,
@@ -438,18 +651,15 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
438 * platform_device record. Returns an ERR_PTR() on error, or passes 651 * platform_device record. Returns an ERR_PTR() on error, or passes
439 * along the return value of omap_device_register(). 652 * along the return value of omap_device_register().
440 */ 653 */
441struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, 654struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
442 struct omap_hwmod **ohs, int oh_cnt, 655 struct omap_hwmod **ohs, int oh_cnt,
443 void *pdata, int pdata_len, 656 void *pdata, int pdata_len,
444 struct omap_device_pm_latency *pm_lats, 657 struct omap_device_pm_latency *pm_lats,
445 int pm_lats_cnt, int is_early_device) 658 int pm_lats_cnt, int is_early_device)
446{ 659{
447 int ret = -ENOMEM; 660 int ret = -ENOMEM;
661 struct platform_device *pdev;
448 struct omap_device *od; 662 struct omap_device *od;
449 char *pdev_name2;
450 struct resource *res = NULL;
451 int i, res_count;
452 struct omap_hwmod **hwmods;
453 663
454 if (!ohs || oh_cnt == 0 || !pdev_name) 664 if (!ohs || oh_cnt == 0 || !pdev_name)
455 return ERR_PTR(-EINVAL); 665 return ERR_PTR(-EINVAL);
@@ -457,72 +667,40 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
457 if (!pdata && pdata_len > 0) 667 if (!pdata && pdata_len > 0)
458 return ERR_PTR(-EINVAL); 668 return ERR_PTR(-EINVAL);
459 669
460 pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name, 670 pdev = platform_device_alloc(pdev_name, pdev_id);
461 oh_cnt); 671 if (!pdev) {
462 672 ret = -ENOMEM;
463 od = kzalloc(sizeof(struct omap_device), GFP_KERNEL); 673 goto odbs_exit;
464 if (!od) 674 }
465 return ERR_PTR(-ENOMEM);
466 675
467 od->hwmods_cnt = oh_cnt; 676 /* Set the dev_name early to allow dev_xxx in omap_device_alloc */
677 if (pdev->id != -1)
678 dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
679 else
680 dev_set_name(&pdev->dev, "%s", pdev->name);
468 681
469 hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, 682 od = omap_device_alloc(pdev, ohs, oh_cnt, pm_lats, pm_lats_cnt);
470 GFP_KERNEL); 683 if (!od)
471 if (!hwmods)
472 goto odbs_exit1; 684 goto odbs_exit1;
473 685
474 memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt); 686 ret = platform_device_add_data(pdev, pdata, pdata_len);
475 od->hwmods = hwmods;
476
477 pdev_name2 = kzalloc(strlen(pdev_name) + 1, GFP_KERNEL);
478 if (!pdev_name2)
479 goto odbs_exit2;
480 strcpy(pdev_name2, pdev_name);
481
482 od->pdev.name = pdev_name2;
483 od->pdev.id = pdev_id;
484
485 res_count = omap_device_count_resources(od);
486 if (res_count > 0) {
487 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
488 if (!res)
489 goto odbs_exit3;
490 }
491 omap_device_fill_resources(od, res);
492
493 od->pdev.num_resources = res_count;
494 od->pdev.resource = res;
495
496 ret = platform_device_add_data(&od->pdev, pdata, pdata_len);
497 if (ret) 687 if (ret)
498 goto odbs_exit4; 688 goto odbs_exit2;
499
500 od->pm_lats = pm_lats;
501 od->pm_lats_cnt = pm_lats_cnt;
502 689
503 if (is_early_device) 690 if (is_early_device)
504 ret = omap_early_device_register(od); 691 ret = omap_early_device_register(pdev);
505 else 692 else
506 ret = omap_device_register(od); 693 ret = omap_device_register(pdev);
507
508 for (i = 0; i < oh_cnt; i++) {
509 hwmods[i]->od = od;
510 _add_hwmod_clocks_clkdev(od, hwmods[i]);
511 }
512
513 if (ret) 694 if (ret)
514 goto odbs_exit4; 695 goto odbs_exit2;
515 696
516 return od; 697 return pdev;
517 698
518odbs_exit4:
519 kfree(res);
520odbs_exit3:
521 kfree(pdev_name2);
522odbs_exit2: 699odbs_exit2:
523 kfree(hwmods); 700 omap_device_delete(od);
524odbs_exit1: 701odbs_exit1:
525 kfree(od); 702 platform_device_put(pdev);
703odbs_exit:
526 704
527 pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret); 705 pr_err("omap_device: %s: build failed (%d)\n", pdev_name, ret);
528 706
@@ -538,11 +716,11 @@ odbs_exit1:
538 * platform_early_add_device() on the underlying platform_device. 716 * platform_early_add_device() on the underlying platform_device.
539 * Returns 0 by default. 717 * Returns 0 by default.
540 */ 718 */
541int omap_early_device_register(struct omap_device *od) 719static int omap_early_device_register(struct platform_device *pdev)
542{ 720{
543 struct platform_device *devices[1]; 721 struct platform_device *devices[1];
544 722
545 devices[0] = &(od->pdev); 723 devices[0] = pdev;
546 early_platform_add_devices(devices, 1); 724 early_platform_add_devices(devices, 1);
547 return 0; 725 return 0;
548} 726}
@@ -638,13 +816,13 @@ static struct dev_pm_domain omap_device_pm_domain = {
638 * platform_device_register() on the underlying platform_device. 816 * platform_device_register() on the underlying platform_device.
639 * Returns the return value of platform_device_register(). 817 * Returns the return value of platform_device_register().
640 */ 818 */
641int omap_device_register(struct omap_device *od) 819static int omap_device_register(struct platform_device *pdev)
642{ 820{
643 pr_debug("omap_device: %s: registering\n", od->pdev.name); 821 pr_debug("omap_device: %s: registering\n", pdev->name);
644 822
645 od->pdev.dev.parent = &omap_device_parent; 823 pdev->dev.parent = &omap_device_parent;
646 od->pdev.dev.pm_domain = &omap_device_pm_domain; 824 pdev->dev.pm_domain = &omap_device_pm_domain;
647 return platform_device_register(&od->pdev); 825 return platform_device_add(pdev);
648} 826}
649 827
650 828
@@ -671,8 +849,9 @@ int omap_device_enable(struct platform_device *pdev)
671 od = to_omap_device(pdev); 849 od = to_omap_device(pdev);
672 850
673 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { 851 if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
674 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", 852 dev_warn(&pdev->dev,
675 od->pdev.name, od->pdev.id, __func__, od->_state); 853 "omap_device: %s() called from invalid state %d\n",
854 __func__, od->_state);
676 return -EINVAL; 855 return -EINVAL;
677 } 856 }
678 857
@@ -710,8 +889,9 @@ int omap_device_idle(struct platform_device *pdev)
710 od = to_omap_device(pdev); 889 od = to_omap_device(pdev);
711 890
712 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { 891 if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
713 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", 892 dev_warn(&pdev->dev,
714 od->pdev.name, od->pdev.id, __func__, od->_state); 893 "omap_device: %s() called from invalid state %d\n",
894 __func__, od->_state);
715 return -EINVAL; 895 return -EINVAL;
716 } 896 }
717 897
@@ -742,8 +922,9 @@ int omap_device_shutdown(struct platform_device *pdev)
742 922
743 if (od->_state != OMAP_DEVICE_STATE_ENABLED && 923 if (od->_state != OMAP_DEVICE_STATE_ENABLED &&
744 od->_state != OMAP_DEVICE_STATE_IDLE) { 924 od->_state != OMAP_DEVICE_STATE_IDLE) {
745 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n", 925 dev_warn(&pdev->dev,
746 od->pdev.name, od->pdev.id, __func__, od->_state); 926 "omap_device: %s() called from invalid state %d\n",
927 __func__, od->_state);
747 return -EINVAL; 928 return -EINVAL;
748 } 929 }
749 930
@@ -837,6 +1018,42 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
837 return omap_hwmod_get_mpu_rt_va(od->hwmods[0]); 1018 return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
838} 1019}
839 1020
1021/**
1022 * omap_device_get_by_hwmod_name() - convert a hwmod name to
1023 * device pointer.
1024 * @oh_name: name of the hwmod device
1025 *
1026 * Returns back a struct device * pointer associated with a hwmod
1027 * device represented by a hwmod_name
1028 */
1029struct device *omap_device_get_by_hwmod_name(const char *oh_name)
1030{
1031 struct omap_hwmod *oh;
1032
1033 if (!oh_name) {
1034 WARN(1, "%s: no hwmod name!\n", __func__);
1035 return ERR_PTR(-EINVAL);
1036 }
1037
1038 oh = omap_hwmod_lookup(oh_name);
1039 if (IS_ERR_OR_NULL(oh)) {
1040 WARN(1, "%s: no hwmod for %s\n", __func__,
1041 oh_name);
1042 return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
1043 }
1044 if (IS_ERR_OR_NULL(oh->od)) {
1045 WARN(1, "%s: no omap_device for %s\n", __func__,
1046 oh_name);
1047 return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
1048 }
1049
1050 if (IS_ERR_OR_NULL(oh->od->pdev))
1051 return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
1052
1053 return &oh->od->pdev->dev;
1054}
1055EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
1056
840/* 1057/*
841 * Public functions intended for use in omap_device_pm_latency 1058 * Public functions intended for use in omap_device_pm_latency
842 * .activate_func and .deactivate_func function pointers 1059 * .activate_func and .deactivate_func function pointers
@@ -917,8 +1134,13 @@ struct device omap_device_parent = {
917 .parent = &platform_bus, 1134 .parent = &platform_bus,
918}; 1135};
919 1136
1137static struct notifier_block platform_nb = {
1138 .notifier_call = _omap_device_notifier_call,
1139};
1140
920static int __init omap_device_init(void) 1141static int __init omap_device_init(void)
921{ 1142{
1143 bus_register_notifier(&platform_bus_type, &platform_nb);
922 return device_register(&omap_device_parent); 1144 return device_register(&omap_device_parent);
923} 1145}
924core_initcall(omap_device_init); 1146core_initcall(omap_device_init);
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e44efb..8b28664d1c62 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/omapfb.h>
23 22
24#include <asm/tlb.h> 23#include <asm/tlb.h>
25#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
@@ -29,10 +28,8 @@
29#include <plat/sram.h> 28#include <plat/sram.h>
30#include <plat/board.h> 29#include <plat/board.h>
31#include <plat/cpu.h> 30#include <plat/cpu.h>
32#include <plat/vram.h>
33 31
34#include "sram.h" 32#include "sram.h"
35#include "fb.h"
36 33
37/* XXX These "sideways" includes are a sign that something is wrong */ 34/* XXX These "sideways" includes are a sign that something is wrong */
38#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) 35#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
@@ -41,16 +38,9 @@
41#endif 38#endif
42 39
43#define OMAP1_SRAM_PA 0x20000000 40#define OMAP1_SRAM_PA 0x20000000
44#define OMAP1_SRAM_VA VMALLOC_END
45#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) 41#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
46#define OMAP2_SRAM_VA 0xfe400000
47#define OMAP2_SRAM_PUB_VA (OMAP2_SRAM_VA + 0x800)
48#define OMAP3_SRAM_VA 0xfe400000
49#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) 42#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000)
50#define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000)
51#define OMAP4_SRAM_VA 0xfe400000
52#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000) 43#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
53#define OMAP4_SRAM_PUB_VA (OMAP4_SRAM_VA + 0x4000)
54 44
55#if defined(CONFIG_ARCH_OMAP2PLUS) 45#if defined(CONFIG_ARCH_OMAP2PLUS)
56#define SRAM_BOOTLOADER_SZ 0x00 46#define SRAM_BOOTLOADER_SZ 0x00
@@ -73,9 +63,9 @@
73#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 63#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
74 64
75static unsigned long omap_sram_start; 65static unsigned long omap_sram_start;
76static unsigned long omap_sram_base; 66static void __iomem *omap_sram_base;
77static unsigned long omap_sram_size; 67static unsigned long omap_sram_size;
78static unsigned long omap_sram_ceil; 68static void __iomem *omap_sram_ceil;
79 69
80/* 70/*
81 * Depending on the target RAMFS firewall setup, the public usable amount of 71 * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,12 +102,9 @@ static int is_sram_locked(void)
112 */ 102 */
113static void __init omap_detect_sram(void) 103static void __init omap_detect_sram(void)
114{ 104{
115 unsigned long reserved;
116
117 if (cpu_class_is_omap2()) { 105 if (cpu_class_is_omap2()) {
118 if (is_sram_locked()) { 106 if (is_sram_locked()) {
119 if (cpu_is_omap34xx()) { 107 if (cpu_is_omap34xx()) {
120 omap_sram_base = OMAP3_SRAM_PUB_VA;
121 omap_sram_start = OMAP3_SRAM_PUB_PA; 108 omap_sram_start = OMAP3_SRAM_PUB_PA;
122 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) || 109 if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
123 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) { 110 (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -126,25 +113,20 @@ static void __init omap_detect_sram(void)
126 omap_sram_size = 0x8000; /* 32K */ 113 omap_sram_size = 0x8000; /* 32K */
127 } 114 }
128 } else if (cpu_is_omap44xx()) { 115 } else if (cpu_is_omap44xx()) {
129 omap_sram_base = OMAP4_SRAM_PUB_VA;
130 omap_sram_start = OMAP4_SRAM_PUB_PA; 116 omap_sram_start = OMAP4_SRAM_PUB_PA;
131 omap_sram_size = 0xa000; /* 40K */ 117 omap_sram_size = 0xa000; /* 40K */
132 } else { 118 } else {
133 omap_sram_base = OMAP2_SRAM_PUB_VA;
134 omap_sram_start = OMAP2_SRAM_PUB_PA; 119 omap_sram_start = OMAP2_SRAM_PUB_PA;
135 omap_sram_size = 0x800; /* 2K */ 120 omap_sram_size = 0x800; /* 2K */
136 } 121 }
137 } else { 122 } else {
138 if (cpu_is_omap34xx()) { 123 if (cpu_is_omap34xx()) {
139 omap_sram_base = OMAP3_SRAM_VA;
140 omap_sram_start = OMAP3_SRAM_PA; 124 omap_sram_start = OMAP3_SRAM_PA;
141 omap_sram_size = 0x10000; /* 64K */ 125 omap_sram_size = 0x10000; /* 64K */
142 } else if (cpu_is_omap44xx()) { 126 } else if (cpu_is_omap44xx()) {
143 omap_sram_base = OMAP4_SRAM_VA;
144 omap_sram_start = OMAP4_SRAM_PA; 127 omap_sram_start = OMAP4_SRAM_PA;
145 omap_sram_size = 0xe000; /* 56K */ 128 omap_sram_size = 0xe000; /* 56K */
146 } else { 129 } else {
147 omap_sram_base = OMAP2_SRAM_VA;
148 omap_sram_start = OMAP2_SRAM_PA; 130 omap_sram_start = OMAP2_SRAM_PA;
149 if (cpu_is_omap242x()) 131 if (cpu_is_omap242x())
150 omap_sram_size = 0xa0000; /* 640K */ 132 omap_sram_size = 0xa0000; /* 640K */
@@ -153,7 +135,6 @@ static void __init omap_detect_sram(void)
153 } 135 }
154 } 136 }
155 } else { 137 } else {
156 omap_sram_base = OMAP1_SRAM_VA;
157 omap_sram_start = OMAP1_SRAM_PA; 138 omap_sram_start = OMAP1_SRAM_PA;
158 139
159 if (cpu_is_omap7xx()) 140 if (cpu_is_omap7xx())
@@ -170,35 +151,14 @@ static void __init omap_detect_sram(void)
170 omap_sram_size = 0x4000; 151 omap_sram_size = 0x4000;
171 } 152 }
172 } 153 }
173 reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base,
174 omap_sram_size,
175 omap_sram_start + SRAM_BOOTLOADER_SZ,
176 omap_sram_size - SRAM_BOOTLOADER_SZ);
177 omap_sram_size -= reserved;
178
179 reserved = omap_vram_reserve_sram(omap_sram_start, omap_sram_base,
180 omap_sram_size,
181 omap_sram_start + SRAM_BOOTLOADER_SZ,
182 omap_sram_size - SRAM_BOOTLOADER_SZ);
183 omap_sram_size -= reserved;
184
185 omap_sram_ceil = omap_sram_base + omap_sram_size;
186} 154}
187 155
188static struct map_desc omap_sram_io_desc[] __initdata = {
189 { /* .length gets filled in at runtime */
190 .virtual = OMAP1_SRAM_VA,
191 .pfn = __phys_to_pfn(OMAP1_SRAM_PA),
192 .type = MT_MEMORY
193 }
194};
195
196/* 156/*
197 * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early. 157 * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
198 */ 158 */
199static void __init omap_map_sram(void) 159static void __init omap_map_sram(void)
200{ 160{
201 unsigned long base; 161 int cached = 1;
202 162
203 if (omap_sram_size == 0) 163 if (omap_sram_size == 0)
204 return; 164 return;
@@ -211,28 +171,18 @@ static void __init omap_map_sram(void)
211 * the ARM may attempt to write cache lines back to SDRAM 171 * the ARM may attempt to write cache lines back to SDRAM
212 * which will cause the system to hang. 172 * which will cause the system to hang.
213 */ 173 */
214 omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED; 174 cached = 0;
215 } 175 }
216 176
217 omap_sram_io_desc[0].virtual = omap_sram_base; 177 omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
218 base = omap_sram_start; 178 omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
219 base = ROUND_DOWN(base, PAGE_SIZE); 179 cached);
220 omap_sram_io_desc[0].pfn = __phys_to_pfn(base); 180 if (!omap_sram_base) {
221 omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE); 181 pr_err("SRAM: Could not map\n");
222 iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc)); 182 return;
223 183 }
224 pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
225 (long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
226 omap_sram_io_desc[0].virtual,
227 omap_sram_io_desc[0].length);
228 184
229 /* 185 omap_sram_ceil = omap_sram_base + omap_sram_size;
230 * Normally devicemaps_init() would flush caches and tlb after
231 * mdesc->map_io(), but since we're called from map_io(), we
232 * must do it here.
233 */
234 local_flush_tlb_all();
235 flush_cache_all();
236 186
237 /* 187 /*
238 * Looks like we need to preserve some bootloader code at the 188 * Looks like we need to preserve some bootloader code at the
@@ -251,13 +201,18 @@ static void __init omap_map_sram(void)
251 */ 201 */
252void *omap_sram_push_address(unsigned long size) 202void *omap_sram_push_address(unsigned long size)
253{ 203{
254 if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) { 204 unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
205
206 available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
207
208 if (size > available) {
255 pr_err("Not enough space in SRAM\n"); 209 pr_err("Not enough space in SRAM\n");
256 return NULL; 210 return NULL;
257 } 211 }
258 212
259 omap_sram_ceil -= size; 213 new_ceil -= size;
260 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN); 214 new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
215 omap_sram_ceil = IOMEM(new_ceil);
261 216
262 return (void *)omap_sram_ceil; 217 return (void *)omap_sram_ceil;
263} 218}
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3ff22e32b602..f7239b33d762 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -662,6 +662,90 @@ int of_property_read_string(struct device_node *np, const char *propname,
662EXPORT_SYMBOL_GPL(of_property_read_string); 662EXPORT_SYMBOL_GPL(of_property_read_string);
663 663
664/** 664/**
665 * of_property_read_string_index - Find and read a string from a multiple
666 * strings property.
667 * @np: device node from which the property value is to be read.
668 * @propname: name of the property to be searched.
669 * @index: index of the string in the list of strings
670 * @out_string: pointer to null terminated return string, modified only if
671 * return value is 0.
672 *
673 * Search for a property in a device tree node and retrieve a null
674 * terminated string value (pointer to data, not a copy) in the list of strings
675 * contained in that property.
676 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
677 * property does not have a value, and -EILSEQ if the string is not
678 * null-terminated within the length of the property data.
679 *
680 * The out_string pointer is modified only if a valid string can be decoded.
681 */
682int of_property_read_string_index(struct device_node *np, const char *propname,
683 int index, const char **output)
684{
685 struct property *prop = of_find_property(np, propname, NULL);
686 int i = 0;
687 size_t l = 0, total = 0;
688 const char *p;
689
690 if (!prop)
691 return -EINVAL;
692 if (!prop->value)
693 return -ENODATA;
694 if (strnlen(prop->value, prop->length) >= prop->length)
695 return -EILSEQ;
696
697 p = prop->value;
698
699 for (i = 0; total < prop->length; total += l, p += l) {
700 l = strlen(p) + 1;
701 if ((*p != 0) && (i++ == index)) {
702 *output = p;
703 return 0;
704 }
705 }
706 return -ENODATA;
707}
708EXPORT_SYMBOL_GPL(of_property_read_string_index);
709
710
711/**
712 * of_property_count_strings - Find and return the number of strings from a
713 * multiple strings property.
714 * @np: device node from which the property value is to be read.
715 * @propname: name of the property to be searched.
716 *
717 * Search for a property in a device tree node and retrieve the number of null
718 * terminated string contain in it. Returns the number of strings on
719 * success, -EINVAL if the property does not exist, -ENODATA if property
720 * does not have a value, and -EILSEQ if the string is not null-terminated
721 * within the length of the property data.
722 */
723int of_property_count_strings(struct device_node *np, const char *propname)
724{
725 struct property *prop = of_find_property(np, propname, NULL);
726 int i = 0;
727 size_t l = 0, total = 0;
728 const char *p;
729
730 if (!prop)
731 return -EINVAL;
732 if (!prop->value)
733 return -ENODATA;
734 if (strnlen(prop->value, prop->length) >= prop->length)
735 return -EILSEQ;
736
737 p = prop->value;
738
739 for (i = 0; total < prop->length; total += l, p += l) {
740 l = strlen(p) + 1;
741 if (*p != 0)
742 i++;
743 }
744 return i;
745}
746EXPORT_SYMBOL_GPL(of_property_count_strings);
747
748/**
665 * of_parse_phandle - Resolve a phandle property to a device_node pointer 749 * of_parse_phandle - Resolve a phandle property to a device_node pointer
666 * @np: Pointer to device node holding phandle property 750 * @np: Pointer to device node holding phandle property
667 * @phandle_name: Name of property holding a phandle value 751 * @phandle_name: Name of property holding a phandle value
diff --git a/include/linux/of.h b/include/linux/of.h
index 9180dc5cb00b..5dfe2d5a8b5d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -203,6 +203,11 @@ extern int of_property_read_u32_array(const struct device_node *np,
203extern int of_property_read_string(struct device_node *np, 203extern int of_property_read_string(struct device_node *np,
204 const char *propname, 204 const char *propname,
205 const char **out_string); 205 const char **out_string);
206extern int of_property_read_string_index(struct device_node *np,
207 const char *propname,
208 int index, const char **output);
209extern int of_property_count_strings(struct device_node *np,
210 const char *propname);
206extern int of_device_is_compatible(const struct device_node *device, 211extern int of_device_is_compatible(const struct device_node *device,
207 const char *); 212 const char *);
208extern int of_device_is_available(const struct device_node *device); 213extern int of_device_is_available(const struct device_node *device);
@@ -256,6 +261,19 @@ static inline int of_property_read_string(struct device_node *np,
256 return -ENOSYS; 261 return -ENOSYS;
257} 262}
258 263
264static inline int of_property_read_string_index(struct device_node *np,
265 const char *propname, int index,
266 const char **out_string)
267{
268 return -ENOSYS;
269}
270
271static inline int of_property_count_strings(struct device_node *np,
272 const char *propname)
273{
274 return -ENOSYS;
275}
276
259static inline const void *of_get_property(const struct device_node *node, 277static inline const void *of_get_property(const struct device_node *node,
260 const char *name, 278 const char *name,
261 int *lenp) 279 int *lenp)